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 (3) Advanced applications

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

(1) .Redis data backup and recovery. The Redis SAVE command is used to create a backup of the current database. The basic syntax is SAVE

192.168.180.23 6379 > saveOK

This command creates the dump.rdb file in the redis installation directory.

[root@localhost redis-3.2.9] # ls00-RELEASENOTES dump.rdb redis.conf src

Recover the data. If you need to recover the data, simply move the backup file (dump.rdb) to the redis installation directory and start the service. You can use the CONFIG command to get the redis directory, as follows:

192.168.180.23 config get dir1) "dir" 2) "/ root"

Config get dir gets the directory / root of redis data, and if you want to restore, just move the backup file / root/dump.rdb to the redis installation directory and start the service. You can also use the command BGSAVE to create a redis backup file, which is executed in the background.

127.0.0.1 purl 6379 > bgsaveBackground saving started

(2) redis is safe. To secure Redis, you need to set a password in the configuration file.

127.0.1 6379 > config get requirepass1) "requirepass" 2) "

By default, the password for redis access is not set, and if you want to do so, you can use the following command:

192.168.180.23 OK192.168.180.23:6379 6379 > config set requirepass "redis123" OK192.168.180.23:6379 > config get requirepass1) "requirepass" 2) "redis123"

After setting the password, if any client runs the command without authentication, it will return a (error) NOAUTH Authentication required. The error message of. Therefore, the client needs to use the AUTH command to verify.

(3) redis performance test. Redis performance testing is achieved by executing multiple commands simultaneously. Syntax: redis-benchmark [option] [option value]

[root@localhost src] #. / redis-benchmark-n 10000 = PING_INLINE = 10000 requests completed in 0.11 seconds 50 parallel clients 3 bytes payload keep alive: 1100.00%

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

Servers

Wechat

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

12
Report