查看某个节点的信息
redis-cli -h host -p port -a password info Replication
-h: 后面跟着要查看的节点的主机
-p: 后面跟着要查看的节点的端口
-a: 后面跟着要查看的节点的密码,没有没密码可以不要这个字段
如下面查看某个主节点的信息
[root@iZj6c7eeosj2t5vjw8rf4xZ /]# redis-cli -h 116.196.65.198 info replication
Could not connect to Redis at 116.196.65.198:6379: Connection refused
Could not connect to Redis at 116.196.65.198:6379: Connection refused
[root@iZj6c7eeosj2t5vjw8rf4xZ /]# redis-cli -h 116.196.65.198 -p 7001 info Replication
NOAUTH Authentication required.
[root@iZj6c7eeosj2t5vjw8rf4xZ /]# redis-cli -h 116.196.65.198 -p 7001 -a frank info Replication
# Replication
role:master
connected_slaves:1
slave0:ip=47.52.41.245,port=7005,state=online,offset=16465,lag=1
master_repl_offset:16465
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:2
repl_backlog_histlen:16464
查看某个从节点的信息
[root@iZj6c7eeosj2t5vjw8rf4xZ /]# redis-cli -h 47.52.41.245 -p 7003 -a frank info Replication
# Replication
role:slave
master_host:116.196.65.198
master_port:7002
master_link_status:up
master_last_io_seconds_ago:9
master_sync_in_progress:0
slave_repl_offset:16507
slave_priority:100
slave_read_only:1
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
连接集群上面某个节点
redis-cli -c -h host -p port -a password
-c: 表示该节点是集群的节点
-h: 后面跟着要查看的节点的主机
-p: 后面跟着要查看的节点的端口
-a: 后面跟着要查看的节点的密码,没有没密码可以不要这个字段
网友评论