centos7安裝redis3.2.5叢集
安裝參照 https://blog.csdn.net/mingliangniwo/article/details/54600640 https://blog.csdn.net/u013820054/article/details/51354189
redis3.25叢集配置檔案-
daemonize yes
pidfile /var/run/redis_7000.pid
port 7000
cluster-enabled yes
cluster-config-file nodes_7000.conf
cluster-node-timeout 5000
appendonly yes
欄位說明:
daemonize yes //redis後臺執行
pidfile /var/run/redis_7000.pid //pidfile檔案對應
port 7000 //埠
cluster-enabled yes //開啟叢集 把註釋#去掉
cluster-config-file nodes_7000.conf //叢集的配置 配置檔案首次啟動自動生成
cluster-node-timeout 5000 //請求超時 設定5秒夠了
appendonly yes //aof日誌開啟 有需要就開啟,它會每次寫操作都記錄一條日誌
redis叢集啟動、停止
開始啟動:
方式一、
[[email protected]
127.0.0.1:7000> set name "hello"
(error) NOAUTH Authentication required.
127.0.0.1:7000> auth joinu_1233
OK
方法二、
[[email protected] conf]# redis-cli -c -p 7000 -a joinu_1233
127.0.0.1:7000> set name fish
-> Redirected to slot [5798] located at 127.0.0.1:7002
OK
127.0.0.1:7002>
Redis叢集停止:
方法一:
[[email protected] conf]# redis-cli -c -p 7000 -a joinu_1233 shutdown
[[email protected] conf]# redis-cli -c -p 7000 -a joinu_1233
Could not connect to Redis at 127.0.0.1:7000: Connection refused
Could not connect to Redis at 127.0.0.1:7000: Connection refused
not connected>
方法二:kill -9 +redis程序
redis叢集遷移資料庫
https://www.2cto.com/database/201610/560101.html