ubuntu 安装 nightingale
准备情况
# 三台ubuntu机器
192.168.1.91 master
192.168.1.92 node1
192.168.1.93 node2
# 负载情况
三台都是4cpu 8G 250stroage
# 如何查看cpu mem stroage
# cpu:
top 然后按1
# mem
free -h
# stroage
df -h
安装mysql
# 建议将mysql 安装在 io 使用少,磁盘大的机器上。这里选择192.168.1.93 节点上
apt install -y mysql-server-5.7
apt install mysql-client
# apt install libmysqlclient-dev
vim /etc/mysql/mysql.conf.d/mysqld.conf
注释掉
#bind-address = 127.0.0.1
# 进入修改密码
grant all on *.* to root@‘%‘ identified by ‘你的密码‘ with grant option;
flush privileges;
重启mysql
编译安装redis
# 安装于 192.168.1.92 节点上
apt install update
apt install -y redis-server
vim /etc/redis/redis.conf
# 设置1G
maxmemory 1073741824
protected-mode no
systemctl restart redis
master 安装nightingale
git clone https://github.com/didi/nightingale.git
# 此处需要有go语言,没有的话请自行百度安装
export GO111MODULE=on
cd nightingale
# 编译需要用到gcc
apt install gcc
./control build
# 添加sql 至mysql
mysql -h 192.168.1.93 -u root -p < n9e_uic.sql
mysql -h 192.168.1.93 -u root -p < n9e_mon.sql
mysql -h 192.168.1.93 -u root -p < n9e_hbs.sql
# 修改 配置文件
cat etc
grep -lr 3306 | xargs sed -i ‘s/127.0.0.1:3306/192.168.1.93:3306/g‘
grep -lr 6379 | xargs sed -i ‘s/127.0.0.1:3306/192.168.92:6379/g‘
./control start all
# collector 关于磁盘已满的可以忽略掉
mountPoint: ["/"] # 至检查"/"
mountIgnorePrefix
- /var/lib # 忽略掉/var/lib
节点安装
# 需要master如下的文件 保存到 其他节点的/home/n9e 下
|- n9e-collector
|- etc/
|- collector.yml
|- address.yml
|- n9e-collector.service # 这个文件在master的nightingale项目下的etc/service 下
# 进入其他节点操作
cd /home/n9e
vim address.yml
monapi:
http: 0.0.0.0:5800
addresses:
- 192.168.1.91
transfer:
http: 0.0.0.0:5810
rpc: 0.0.0.0:5811
addresses:
- 192.168.1.91
collector:
http: 0.0.0.0:2058
vim collector.yml
// 根据情况而动
mv etc/n9e-collector.service /etc/systemd/system/
systemctl enable n9e-collector.service & systemctl start n9e-collector.service
安装nginx
# nginx 部署就不多说了
apt install nignx
# 修改一下/etc/nginx/nginx.conf nightingale 也有相应的配置文件