全部博文(150)
分类: 系统运维
2017-03-26 16:46:02
[root@redis01 ~]# redis-cli info # Server redis_version:2.8.19 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:c0359e7aa3798aa2 redis_mode:standalone os:Linux 3.10.0-123.el7.x86_64 x86_64 arch_bits:64 multiplexing_api:epoll gcc_version:4.8.3 process_id:24191 run_id:36ad15148d3478f13076b6feb065536c7dca4adc tcp_port:6379 uptime_in_seconds:173800 uptime_in_days:2 hz:10 lru_clock:14099001 config_file:/etc/redis.conf # Clients connected_clients:84 client_longest_output_list:0 client_biggest_input_buf:0 blocked_clients:0 # Memory used_memory:14187404192 used_memory_human:13.21G used_memory_rss:14567976960 used_memory_peak:14189556584 used_memory_peak_human:13.22G used_memory_lua:35840 mem_fragmentation_ratio:1.03 mem_allocator:jemalloc-3.6.0 # Persistence loading:0 rdb_changes_since_last_save:130135 rdb_bgsave_in_progress:1 rdb_last_save_time:1490493874 rdb_last_bgsave_status:ok rdb_last_bgsave_time_sec:100 rdb_current_bgsave_time_sec:74 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:280094 total_commands_processed:228769139 instantaneous_ops_per_sec:1111 total_net_input_bytes:14293923616 total_net_output_bytes:42883168734 instantaneous_input_kbps:72.58 instantaneous_output_kbps:77.55 rejected_connections:0 sync_full:1 sync_partial_ok:0 sync_partial_err:1 expired_keys:38545 evicted_keys:0 keyspace_hits:33635872 keyspace_misses:302049 pubsub_channels:0 pubsub_patterns:4 latest_fork_usec:195303 # Replication role:master connected_slaves:1 slave0:ip=x.0.x.x,port=6379,state=online,offset=11332087470,lag=0 master_repl_offset:11332106737 ## 已修改隐藏实际ip repl_backlog_active:1 repl_backlog_size:1048576 repl_backlog_first_byte_offset:11331058162 repl_backlog_histlen:1048576 # CPU used_cpu_sys:6134.57 used_cpu_user:2565.36 used_cpu_sys_children:8045.19 used_cpu_user_children:97035.76 # Keyspace db0:keys=337475,expires=180183,avg_ttl=1286629728
used_memory_human:13.21G
一个月前3.5G,线性增长到到13G
db0:keys=337475,expires=180183,avg_ttl=1286629728
[root@redis01 ~]# redis-cli config get maxmemory 1) "maxmemory" 2) "0"
127.0.0.1:6379> config set maxmemory 10737418240 OK (10.76s) 127.0.0.1:6379> info ...... # Memory used_memory:10730048552 used_memory_human:9.99G
maxmemory 10737418240
默认过期时间移交开发调整,avg_ttl单位为ms,换成后平均为15天,相当长的时间; 未设置默认过期时间的keys,移交开发调整;
[root@redis01 ~]# cat /etc/sysctl.conf vm.overcommit_memory = 1
sysctl -p
过程略
rdb -c memory dump.rdb > memory.csv #dump.rdb为redis生成的dump文件
sort -t, -k4nr memory.csv |heand -n 20