https://redis.io/download/
cd /web
tar xf redis-7.0.3.tar.gz
cd redis-7.0.3
make
make install PREFIX=/web/redis-7.0.3
mkdir logs conf
mv redis.conf conf/
vim redis.conf
bind 0.0.0.0
protected-mode no
port 6379
daemonize yes
pidfile /web/redis-7.0.3/conf/redis_6379.pid
logfile "/web/redis-7.0.3/logs/redis_6379.log"
appendonly yes
cluster-enabled yes
cluster-config-file nodes-6379.conf
cluster-node-timeout 15000
masterauth redis123!@#
requirepass redis123!@#
/web/redis-7.0.3/bin/redis-server /web/redis-7.0.3/conf/redis.conf
/web/redis-7.0.3/bin/redis-cli --cluster create 192.168.0.3:6379 192.168.0.4:6379 192.168.0.5:6379 -a redis123!@#
cp utils/redis_init_script /etc/init.d/redis
chmod +x /etc/init.d/redis
vim /etc/init.d/redis!/bin/bash
REDISPORT=6379
EXEC=/web/redis-7.0.3/bin/redis-server
CLIEXEC=/web/redis-7.0.3/bin/redis-cli
PIDFILE=/web/redis-7.0.3/conf/redis_${REDISPORT}.pid
CONF="/web/redis-7.0.3/conf/redis.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT -a 'qixiao@redis456#$%' shutdown >/dev/null 2>&1
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
chkconfig redis on
chkconfig redis --list
/web/redis-7.0.3/bin/redis-cli -h 192.168.0.3 -p 6379 -a redis123!@# -c
至此,redis集群安装完成,谢谢观看!