以下过程参考标准生产环境,使用的是安全模式。如未采用安全模式,可省略生成证书的步骤。
参考集群环境服务配置,做免密及用户配置
在新节点上,使用root用户操作
mkdir /var/lib/hubble
mkdir /var/lib/hubble/certs
mkdir /var/lib/hubble/mysafedirectory
chown hubble:hubble -R /var/lib/hubble
mkdir -p /data/hubbledir ## 数据存储目录,按集群存储规划创建
chown -R hubble:hubble /data/hubbledir
在现役节点上,使用hubble用户操作
scp /usr/local/bin/hubble <new node>:/usr/local/bin/
scp /var/lib/hubble/certs/ca.crt <new node>:/var/lib/hubble/certs/
scp /var/lib/hubble/mysafedirectory/ca.key <new node>:/var/lib/hubble/mysafedirectory/
cd /var/lib/hubble
hubble cert create-node <new node hostname> <new node ip> --certs-dir=certs --ca-key=mysafedirectory/ca.key --overwrite
在新节点上,使用root用户操作
vi /etc/systemd/system/hubble.service
[Unit]
Description=Hubble Database cluster
Requires=network.target
[Service]
Type=notify
WorkingDirectory=/var/lib/hubble
ExecStart=/usr/local/bin/hubble start --locality=country=cn,region=ch-beijin,datacenter=tianyun,rack=1,node=<new node id> --certs-dir=certs --listen-addr=0.0.0.0:15432 --advertise-host=<new node> --join=hubble01:15432,hubble02:15432,hubble03:15432,hubble04:15432,hubble05:15432,<new node>:15432 --cache=30GiB --max-sql-memory=10GiB --store=path=/data3/hubbledir/hubble,attrs=ssd,size=350GiB,rocksdb=write_buffer_size=134217728 --store=path=/data4/hubbledir/hubble,attrs=ssd,size=350GiB,rocksdb=write_buffer_size=134217728 --store=path=/data5/hubbledir/hubble,attrs=ssd,size=350GiB,rocksdb=write_buffer_size=134217728 --http-addr=0.0.0.0:48080 --max-disk-temp-storage=10GiB
TimeoutStopSec=60
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=hubble
User=hubble
LimitNOFILE=1000000
[Install]
WantedBy=default.target
在新节点上,使用root用户操作
修改hubble.service
文件的用户权限
chown hubble:hubble /etc/systemd/system/hubble.service
添加普通用户权限
vi /etc/sudoers
## Same thing without a password
hubble ALL=(root) NOPASSWD:/usr/bin/systemctl start hubble,/usr/bin/systemctl stop hubble,/usr/bin/systemctl restart hubble,/usr/bin/systemctl enable hubble,/usr/bin/systemctl disable hubble,/usr/bin/systemctl daemon-reload
添加完成后,输入:wq!
保存退出
:wq!
使用hubble用户操作
sudo systemctl daemon-reload
sudo systemctl start hubble
https://192.168.1.11:48080/
systemctl status hubble
hubble sql --certs-dir=/var/lib/hubble/certs --host=<new node>
systemctl enable hubble ## root用户操作
sudo systemctl enable hubble ## hubble用户操作