当前位置:网站首页>Redis cluster in Linux system

Redis cluster in Linux system

2022-06-11 08:21:00 WldKid_ zxy

Redis stay Linux Clusters in the system

1、 install Redis

Centos In the virtual machine installation tutorial

2. Modify the configuration file redis.conf
 Insert picture description here

2.1 daemonize yes -- It is amended as follows yes Background start
2.2 protected-mode yes -- It is amended as follows protected-mode no
2.3 stay bind 127.0.0.1 Add #
2.4 requirepass 123456 -- Note set password

Get into redis Of bin start-up

 Insert picture description here
 Insert picture description here

3. colony

3.1 principle
The process :

1: When one starts from the database , Will send... To the main database sync command
2: The main database received sync After the command, the snapshot will be saved in the background ( perform rdb operation ), And cache the commands received during the save
3: When the snapshot is complete ,redis Will send the snapshot file and all cached commands to the slave database .
4: When received from the database , Will load the snapshot file and execute the received cached command .

3.2 Remote replication to another 2 Virtual machines

# Operate on the copier    root@192.168.23.59-- Backup machine 
scp -r /app/software/redis5 root@192.168.23.59:/app/software/

3.3 The host does not need to be configured , Configure slave redis.conf

3.3.1 slaveof host ip 6379
3.3.2 masterauth Host password

3.3 Sentinel mode configuration – edit redis-sentinel file
 Insert picture description here

  1. sentinel monitor mymast( name ) 192.168.110.133( host ip) 6379( port ) 1( Several agreed )
    2.sentinel auth-pass mymast( name ) 123456( password )
    3.sentinel down-after-milliseconds mymaster 30( The original value is 30000 30 millisecond )
    4.sentinel parallel-syncs mymaster 2( Slave )

3.4 see

Start the host With two slaves Of redis service

 Insert picture description here

3.5 Start the sentry from the machine

./redis-server /usr/local/redis/etc/sentinel.conf --sentinel &

3.6 Shut down the engine
 Insert picture description here

From machine to host  Insert picture description here
 Insert picture description here

原网站

版权声明
本文为[WldKid_ zxy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020512142063.html