某些场景下,redis集群以内网ip发现节点并提供服务,所以只能在服务器环境下以内网ip访问,此时redis-cli无疑是最可靠的工具。而各种gui工具都傻眼了(当然web ui类工具除外)。
redis-cli nodejs版
redis-cli nodejs版可以脱离redis-server独立安装。
安装
yum install epel-release -y
yum install nodejs npm -y
npm install -g redis-cli
ln -s rdcli /usr/local/bin/redis-cli
连接集群
redis-cli -c -a password -h 192.168.0.182 -p 8001
查看节点
192.168.0.182:8001> cluster nodes
输出如下:
25c0ec80c979ce3a1d5a86b8ee1fb41931a58630 192.168.0.184:8002@18002 slave 13028997bdcfd78e4bbe751875300856b6712f28 0 1686104553205 5 connected
2b824a73ed63d974a44a157153a97caf84d1a386 192.168.0.182:8002@18002 master - 0 1686104555213 7 connected 5461-10922
44c2e3456cef26dc8e06f286989c9a294bf44b5a 192.168.0.184:8001@18001 master - 0 1686104551198 1 connected 0-5460
13028997bdcfd78e4bbe751875300856b6712f28 192.168.0.182:8001@18001 myself,master - 0 1686104553000 5 connected 10923-16383
61bca4eb20f3b3a1dd283e21f9554300892fb36c 192.168.0.59:8001@18001 slave 2b824a73ed63d974a44a157153a97caf84d1a386 0 1686104554209 7 connected
f9e76dd99eb7ee48481b2f4ac0ae76862ec27fea 192.168.0.59:8002@18002 slave 44c2e3456cef26dc8e06f286989c9a294bf44b5a 0 1686104551000 1 connected
redis完整安装包含的redis-cli
例如redis docker container名称为redis-server:
连接集群
docker exec -it redis-server redis-cli -c -a password -h 192.168.0.182 -p 8001
使用方式与nodejs版相同。
标签:cli,redis,192.168,集群,connected,0.182,8001 From: https://www.cnblogs.com/cheap-cabbage/p/17462806.html