Redis—负载状态

服务端启动与客户端连接

# 服务端启动
# 客户端连接:host:远程redis服务器IP。port:远程redis服务端口。password:远程redis服务密码(无密码就不需要-a参数了) [root@localhost
~]# redis-cli
[root@localhost ~]# redis-cli -h host -p port -a password

查看redis负载状态

# 如果redis设置连接密码,客户端连接 redis 服务就需要密码验证,否则无法执行命令。
127.0.0.1:6379> auth mypassword
# 查看是否设置了密码验证与修改该参数
127.0.0.1:6379> config get requirepass 127.0.0.1:6379> config set requirepass "newpassword"
# 使用info 命令查看redis使用情况(负载状态)
127.0.0.1:6379> info 127.0.0.1:6379> info Server
# 查询redis当前的连接数(连接的客户端数量)
127.0.0.1:6379> info clients
# 查询redis允许的最大连接数(与修改最大连接数)
127.0.0.1:6379> config get maxclients 127.0.0.1:6379> CONFIG set maxclients 10
# 直接在客户端连接redis服务端的时候获取所有redis负载信息
[root@localhost ~]# redis-cli -h 127.0.0.1 -p 6379 info [root@localhost ~]# redis-cli -h 127.0.0.1 -p 6379 -a mypassword info

redis-cli命令控制行中获取客户端信息命令

获取客户端列表
127.0.0.1:6379> client list
设置当前连接点redis的名称
127.0.0.1:6379> client setname "liu"
查看当前连接的名称
127.0.0.1:6379> client getname
杀死指定连接
127.0.0.1:6379> client kill id 7

查看redis使用情况(Redis 服务器的各种信息和统计数值) 

127.0.0.1:6379> info
# Server
redis_version:2.5.9
redis_git_sha1:473f3090
redis_git_dirty:0
os:Linux 3.3.7-1-ARCH i686
arch_bits:32
multiplexing_api:epoll
gcc_version:4.7.0
process_id:8104
run_id:bc9e20c6f0aac67d0d396ab950940ae4d1479ad1
# TCP/IP 当前监听端口 tcp_port:
6379
# 自 Redis 服务器启动以来,运行的秒数 uptime_in_seconds:7
# 自 Redis 服务器启动以来,运行的天数 uptime_in_days:0 lru_clock:1680564
# Clients
# 已连接的客户端数量(不包括通过从属服务器连接的客户端) connected_clients:
1 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0
# Memory used_memory:
439304 used_memory_human:429.01K used_memory_rss:13897728 used_memory_peak:401776 used_memory_peak_human:392.36K used_memory_lua:20480 mem_fragmentation_ratio:31.64 mem_allocator:jemalloc-3.0.0
# Persistence loading:
0 rdb_changes_since_last_save:0 rdb_bgsave_in_progress:0 rdb_last_save_time:1338011402 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:-1 rdb_current_bgsave_time_sec:-1 aof_enabled:0 aof_rewrite_in_progress:0 aof_rewrite_scheduled:0 aof_last_rewrite_time_sec:-1 aof_current_rewrite_time_sec:-1
# Stats total_connections_received:
1 total_commands_processed:0 instantaneous_ops_per_sec:0 rejected_connections:0 expired_keys:0 evicted_keys:0 keyspace_hits:0 keyspace_misses:0 pubsub_channels:0 pubsub_patterns:0 latest_fork_usec:0
#
Replication role:master connected_slaves:0
# CPU used_cpu_sys:
0.03 used_cpu_user:0.01 used_cpu_sys_children:0.00 used_cpu_user_children:0.00

 借鉴:https://blog.csdn.net/weixin_37288522/article/details/78778755

 借鉴:https://blog.csdn.net/weixin_33962923/article/details/94689884

 

posted @ 2019-09-07 15:14  刘_love_田  阅读(2843)  评论(0编辑  收藏  举报