open-falcon 分布式安装
1,open-falcon 分布式安装
服务器 | 安装组件 |
---|---|
192.168.0.202 | 单机版运行所有组件 |
192.168.0.196 | 运行组件transfer 、hbs 、agent |
1.1 服务器192.168.0.196
open-falcon-v0.3.x.tar.gz
# scp open-falcon-v0.3.x.tar.gz root@192.168.0.196:/home/
# mkdir open-falcon
# tar -zxvf open-falcon-v0.3.x.tar.gz -C open-falcon/
transfer
# cp open-falcon/transfer/config/cfg.json{,.backup}
# ls open-falcon/transfer/config/
cfg.json cfg.json.backup
# vim open-falcon/transfer/config/cfg.json
cat open-falcon/transfer/config/cfg.json | jq ."judge"
{
"enabled": true,
"batch": 200,
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"replicas": 500,
"cluster": {
"judge-00": "192.168.0.202:6080"
}
}
cat open-falcon/transfer/config/cfg.json | jq ."graph"
{
"enabled": true,
"batch": 200,
"connTimeout": 1000,
"callTimeout": 5000,
"maxConns": 32,
"maxIdle": 32,
"replicas": 500,
"cluster": {
"graph-00": "192.168.0.202:6070"
}
}
hbs
cp open-falcon/hbs/config/cfg.json{,.backup}
ls open-falcon/hbs/config/
cfg.json cfg.json.backup
cat open-falcon/hbs/config/cfg.json
{
"debug": true,
"database": "root:@tcp(192.168.0.202:3306)/falcon_portal?loc=Local&parseTime=true",
"hosts": "",
"maxConns": 20,
"maxIdle": 15,
"listen": ":6030",
"trustable": [""],
"http": {
"enabled": true,
"listen": "0.0.0.0:6031"
}
}
2,运行
# ./open-falcon start agent
[falcon-agent] 33027
# ./open-falcon start hbs
[falcon-hbs] 33095
# ./open-falcon start transfer
[falcon-transfer] 33177
hbs
启动失败
# ./open-falcon check
falcon-graph DOWN -
falcon-hbs DOWN -
falcon-judge DOWN -
falcon-transfer UP 33177
falcon-nodata DOWN -
falcon-aggregator DOWN -
falcon-agent UP 33027
falcon-gateway DOWN -
falcon-api DOWN -
falcon-alarm DOWN -
- 查看
hbs
日志
数据库连接失败
cat /root/open-falcon/hbs/logs/hbs.log
2019/11/29 15:31:25 cfg.go:79: read config file: /root/open-falcon/hbs/config/cfg.json successfully
2019/11/29 15:31:25 db.go:38: ping db fail: dial tcp 192.168.0.202:3306: connect: connection refused
2019/11/29 15:33:36 cfg.go:79: read config file: /root/open-falcon/hbs/config/cfg.json successfully
2019/11/29 15:33:36 db.go:38: ping db fail: dial tcp 192.168.0.202:3306: connect: connection refused
3,登陆安装数据库的节点192.168.0.202
mysql> select Host,User,authentication_string,plugin from user;
+-----------+------------------+-------------------------------------------+-----------------------+
| Host | User | authentication_string | plugin |
+-----------+------------------+-------------------------------------------+-----------------------+
| localhost | root | | mysql_native_password |
| localhost | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |
| localhost | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password |
| localhost | debian-sys-maint | *FA4B1F47B8478379F08A57DAD145CE48A2B53E47 | mysql_native_password |
+-----------+------------------+-------------------------------------------+-----------------------+
4 rows in set (0.00 sec)
- 配置
mysql
数据库root远程登陆
mysql> update user set Host='%' where User='root';
mysql> select Host,User,authentication_string,plugin from user;
+-----------+------------------+-------------------------------------------+-----------------------+
| Host | User | authentication_string | plugin |
+-----------+------------------+-------------------------------------------+-----------------------+
| % | root | | mysql_native_password |
mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.05 sec)
grep -irn 127.0.0.1 ./
./mysql.conf.d/mysqld.cnf:43:bind-address = 127.0.0.1
- 注释
bind-address
vim /etc/mysql/mysql.conf.d/mysqld.cnf
# bind-address = 127.0.0.1
- 重启
mysql
systemctl restart mysql.service
4,重启启动hbs
192.168.0.196
# ./open-falcon start hbs
[falcon-hbs] 48105
# ./open-falcon check
falcon-graph DOWN -
falcon-hbs UP 48105
falcon-judge DOWN -
falcon-transfer UP 33177
falcon-nodata DOWN -
falcon-aggregator DOWN -
falcon-agent UP 33027
falcon-gateway DOWN -
falcon-api DOWN -
falcon-alarm DOWN -
- 服务器添加成功
6,其它分布式节点安装
scp -r root@192.168.0.196:/root/open-falcon/ .
./open-falcon check
./open-falcon start hbs && ./open-falcon start agent && ./open-falcon start transfer
参考: