
运维Redis服务信息
运维Redis服务信息
redis 队列消费问题
数据表的准备
1 | create table `xx_tbl` like model_tbl; |
系统 redis 配置
1 | #rdb backup |
redis 连接池基本配置说明
- redis.pool.maxTotal=1000 : 最大活动对象数
- redis.pool.maxIdle=100 最大能够保持idel状态的对象数
- redis.pool.minIdle=50 最小能够保持idel状态的对象数
进入 redis 的容器的指令操作
docker ps
docker exec -it [containerid] /bin/bash
docker exec -it [containerid] redis-cli -a root
1
2
3
4
5
6
7
docker exec -it 77ae redis-cli
进入指令窗口,进行 root 操作:
>> auth [your password]
进入指令操作:
docker exec -it 77ae redis-cli -a root监控redis的磁盘使用情况与 clients 的连接数: redis-cli –stat -i 10
1
2
3
4
5
6
7>> docker exec -it 77ae redis-cli -a root --stat -i 10 [不安全的写法,因为密码写在明文上]
打出指令进行监控的操作,定时的刷出日志内容: 【单位是: 10s】
------- data ------ --------------------- load -------------------- - child -
keys mem clients blocked requests connections
11 5.55M 3 0 312130 (+917) 690查看 redis 某个节点的网络延迟: redis-cli –latentcy -h 127.0.0.1
1
2
3
4
5>> docker exec -it 77ae redis-cli -a root --latency -h 127.0.0.1
min: 0, max: 7, avg: 0.25 (15009 samples)
avg:0.25,即延迟为250μs。如果通过外网连接网络延迟会很高,比如跨机房的redis调用,延迟高的情况下使用redis反而比使用本地硬盘读写性能更差
命令指令
1 |
|
监控的指令操作
- 查看 redis 当前的连接数 : info clients
1 | # Clients |
每秒处理的命令数: info stats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28>> info stats
# Stats
total_connections_received:1
total_commands_processed:2
instantaneous_ops_per_sec:0
total_net_input_bytes:129
total_net_output_bytes:135
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:313904035720
expired_stale_perc:0.00
expired_time_cap_reached_count:0
evicted_keys:0
keyspace_hits:1
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0慢日志的查询 : slowlog get 可通过config set slowlog-log-slower-than xxx修改慢查询时间,单位微秒,默认情况下,这个值为10000
1
2
3
4
5
6
7
8
9
10127.0.0.1:6379> slowlog get
1) 1) (integer) 0
2) (integer) 1578658649
3) (integer) 15696
4) 1) "LRANGE"
2) "trigger_log_list_0"
3) "0"
4) "999"
5) "172.17.0.1:51742"
6) ""
感谢您的阅读,本文由 左之右 版权所有。如若转载,请注明出处:左之右(https://zuoyoulai.github.io/2020/01/13/Redis%E6%9C%8D%E5%8A%A1%E4%BF%A1%E6%81%AF/)