redis安装和sentinel集群模式

install:

mkdir /data/download -p
cd /data/download

///You need tcl 8.5 or newer in order to run the Redis test

wget http://sourceforge.net/projects/tcl/files/Tcl/8.5.15/tcl8.5.15-src.tar.gz/download
tar xzvf tcl8.5.15-src.tar.gz -C tcl8.5.15-src
cd tcl8.5.15-src/unix/
./configure –prefix=/data/lib/tcl8.5.15
make
make install
ln -s tcl8.5.15 tcl

export PATH=/data/lib/tcl/bin:$PATH
#export LD_LIBRARY_PATH=/data/lib/tcl/lib:$LD_LIBRARY_PATH

wget wget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar -xf redis-2.8.13.tar.gz
cd redis-2.8.13
make
#make test
#make PREFIX=/data/lib/redis install

make PREFIX=/data/lib/bin/redis-2.8.13 install

cd /data/lib/redis
mkdir conf
mkdir logs
mkdir var
cp /data/lib/redis-stable/redis.conf /data/lib/redis/conf

——————————————————-
$ pwd
——————————————————-

/home/redis/app/redis

——————————————————-
$ ll bin
——————————————————-

-rwxr-xr-x 1 redis redis 4580235 Jul 28 16:16 redis-benchmark
-rwxr-xr-x 1 redis redis 22233 Jul 28 16:16 redis-check-aof
-rwxr-xr-x 1 redis redis 45467 Jul 28 16:16 redis-check-dump
-rwxr-xr-x 1 redis redis 4675985 Jul 28 16:16 redis-cli
-rwxr-xr-x 1 redis redis 6201291 Jul 28 16:17 redis-sentinel
-rwxr-xr-x 1 redis redis 6201291 Jul 28 16:16 redis-server

——————————————————-
$ ll
——————————————————-

drwxrwxr-x 2 redis redis 4096 Jul 28 16:17 bin
drwxrwxr-x 2 redis redis 4096 Jul 28 20:13 conf
drwxrwxr-x 2 redis redis 4096 Jul 30 17:55 data
drwxrwxr-x 2 redis redis 4096 Jul 28 19:44 logs
-rwxr-xr-x 1 redis redis 108 Jul 28 16:15 shutdown.sh
-rwxr-xr-x 1 redis redis 106 Jul 28 16:40 startup.sh
-rwxr-xr-x 1 redis redis 79 Jul 28 20:12 stn-shutdown.sh
-rwxr-xr-x 1 redis redis 138 Jul 28 17:03 stn-startup.sh
drwxrwxr-x 2 redis redis 4096 Jul 28 15:00 temp
drwxrwxr-x 2 redis redis 4096 Jul 28 20:19 var

——————————————————-
$ cat stn.conf
——————————————————-
port 26379
dir “/data/redis/app/redis-2.8.13/temp”
sentinel monitor mymaster 172.16.16.156 6379 2
sentinel down-after-milliseconds mymaster 10000
sentinel auth-pass mymaster password
sentinel config-epoch mymaster 1
sentinel leader-epoch mymaster 1

# Generated by CONFIG REWRITE
sentinel known-slave mymaster 172.16.16.155 6379
sentinel known-slave mymaster 172.16.16.157 6379
sentinel known-sentinel mymaster 172.16.16.156 26379 89348644a66ba88bf7dec6d67a6e210080576051
sentinel known-sentinel mymaster 172.16.16.157 26379 e4104de666d036dbbb3c47926b1b9a3177ec1549

sentinel current-epoch 1

——————————————————-
cat startup.sh
——————————————————-

# start redis in sentinel mode
export pwd=`dirname “$0″`
$pwd/bin/redis-server $pwd/conf/redis.conf

——————————————————-
cat shutdown.sh
——————————————————-

# shutdown redis
export pwd=`dirname “$0″`
$pwd/bin/redis-cli -h 127.0.0.1 -p 6379 -a password shutdown

——————————————————-
cat stn-startup.sh
——————————————————-

# start redis in sentinel mode
export pwd=`dirname “$0″`
$pwd/bin/redis-server $pwd/conf/stn.conf –sentinel >> $pwd/logs/stn.log &

——————————————————-
cat stn-shutdown.sh
——————————————————-

kill -9 `ps -ef | grep -v grep | grep redis | grep 26379 | awk ‘{print $2}’`

——————————————————-

点赞