服務端啟動與客戶端連接 查看redis負載狀態 redis-cli命令控制行中獲取客戶端信息命令 借鑒:https://blog.csdn.net/weixin_37288522/article/details/78778755 借鑒:https://blog.csdn.net/weixin_339 ...
服務端啟動與客戶端連接
# 服務端啟動
# 客戶端連接: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