Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis-Common Command

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The format is messy, mainly to record some usual operations and learning process.

1, check the quantity

127.0.0.1 purl 6379 > dbsize

(integer) 6

2. Rewrite the aof file manually

127.0.0.1 purl 6379 > bgrewriteaof

Background append only file rewriting started

3. Save the aof log. This command will block other operations. It is recommended to use bgsave.

127.0.0.1 purl 6379 > save

OK

4, check the time of the last save

127.0.0.1 purl 6379 > lastsave

(integer) 1561370112

5. Save in the background

127.0.0.1 purl 6379 > bgsave

Background saving started

127.0.0.1 purl 6379 > lastsave

(integer) 1561370140

6Jing flushdb cleans the current connection db

Flushall cleans up all db

7 the Memory info command displays detailed information, such as information about

Space of used_memory:1928448 data structure

Used_memory_rss:8679424 real space

The proportion of the top two of mem_fragmentation_ratio:4.50, 1.n is the best. If this value is particularly large, it means that redis memory is seriously fragmented and can be exported and imported again.

Role:master

Connected_slaves:2

Slave0:ip=127.0.0.1,port=6380,state=online,offset=567100,lag=0

Slave1:ip=127.0.0.1,port=6381,state=online,offset=567100,lag=0

Stats-fork information

The last time latest_fork_usec:2506 exported a rdb snapshot, it took microseconds to persist. Note that if an instance has 10G content, it takes 2 minutes to export and write 10000 times per minute, resulting in continuous rdb exports and the disk is always in a high IO state.

8, slow log slowlog

1, how long is slow?

Specified by slowlog-log-slower-than 10000, in microseconds

Setting method:

127.0.0.1 purl 6379 > config get slowlog-log-slower-than

1) "slowlog-log-slower-than"

2) "10000"

127.0.0.1 config set slowlog-log-slower-than 6379 >

OK

127.0.0.1 purl 6379 > config get slowlog-log-slower-than

1) "slowlog-log-slower-than"

2) "100"

2, how many slow logs are stored by the server

Slowlog-max-len 128to limit it.

3. View slow logs

127.0.0.1 purl 6379 > slowlog get

1) 1) (integer) 2

2) (integer) 1561442704

3) (integer) 131

4) 1) "keys"

2) "*"

2) 1) (integer) 1

2) (integer) 1561442666

3) (integer) 105

4) 1) "config"

2) "get"

3) "slowlog-log-slower-than"

3) 1) (integer) 0

2) (integer) 1561370112

3) (integer) 20647

4) 1) "save"

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report