ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
创建监控目录和权限 ```` useradd -m -s /bin/bash prometheus chown prometheus:prometheus prometheus/* ```` ```` yum install epel-release yum install redis ```` cd /etc mkdir redis-cluster mkdir -p {21001,21003} #修改配置文件 #复制配置文件到redis-cluster里 ```` bind 0.0.0.0 protected-mode yes port 21003 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize no supervised no pidfile /var/run/redis_21003.pid loglevel notice logfile /var/log/redis/redis_21003.log databases 16 save "" stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump-21003.rdb dir /var/lib/redis slave-serve-stale-data yes slave-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no slave-priority 100 maxclients 10000 maxmemory 10737418240 maxmemory-policy volatile-lru 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 lua-time-limit 5000 cluster-enabled yes cluster-config-file nodes-21003.conf cluster-node-timeout 15000 cluster-require-full-coverage no 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 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 60 aof-rewrite-incremental-fsync yes ```` #复制启动服务到/usr/lib/systemd/system/ systemctl deamon-reload #修改启动项和监控端口 ```` #cat /usr/lib/systemd/system/redis-21003.service [Unit] Description=Redis persistent key-value database After=network.target [Service] LimitNOFILE=65535 ExecStart=/usr/bin/redis-server /etc/redis-cluster/21003/redis.conf --daemonize no ExecStop=/usr/bin/redis-cli -h 127.0.0.1 -p 21003 shutdown User=redis Group=redis RuntimeDirectory=redis RuntimeDirectoryMode=0755 [Install] WantedBy=multi-user.target ```` #监控项 ```` [Unit] Description=Prometheus Redis Exporter After=network.target [Service] User=prometheus WorkingDirectory=/app/prometheus/redis_exporter ExecStart=/app/prometheus/redis_exporter/redis_exporter -redis.addr 172.25.15.71:21001,172.25.15.71:21003 -web.listen-address 0.0.0.0:22101 Restart=on-failure RestartSec=60s [Install] WantedBy=multi-user.target ```` #启动服务 ```` systemctl enable redis-exporter.service systemctl enable redis-21003 systemctl start redis-21003 systemctl start redis-exporter.service ```` ```` yum install ruby gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB curl -sSL https://get.rvm.io | bash -s stable find / -name rvm -print source /usr/local/rvm/scripts/rvm rvm install 2.4.1 ruby -v rvm use 2.4.1 gem install redis --version 3.3.5 ```` 创建集群 ./redis-trib.rb create --replicas 1 172.25.15.70:21001 172.25.15.70:21003 172.25.15.71:21001 172.25.15.71:21003 172.25.15.72:21001 172.25.15.72:21003 防火墙放通