Tips:
The IP in this article refers to the IP of the server where redis is installed, and password refers to the password of redis.
(Learning video sharing: redis video tutorial)
Cluster related information view
1.Cluster status
redis-cli -h ip -p 9379 -a password cluster info
2. Cluster node information
redis-cli -h ip -p 9379 -a password cluster nodes
3. Node memory, cpu, key number and other information (each node needs to be checked)
redis-cli -h ip -p 9379 -a password info
4. From the redis cluster View the key (only need to connect to the master node to view)
a. View all keys of the node
redis-cli -h ip -p 9379 -a password keys *
b. View the value of the key
redis-cli -h ip -p 9379 -a password -c get key
c .Check the key value validity period
redis-cli -h ip -p 9379 -a password -c ttl key
View the data stored in redis
1.ssh root@ip
2.Password: password
3.keys *
4. Check the remaining expiration time of stored data
ttl key
4. Check the type of key (string, set, list, hash)
type key
5. Check the value of key (string Type)
get key
6. View the value of key (set type)
scard key //获取 set 集合中元素的数量 smembers key //查看 set 中的内容
7. View the value of key (hash type)
hlen key //获取 key 键的字段数量 hgetall key //返回 key 键的所有字段及其值 hkeys key //获取 key 键中所有字段的名字 hvals key //获取 key 键中所有字段的值
Related recommendations: redis database tutorial
The above is the detailed content of How to view redis cluster information. For more information, please follow other related articles on the PHP Chinese website!