step:
1. Download or upload an install package redis downloaded archive, here is redis-5.0.7
wget http://download.redis.io/releases/redis-5.0.7.tar.gz
2. Extract compilation
tar -zxvf redis-5.0.7.tar.gz
3. Compile install
Switch to the directory redis
cd-repeat 5.0.7
4. Installation make
sudo apt-get install ubuntu-make
sudo apt-get install make
5. Installation gcc
sudo apt-get install gcc
6. compile and install
make
make install prefix=/home/redis
7. Create a directory
cd /home/redis
mkdir conf
mkdir log
mkdir data
mkdir temp
8. redis.conf copy files and sentinel.conf
cp /usr/local/redis-5.0.7/redis.conf /home/redis/conf/redis6379.conf
cp /usr/local/redis-5.0.7/redis.conf /home/redis/conf/redis6380.conf
cp /usr/local/redis-5.0.7/redis.conf /home/redis/conf/redis6381.conf
cp /usr/local/redis-5.0.7/sentinel.conf /home/redis/conf/sentinel26379.conf
cp /usr/local/redis-5.0.7/sentinel.conf /home/redis/conf/sentinel26380.conf
cp /usr/local/redis-5.0.7/sentinel.conf /home/redis/conf/sentinel26381.conf
9. Configuration redis
Main 6379
protected-mode yes
port 6379
daemonize yes
pidfile /var/run/redis_6379.pid
logfile /var/log/redis/redis_6379.log
dir /usr/local/redis-cluster/6379/data
slave-read-only yes
# Set the access password
requirepass 123456
# set a password need to add services from
masterauth 123456
From slave 6380
Yes MODE-protected
Port 6380
to daemonize Yes
PidFile /var/run/redis_6380.pid
logfile /var/log/redis/redis_6380.log
the dir / usr / local / Redis-Cluster / 6380 / Data
slaveof 127.0.0.1 6379
# If the main service need to add a password is set, when setting up sentry from the connection between the main need
masterauth 123456
# settings from your service password
requirepass 123456
From slave 6381
Yes MODE-protected
Port 6381
to daemonize Yes
PidFile /var/run/redis_6381.pid
logfile /var/log/redis/redis_6381.log
the dir / usr / local / Redis-Cluster / 6381 / Data
slaveof 127.0.0.1 6379
# If the main service need to add a password is set, when setting up sentry from the connection between the main need
masterauth 123456
# settings from your service password
requirepass 123456
master can only read, can write, but can only read from the server, not writable.
10. The configuration Sentinel
Main 26379
protected-mode no
port 26379
dir "/usr/local/redis/temp/6379"
sentinel monitor redis1 127.0.0.1 6379 2
# If the main service settings need to add a password must note the order in sentinel monitor below
sentinel auth-pass mymaster 123456
sentinel down-after-milliseconds redis1 10000
sentinel failover-timeout redis1 60000
From 26380
protected-mode no
port 26380
dir "/usr/local/redis/temp/6380"
sentinel monitor redis1 127.0.0.1 6380 2
sentinel down-after-milliseconds redis1 10000
sentinel failover-timeout redis1 60000
From 26381
protected-mode no
port 26381
dir "/usr/local/redis/temp/6381"
sentinel monitor redis1 127.0.0.1 6381 2
sentinel down-after-milliseconds redis1 10000
sentinel failover-timeout redis1 60000
11. Start and sentinel redis
./redis-server /home/redis/conf/redis6379.conf
./redis-server /home/redis/conf/redis6380.conf
./redis-server /home/redis/conf/redis6381.conf
./redis-sentinel /home/redis/conf/sentinel26379.conf
./redis-sentinel /home/redis/conf/sentinel26380.conf
./redis-sentinel /home/redis/conf/sentinel26381.conf
12. Review status
redis-cli -h 127.0.0.1 -p 26379 -a 123456 info Sentinel
13. Review Process
ps aux | grep repeat
14 can be tested by a client redis