搭建REDIS集羣遇到的問題

1.客戶端啓動 指定IP定端口 指定認證密碼
./redis1/src/redis-cli -h 192.168.38.145 -p 7006 -a 123456

2.在客戶端內命令開啓、關閉認證
1) 開啓登陸密碼校驗
在redis-cli命令行工具中執行如下命令:
config set requirepass yourpassword
2.)禁用登陸密碼校驗
同上,需要在redis-cli中執行如下命令:
config set requirepass ""
注:如果服務重啓 密碼打開的情況下 命令中關閉認證仍需要重新認證 

3.redis鏈接集羣設置,redis3.0以後通過./redis-cli --cluster create ip:port ...開啓集羣
./redis-cli --cluster create 192.168.38.145:7001 192.168.38.145:7002 192.168.38.145:7003 192.168.38.145:7004 192.168.38.145:7005 192.168.38.145:7006 --cluster-replicas 1 -a 123456

4.集羣啓動報[ERR] Node 192.168.38.145:7001 NOAUTH Authentication required.
因爲設置了密碼認證 在啓動集羣連接的時候 加-a 密碼 認證

5.redis 5.0集羣啓動報[ERR] Node 127.0.0.1:7001 is not configured as a cluster node.
把cluster-enable yes註釋去了 appendonly 設爲 yes 重啓服務

6.集羣啓動報[ERR] Node 192.168.38.145:7002 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.
清空數據 連接該ip端口客戶端 執行flushall、cluster reset命令
[root@192 src]# ./redis-cli -h 127.0.0.1 -p 7001 -a 123456
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
127.0.0.1:7001> flushall
OK
127.0.0.1:7001> cluster reset
OK
127.0.0.1:7001> exit

集羣啓動成功:


7.連接集羣客戶端./redis-cli -c -h 127.0.0.1 -p 7001 -a 123456
連接集羣客戶端後set key value時會計算key的hash值 存儲在對應ip:port服務器上的槽點中

java連接redis:https://blog.csdn.net/weixin_36634753/article/details/80821915

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章