Redis learning Diary

Source: Internet
Author: User

Redis command reference:

Http://redis.readthedocs.org/en/latest/index.html

Redis Master/Slave Configuration:

Modify the following parameters:

Pidfile: PID address

Logfile: log file address

Port: Port Number

BIND: bind a host address, either local or remote

Slaveof: Master host address and port

 

Master:/Usr/local/redis/etc/redis. conf

Pidfile/var/run/redis. PID

Logfile/usr/local/redis/var/redis. Log

Port 6379

Bind 127.0.0.1

Slave:/Usr/local/redis/etc/redis_slave.conf

Pidfile/var/run/redis_slave.pid

Logfile/usr/local/redis/var/redis_slave.log

Port 6380

Bind 127.0.0.1

Slaveof 127.0.0.1 6380

 

Start:

/Usr/local/redis/bin/redis-server/usr/local/redis/etc/redis. conf

/Usr/local/redis/bin/redis-server/usr/local/redis/etc/redis_slave.conf

 

Redis data recovery:

When the redis server fails, data will be restored to the memory according to the following priority during restart:

1. If only aof is configured, load the aof file to restore data upon restart;

2. If both RBD and aof are configured, only the aof file is loaded to restore data.

3. If only RBD is configured, load the dump file to restore data.

 

Redis data backup:

Aof method:

Appendonly Yes

# The Name Of The append only file (default: "appendonly. aof ")
Appendfilename appendonly. aof

Dump mode;

### The following is a snapshot persistence policy. In order to ensure data security, the more frequent the changes in the following settings, the more frequent the snapshotting. That is to say, the more pressure, the more resources are spent on persistence. So I chose the master-slave mode and turned off the snapshotting on the master.

# Save 900 1 # in 900 seconds, redis takes a snapshot to the disk if at least one modification occurs.

# Save 300 100 # in 300 seconds, redis takes a snapshot to the disk if at least 100 modifications occur to redis

# Save 60 10000 # in 60 seconds, redis takes a snapshot to the disk if at least 10000 modifications occur to redis

Rdbcompression yes # Use Compression

Dbfilename dump. RDB # name of the snapshotting File

DIR/opt/data/redis/# path of the snapshotting File

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.