Monitoring indicators

  • Performance indicators: Performance
  • Memory specifications: Memory
  • Basic Activity indicator: Basic Activity
  • Persistence indicator: Persistence
  • Error indicator: Error

Monitor the way

  • redis-benchmark
  • redis-stat
  • redis-faina
  • redislive
  • redis-cli
  • monitor
  • Len: Obtains the number of slow query log entries. 3. Reset: resets the configurations of slow query logs.
slowlog-log-slower-than 1000 # set the offline time of slow query in microseconds
slowlog-max-len 100 Set the length of the log display corresponding to the slow query command, in unit: number of commands
Copy the code

Info (you can obtain all the information at once or by block) 1. Server: indicates the running environment of the server. 2. Replication: primary/secondary Replication information 7.CPU: CPU usage 8. Cluster: cluster information 9.Keypass: quantity statistics terminal info command used

. / redis - cli info according to block access to information | grep need to filter parameters. / redis - cli info stats | grep opsCopy the code

Use the interactive info command

./redis-cli 
 > info server
Copy the code

Performance monitoring

redis-cli info | grep ops Operands per second
Copy the code

Memory monitoring

[root@CombCloud-2020110836 src]# ./redis-cli info | grep used | grep human      Used_memory_human: 2.99 MThe amount of memory allocated by the memory allocator from the operating systemUsed_memory_rss_human: 8.04 M# Memory usage seen by the operating system, memory seen by the top commandUsed_memory_peak_human: 7.77 M# redis peak memory consumptionUsed_memory_lua_human: 37.00 KThe size of memory used by the lua script engine
Copy the code

Backup blocked client due to BLPOP,BRPOP,or BRPOPLPUSH

[root@CombCloud-2020110836 src]# ./redis-cli info | grep blocked_clients
blocked_clients:0  
Copy the code

The number of keys removed due to the maximum memory limit

[root@CombCloud-2020110836 src]# ./redis-cli info | grep evicted_keys
evicted_keys:0  #
Copy the code

Memory fragmentation rate

[root@CombCloud-2020110836 src]# ./redis-cli info | grep mem_fragmentation_ratioMem_fragmentation_ratio: 2.74Copy the code

Used memory

[root@CombCloud-2020110836 src]# ./redis-cli info | grep used_memory:
used_memory:3133624  
Copy the code

Basic activity indicators

By observing how many clients Redis connects to, you can determine if there are any unexpected connections. If the quantity is not right, you can use the lcient List directive to list all the client link addresses to determine the source.

[root@CombCloud-2020110836 src]# ./redis-cli info | grep connected_clients
connected_clients:1
Copy the code
[root@CombCloud-2020110836 src]# ./redis-cli info | grep connected
connected_clients:1   # Number of client connections
connected_slaves:1   # slave Number of connections
Copy the code

Persistence indicator

[root@CombCloud-2020110836 src]# ./redis-cli info | grep rdb_last_save_time
rdb_last_save_time:1591876204  The disk timestamp is persisted for the last time

[root@CombCloud-2020110836 src]# ./redis-cli info | grep rdb_changes_since_last_save
rdb_changes_since_last_save:0   The number of changes to the database since the last persistence
Copy the code

Error indicators

The number of times a client connection is rejected because the maximum number of connections is exceeded. If this number is large, it indicates that the server’s maximum number of connections is set too low and maxClients needs to be adjusted

[root@CombCloud-2020110836 src]# ./redis-cli info | grep connected_clients
connected_clients:1
Copy the code

Hei KE Gong ji failed to find the key value

[root@CombCloud-2020110836 src]# ./redis-cli info | grep keyspace
keyspace_misses:0   
Copy the code

Duration of master/slave disconnection in seconds

[root@CombCloud-2020110836 src]# ./redis-cli info | grep rdb_changes_since_last_save
rdb_changes_since_last_save:0  
Copy the code

Replication backlogs, if set too small, will cause instructions in them to be overwritten without offsets, triggering full synchronization

[root@CombCloud-2020110836 src]# ./redis-cli info | grep backlog_size
repl_backlog_size:1048576
Copy the code

Determine whether the backlog buffer needs to be expanded by looking at the number of times the sync_partial_err variable, which represents the number of primary/secondary semi-synchronous replication failures

[root@CombCloud-2020110836 src]# ./redis-cli info | grep sync_partial_err
sync_partial_err:1
Copy the code

Redis performance test command

./redis-benchmark -c 100 -n 5000
Copy the code

Description: 100 connections, 5000 requests for performance.