zl程序教程

您现在的位置是:首页 >  系统

当前栏目

在centos7上安装夜莺监控

2023-06-13 09:11:52 时间

大家好,又见面了,我是你们的朋友全栈君。

在 /opt 目录下建立目录 /n9e 和 /temp 安装包存放在 /opt/temp 目录下,本次实验安装包 mysql-5.7.31-linux-glibc2.12-x86_64.7z nginx-1.14.2.7z p7zip-16.02-10.el7.x86_64.rpm redis-6.0.6.7z n9e-2.7.2.7z

标题1.安装7z

rpm -ivh p7zip-16.02-10.el7.x86_64.rpm

yum -y install epel-release

yum -y install p7zip p7zip-plugins

解压命令 7za x *****.7z -o/解压目录

标题2.安装mysql

7za -x mysql-5.7.31-linux-glibc2.12-x86_64.7z -o/opt/n9e

cd /opt/n9e/mysql-5.7.31-linux-glibc2.12-x86_64/

以下操作在解压后的/opt/n9e/mysql-5.7.31-linux-glibc2.12-x86_64/目录下

#根据情况修改conf/my.cnf,比如datadir(数据存放位置)

创建errmsg.sys,防止初始化报错

mkdir -p logs/error_message/ cp -a share/english/errmsg.sys logs/error_message/

数据库初始化,并找到root随机密码记下(最后一行)例如:DQ_ilnDOI8Nc

./bin/mysqld –defaults-file=conf/my.cnf –initialize ##初始化

root用户启动 nohup ./bin/mysqld –defaults-file=conf/my.cnf –user=root &

进入数据库 ./bin/mysql -uroot -p

输入初始化得到的随机密码

修改密码 ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘密码’;

刷新权限 FLUSH PRIVILEGES;

#最后,注意若非本机访问,检查centos7防火墙是否开放3306端口

标题3.编译安装nginx

安装 gcc 和 gcc-c++

yum -y install gcc gcc-c++

解压nginx包 7za x nginx-1.14.2.7z -o. (解压到temp文件夹)

cd nginx-1.14.2/

cd nginx-1.14.2/

编译安装,替换<安装目录>

./configure –prefix=/opt/n9e/nginx-1.14.2 –with-stream –with-http_stub_status_module –with-http_realip_module –with-http_ssl_module –with-http_gzip_static_module –with-pcre=…/dependencies/pcre-8.38 –with-zlib=…/dependencies/zlib-1.2.11 –with-openssl=…/dependencies/openssl-1.1.1a

多核编译

make -j 4

make install

标题4.安装redis

7za x redis-6.0.6.7z -o/opt/n9e

cd /opt/n9e/redis-6.0.6/conf

vim redis.conf 修改redis密码,将requirepass redis修改为requirepass 密码

切换到上级目录cd /opt/n9e/redis-6.0.6 ; 非阻塞式启动 nohup ./bin/redis-server conf/redis.conf &

登陆验证 ./bin/redis-cli

标题5.安装夜莺

7za x n9e-2.7.2.7z -o/opt/n9e

cd /opt/n9e/n9e-2.7.2/

导入数据库 sql里面存放的 n9e_hbs.sql n9e_mon.sql n9e_uic.sql 三个文件

[root@centos7 n9e-2.7.2] /opt/n9e/mysql-5.7.31-linux-glibc2.12-x86_64/bin/mysql -p < sql/n9e_hbs.sql Enter password: Mysql数据库的密码 [root@centos7 n9e-2.7.2]

切换到etc文件夹下 cd etc/ 修改配置文件

[root@centos7 etc]$ vim mysql.yml


uic: addr: “netsec:netsec@tcp(127.0.0.1:3306)/n9e_uic?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false mon: addr: “netsec:netsec@tcp(127.0.0.1:3306)/n9e_mon?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false hbs: addr: “netsec:netsec@tcp(127.0.0.1:3306)/n9e_hbs?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false

将netsec:netsec全部改成 root:mysql密码

uic: addr: “root:120604@tcp(127.0.0.1:3306)/n9e_uic?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false mon: addr: “root:120604@tcp(127.0.0.1:3306)/n9e_mon?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false hbs: addr: “root:120604@tcp(127.0.0.1:3306)/n9e_hbs?charset=utf8&parseTime=True&loc=Asia%2FShanghai” max: 16 idle: 4 debug: false

vim judge.yml

将 pass: netsec 修改为 pass:数据库密码 ###注意之间空格别删了

vim monapi.yml

将 pass: netsec 修改为 pass:数据库密码 ###注意之间空格别删了

vim nginx.conf

修改 root /opt/nightingale/n9e-2.7.2/pub; 为 root /opt/n9e/n9e-2.7.2/pub;

mkdir -p /var/log/nginx

touch /var/log/nginx/error.log

cp -a /opt/n9e/nginx-1.14.2/conf/ /etc/nginx/

/opt/n9e/nginx-1.14.2/sbin/nginx -c /opt/n9e/n9e-2.7.2/etc/nginx.conf

curl 127.0.0.1:8080 测试一下

./control start all 启动 (./control status查看状态)

标题6.打开监控

在网址栏输入 本机ip:8080 回车打开夜莺监控

用户 root 密码 root

附:

实际生产中防火墙一般开启,可能无法打开监控,这时检查8080端口是否关闭

开启防火墙8080端口 firewall-cmd –zone=public –add-port=8080/tcp –permanent firewall-cmd –reload

[root@centos7 n9e-2.7.2] firewall-cmd –zone=public –add-port=8080/tcp –permanent success [root@centos7 n9e-2.7.2] firewall-cmd –reload success

附:

关闭服务后需要重新打开

mysql nohup ./bin/mysqld –defaults-file=conf/my.cnf –user=root &

redis nohup ./bin/redis-server conf/redis.conf &

nginx /opt/n9e/nginx-1.14.2/sbin/nginx -c /opt/n9e/n9e-2.7.2/etc/nginx.conf

n9e ./control start all

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/138737.html原文链接:https://javaforall.cn