sentinel_info-cache
Redis SENTINEL INFO-CACHE
Redis Sentinel Course | Redis Technical Support | Redis Enterprise Server |
---|
Redis SENTINEL INFO-CACHE
센티널은 평상시에 10초에 한번씩 레디스 서버(마스터, 슬레이브)에 INFO 명령을 보내서 결과를 받아
info 필드에 넣고, 각 필드 정보를 갱신한다.
이 명령은 info 필드에 있는 내용을 보는 것이다.
마스터 서버가 다운되면 센티널은 슬레이브들의 INFO 명령 수행 주기를 1초로 변경한다.
마스터의 INFO 명령 주기는 그대로 10초이지만, 응답이 오지 않기 때문에 시간초과가 되어
이후 부터는 마스터 서버에도 1초마다 INFO 명령을 보내게 된다.
결론적으로 마스터 서버가 다운되면 마스터, 슬레이브 모두에게 1초마다 INFO 명령을 보낸다.
슬레이브가 다운되어도 시간초과로 1초에 한번씩 INFO 명령을 보낸다.
사용법
명령: SENTINEL INFO-CACHE <master-name>
명령 실행 예)
마스터와 슬레이브에 대한 정보가 모두 나오는데 여기서는 마스터 서버에 대한 정보만 표시했다.
127.0.0.1:7111> sentinel info-cache Xmaster
1) "Xmaster"
2) 1) 1) (integer) 7033
2) "# Server\r\n
redis_version:3.2.2\r\nredis_git_sha1:00000000\r\n
redis_git_dirty:0\r\nredis_build_id:dd55bf0a646c3c1\r\n
redis_mode:standalone\r\nos:Linux 3.10.0-229.el7.x86_64 x86_64\r\n
arch_bits:64\r\nmultiplexing_api:epoll\r\n
gcc_version:4.8.3\r\nprocess_id:14610\r\n
run_id:213e542f63f5ef36cb3903bb07a36ee7add5cd8f\r\ntcp_port:7121\r\n
uptime_in_seconds:69151\r\nuptime_in_days:0\r\nhz:10\r\n
lru_clock:13336300\r\nexecutable:/root/redis-3.2.2/users/redis-server\r\n
config_file:/root/redis-3.2.2/7121/redis.conf\r\n\r\n
# Clients\r\n
connected_clients:10\r\nclient_longest_output_list:0\r\n
client_biggest_input_buf:0\r\nblocked_clients:0\r\n\r\n
# Memory\r\n
used_memory:106956576\r\nused_memory_human:102.00M\r\n
used_memory_rss:111337472\r\nused_memory_rss_human:106.18M\r\n
used_memory_peak:107241368\r\nused_memory_peak_human:102.27M\r\n
total_system_memory:8327958528\r\ntotal_system_memory_human:7.76G\r\n
used_memory_lua:37888\r\nused_memory_lua_human:37.00K\r\n
maxmemory:0\r\nmaxmemory_human:0B\r\nmaxmemory_policy:noeviction\r\n
mem_fragmentation_ratio:1.04\r\nmem_allocator:jemalloc-4.0.3\r\n\r\n
# Persistence\r\n
loading:0\r\nrdb_changes_since_last_save:0\r\n
rdb_bgsave_in_progress:0\r\nrdb_last_save_time:1472913450\r\n
rdb_last_bgsave_status:ok\r\nrdb_last_bgsave_time_sec:0\r\n
rdb_current_bgsave_time_sec:-1\r\naof_enabled:0\r\n
aof_rewrite_in_progress:0\r\naof_rewrite_scheduled:0\r\naof_last_rewrite_time_sec:-1\r\n
aof_current_rewrite_time_sec:-1\r\n
aof_last_bgrewrite_status:ok\r\naof_last_write_status:ok\r\n\r\n
# Stats\r\n
total_connections_received:140\r\n
total_commands_processed:800662\r\ninstantaneous_ops_per_sec:12\r\ntotal_net_input_bytes:48522015\r\n
total_net_output_bytes:327591105\r\ninstantaneous_input_kbps:0.49\r\ninstantaneous_output_kbps:5.30\r\n
rejected_connections:0\r\nsync_full:18\r\nsync_partial_ok:0\r\nsync_partial_err:0\r\nexpired_keys:0\r\n
evicted_keys:0\r\nkeyspace_hits:0\r\nkeyspace_misses:0\r\npubsub_channels:1\r\npubsub_patterns:0\r\n
latest_fork_usec:2637\r\nmigrate_cached_sockets:0\r\n\r\n
# Replication\r\n
role:master\r\nconnected_slaves:4\r\n
slave0:ip=127.0.0.1,port=7122,state=online,offset=35893475,lag=0\r\n
slave1:ip=127.0.0.1,port=7125,state=online,offset=35893475,lag=0\r\n
slave2:ip=127.0.0.1,port=7123,state=online,offset=35893342,lag=1\r\n
slave3:ip=127.0.0.1,port=7124,state=online,offset=35893475,lag=0\r\n
master_repl_offset:35893475\r\nrepl_backlog_active:1\r\nrepl_backlog_size:1048576\r\n
repl_backlog_first_byte_offset:34844900\r\n
repl_backlog_histlen:1048576\r\n\r\n
# CPU\r\n
used_cpu_sys:108.90\r\nused_cpu_user:34.35\r\nused_cpu_sys_children:0.10\r\n
used_cpu_user_children:2.46\r\n\r\n
# Cluster\r\n
cluster_enabled:0\r\n\r\n
# Keyspace\r\n
db0:keys=1019,expires=0,avg_ttl=0\r\n"
1) "Xmaster"
2) 1) 1) (integer) 7033
2) "# Server\r\n
redis_version:3.2.2\r\nredis_git_sha1:00000000\r\n
redis_git_dirty:0\r\nredis_build_id:dd55bf0a646c3c1\r\n
redis_mode:standalone\r\nos:Linux 3.10.0-229.el7.x86_64 x86_64\r\n
arch_bits:64\r\nmultiplexing_api:epoll\r\n
gcc_version:4.8.3\r\nprocess_id:14610\r\n
run_id:213e542f63f5ef36cb3903bb07a36ee7add5cd8f\r\ntcp_port:7121\r\n
uptime_in_seconds:69151\r\nuptime_in_days:0\r\nhz:10\r\n
lru_clock:13336300\r\nexecutable:/root/redis-3.2.2/users/redis-server\r\n
config_file:/root/redis-3.2.2/7121/redis.conf\r\n\r\n
# Clients\r\n
connected_clients:10\r\nclient_longest_output_list:0\r\n
client_biggest_input_buf:0\r\nblocked_clients:0\r\n\r\n
# Memory\r\n
used_memory:106956576\r\nused_memory_human:102.00M\r\n
used_memory_rss:111337472\r\nused_memory_rss_human:106.18M\r\n
used_memory_peak:107241368\r\nused_memory_peak_human:102.27M\r\n
total_system_memory:8327958528\r\ntotal_system_memory_human:7.76G\r\n
used_memory_lua:37888\r\nused_memory_lua_human:37.00K\r\n
maxmemory:0\r\nmaxmemory_human:0B\r\nmaxmemory_policy:noeviction\r\n
mem_fragmentation_ratio:1.04\r\nmem_allocator:jemalloc-4.0.3\r\n\r\n
# Persistence\r\n
loading:0\r\nrdb_changes_since_last_save:0\r\n
rdb_bgsave_in_progress:0\r\nrdb_last_save_time:1472913450\r\n
rdb_last_bgsave_status:ok\r\nrdb_last_bgsave_time_sec:0\r\n
rdb_current_bgsave_time_sec:-1\r\naof_enabled:0\r\n
aof_rewrite_in_progress:0\r\naof_rewrite_scheduled:0\r\naof_last_rewrite_time_sec:-1\r\n
aof_current_rewrite_time_sec:-1\r\n
aof_last_bgrewrite_status:ok\r\naof_last_write_status:ok\r\n\r\n
# Stats\r\n
total_connections_received:140\r\n
total_commands_processed:800662\r\ninstantaneous_ops_per_sec:12\r\ntotal_net_input_bytes:48522015\r\n
total_net_output_bytes:327591105\r\ninstantaneous_input_kbps:0.49\r\ninstantaneous_output_kbps:5.30\r\n
rejected_connections:0\r\nsync_full:18\r\nsync_partial_ok:0\r\nsync_partial_err:0\r\nexpired_keys:0\r\n
evicted_keys:0\r\nkeyspace_hits:0\r\nkeyspace_misses:0\r\npubsub_channels:1\r\npubsub_patterns:0\r\n
latest_fork_usec:2637\r\nmigrate_cached_sockets:0\r\n\r\n
# Replication\r\n
role:master\r\nconnected_slaves:4\r\n
slave0:ip=127.0.0.1,port=7122,state=online,offset=35893475,lag=0\r\n
slave1:ip=127.0.0.1,port=7125,state=online,offset=35893475,lag=0\r\n
slave2:ip=127.0.0.1,port=7123,state=online,offset=35893342,lag=1\r\n
slave3:ip=127.0.0.1,port=7124,state=online,offset=35893475,lag=0\r\n
master_repl_offset:35893475\r\nrepl_backlog_active:1\r\nrepl_backlog_size:1048576\r\n
repl_backlog_first_byte_offset:34844900\r\n
repl_backlog_histlen:1048576\r\n\r\n
# CPU\r\n
used_cpu_sys:108.90\r\nused_cpu_user:34.35\r\nused_cpu_sys_children:0.10\r\n
used_cpu_user_children:2.46\r\n\r\n
# Cluster\r\n
cluster_enabled:0\r\n\r\n
# Keyspace\r\n
db0:keys=1019,expires=0,avg_ttl=0\r\n"
갱신되는 항목
INFO 명령은 많은 항목이 오지만 이중 센티널 서버가 갱신하는 항목은 다음과 같다.
- run_id : runid
- 마스터일때
- 슬레이브 IP
- 슬레이브 Port
- 슬레이브일때
- 마스터 IP
- 마스터 Port
- master_link_status : 마스터와 연결이 정상이면 up, 아니면 down
- master_link_down_since_seconds: 마스터와 연결이 끊긴 이후 경과한 시간(초)
- slave_priority
- slave_repl_offset
- 역할(role)이 변경된 경우
- role_reported_time = now
- role_reported = 새로운 role
- 마스터 -> 슬레이브 : slave_conf_change_time = now
명령문
SENTINEL INFO-CACHE <master-name>
- 이 명령은 version 3.2.0 부터 사용할 수 있다.
- 이 문서는 버전 3.2.2을 기준으로 만들었다.
Clients for Java | Jedis, Lettuce | Clients for C | Hiredis |
<< FLUSHCONFIG | INFO-CACHE | PENDING-SCRIPTS >> |
---|
조회수 :
Email
답글이 올라오면 이메일로 알려드리겠습니다.