Linux redis Sentinel configuration details
- 2021-01-18 06:55:35
- OfStack
download
Download address: https: / / redis io/download
Download in the directory /usr/local/src.
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
The installation
Unzip to /usr/local/src directory and put the source package.
tar xzf redis-3.2.8.tar.gz
Create directory /usr/local/redis:
make dir /usr/local/redis
Enter the source directory:
cd /usr/local/src/redis-3.2.8
Then execute the following make command to compile and install it in the directory /usr/local/redis/ (place the execution file).
make PREFIX=/usr/local/redis install
Soft connection
Program to do soft connection to bin directory, convenient direct execution.
ln -s /usr/local/redis/bin/redis-cli /usr/local/bin/redis-cli
ln -s /usr/local/redis/bin/redis-sentinel /usr/local/bin/redis-sentinel
ln -s /usr/local/redis/bin/redis-server /usr/local/bin/redis-server
The configuration file
Replication configuration file, in the source code package have sentinel conf and redis conf file, copied to/etc/redis/directory, if there are multiple instances, suggest the name, such as the example with redis port is 7021, sentinel is 17021:
mkdir /etc/redis
cp /usr/local/src/redis-3.2.8/redis.conf /etc/redis/redis_6379.conf
cp /usr/local/src/redis-3.2.8/sentinel.conf /etc/redis/sentinel_26379.conf
redis_master_6379. conf configuration
Modify the following configuration parameters:
port 6379
daemonize yes
#requirepass 123456
#masterauth 123456
Where, the daemonize attribute is changed to yes (running in the background).
redis_slave_6380. conf configuration:
Modify the following configuration parameters:
port 6380
daemonize yes
#requirepass yingjun
slaveof 192.168.248.128 6379
masterauth 123456
Other slave configurations are the same as this configuration.
sentinel_26379. conf configuration
tar xzf redis-3.2.8.tar.gz
0
sentinel_26380. conf configuration
tar xzf redis-3.2.8.tar.gz
1
Start the
Start the services one by one.
tar xzf redis-3.2.8.tar.gz
2
Check to see if the processes are all started
[root@iZj6cqZ redis]# ps -ef | grep redis
root 10910 1 0 08:11 ? 00:00:00 redis-server 127.0.0.1:6379
root 10918 1 0 08:11 ? 00:00:00 redis-server 127.0.0.1:6380
root 10939 1 0 08:15 ? 00:00:00 redis-sentinel *:26379 [sentinel]
root 10944 1 0 08:15 ? 00:00:00 redis-sentinel *:26380 [sentinel]
root 10948 10851 0 08:15 pts/1 00:00:00 grep --color=auto redis