Redis installation and master-slave synchronization

1. Using redis 2.8.24

 

2. Download redis-2.8.24.tar.gz , and then create two new directories, master and save, which are the master and the slave respectively.

mkdir master

mkdir save

3. Copy the installation package to master, save, and then use tar -xvf   redis-2.8.24.tar.gz to decompress

4. Enter the   redis-2.8.24 directory to execute

make command

make test command

make install command

 

Then copy the generated files to the bin directory

Execute in the redis-2.8.24  directory

The mkdir bin command creates folders.

Enter the src directory and execute the  mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server ../bin command to copy the generated files to bin.

 

 
5. Modify redis.conf in the main service ( in the master directory)

#Background start

daemonize yes

# allow ip

bind 127.0.0.1

#Log output address

logfile "/opt/logs/loginf.log"

 

6. Modify the redis.conf in the slave service (in the save directory)

#Background start

daemonize yes

#The port number

port 6399

# allow ip

bind 127.0.0.1

#Log output address

logfile "/opt/logs/loginf.log"

#Connect to the ip port of the main service

slaveof 127.0.0.1 6379

 

7. Start the service in the bin directory./redis-server redis.conf, start the main service first, and then start the slave service

 

8. Use the client to view

./redis-cli -h 127.0.0.1 -p 6379

After the login is executed, enter the data and view:

set test3  test123

 

get test3

As shown in the figure:

 Use the info name to view the configuration information:



 

 

 

 

From the server:

 

./redis-cli -h 127.0.0.1 -p 6379

View information entered from the master server

get test3

As shown in the figure:

 

Use the info name to view configuration information:



 

 

Indicates that the service has been configured successfully

 

Note: The protective wall needs to be closed

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326784401&siteId=291194637