Table of contents
Involving middleware and version
Preparatory work
Involving middleware and version
- nginx 1.16.1
- mysql 5.7.25
- redis 5.0.14
- prometheus 2.32.1
- n9e 5.3.0
- telegraph 1.21.2
- Software installation directory /usr/local
deployment architecture
Among them, mysql redis is in single-point mode
Machine list
192.168.25.128 |
n9e-webapi、redis |
192.168.25.129 |
n9e-webserver、redis |
192.168.25.130 |
prometheus、mysql |
redis deployment
yum install -y gcc
Software package acquisition
curl -OL https://download.redis.io/releases/redis-5.0.14.tar.gz
Unzip
tar -xvf redis-5.0.14.tar.gz
Compile and install
make PREFIX=/usr/local/redis/redis-single install
The new directory is under the bin directory at the same level
cd /usr/local/redis/redis-single
mkdir run data log conf
vim /usr/local/redis/redis-single/conf/redis.conf
#bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize no
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile ""
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
replica-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4096
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
daemonize yes
requirepass password456
start up
./redis-server ../conf/redis.conf
Later, it needs to be added to the systemd method to automatically start at boot.
MySQL deployment
Version 5.7.25 is used here, first download the package
MySQL :: Download MySQL Community Server (Archived Versions)
Go to the server to confirm whether there are residual packages
rpm -qa | grep mysql
yum remove mysql-libs
Install the corresponding rpm package dependencies in order common→libs→client→server.
rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
Start service
systemctl start mysqld.service
systemctl enable mysqld.service
View initial password
grep 'temporary password' /var/log/mysqld.log
Log in to change password
mysql> set global validate_password_policy=1;
mysql> set password for root@localhost=password('password456');
mysql> grant all privileges on *.* to root@'%' identified by 'password456';
mysql> flush privileges;
prometheus deployment
get package
tar -xvf prometheus-2.32.1.linux-amd64.tar.gz -C /usr/local/
mv prometheus-2.32.1.linux-amd64/ prometheus
Modify configuration file
start up
nohup ./prometheus --enable-feature=remote-write-receiver&
Later, you can set the boot mode to use systemd.
n9e deployment
get package
curl -OL https://github.com/didi/nightingale/releases/download/v5.3.0/n9e-5.3.0.tar.gz
mkdir /usr/local/n9e
tar -xvf n9e-5.3.0.tar.gz -C /usr/local/n9e
Modify the corresponding configuration file
/usr/local/n9e/etc/server.conf
[Redis]
# address, ip:port
Address = "192.168.25.129:6379"
# requirepass
Password = "password456"
[MySQL]
# mysql address host:port
Address = "192.168.25.130:3306"
# mysql username
User = "root"
# mysql password
Password = "password456"
[Reader]
# prometheus base url
Url = "http://192.168.25.130:9090"
# Basic auth username
[[Writers]]
Url = "http://192.168.25.130:9090/api/v1/write"
# Basic auth username
/usr/local/n9e/etc/webapi.conf
redis mysql
[[Clusters]]
# Prometheus cluster name
Name = "Default"
# Prometheus APIs base url
Prom = "http://192.168.25.130:9090"
Database initialization
mysql -uroot -h192.168.25.130 -ppassword456 < a-n9e.sql
Start the service, and then you can add it to start automatically at boot using systemd.
nohup ./n9e server &
nohup ./n9e webapi &
visit page