如何查看Redis主从信息
输入如下命令:
redis-cli -h 10.218.223.147 -p 16380 info
结果如下:
# Server redis_version:3.2.12 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:b2d74fe5fff7657d redis_mode:standalone os:Linux 2.6.32-696.el6.x86_64 x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.4.7 process_id:3945 run_id:c37f073621e201bad8d708cfdd9a40be68964e2f tcp_port:16380 uptime_in_seconds:26878 uptime_in_days:0 hz:10 lru_clock:909298 executable:/opt/redis-sentinel/redis-server config_file:/opt/redis-sentinel/redis02.conf # Clients connected_clients:27 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:53727848 used_memory_human:51.24M used_memory_rss:61210624 used_memory_rss_human:58.38M used_memory_peak:65461048 used_memory_peak_human:62.43M total_system_memory:16725540864 total_system_memory_human:15.58G used_memory_lua:37888 used_memory_lua_human:37.00K maxmemory:0 maxmemory_human:0B maxmemory_policy:noeviction mem_fragmentation_ratio:1.14 mem_allocator:jemalloc-3.6.0 # Persistence loading:0 rdb_changes_since_last_save:0 rdb_bgsave_in_progress:0 rdb_last_save_time:1594736112 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:0 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 aof_last_bgrewrite_status:ok aof_last_write_status:ok # Stats total_connections_received:5989 total_commands_processed:239517 instantaneous_ops_per_sec:6 total_net_input_bytes:117115403 total_net_output_bytes:1407208564 instantaneous_input_kbps:0.39 instantaneous_output_kbps:1.43 rejected_connections:0 sync_full:2 sync_partial_ok:0 sync_partial_err:0 expired_keys:11 evicted_keys:0 keyspace_hits:9505 keyspace_misses:235 pubsub_channels:1 pubsub_patterns:0 latest_fork_usec:11480 migrate_cached_sockets:0 # Replication role:master connected_slaves:2 slave0:ip=10.218.223.147,port=16379,state=online,offset=99380539,lag=0 slave1:ip=10.218.223.147,port=16381,state=online,offset=99380539,lag=1 master_repl_offset:99380841 repl_backlog_active:1 repl_backlog_size:1048576 repl_backlog_first_byte_offset:98332266 repl_backlog_histlen:1048576 # CPU used_cpu_sys:42.66 used_cpu_user:24.21 used_cpu_sys_children:0.16 used_cpu_user_children:0.56 # Cluster cluster_enabled:0 # Keyspace db5:keys=26,expires=0,avg_ttl=0
标记红色部分说明ip为10.218.223.147,port为16380的实例为主,16379和16381的实例都是从。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构