一键部署redis-5.0.5

#!/bin/bash
echo "-------------------------------------"

echo -e "\e[1;33m    下面开始部署redis服务请稍等 \e[0m"

echo "-------------------------------------"
#关闭防火墙
systemctl stop firewalld
#setenforce 0

#下载包
wget http://download.redis.io/releases/redis-5.0.5.tar.gz

#解压并删除安装包
tar zxf redis-5.0.5.tar.gz
rm -rf redis-5.0.5.tar.gz

#编译安装
cd redis-5.0.5 && make && make install

#重新指定位置方便使用
mkdir -p /usr/local/redis/bin
cd /root/redis-5.0.5/src && cp redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server redis-trib.rb /usr/local/redis/bin/
mv redis-5.0.5 /usr/local/redis/

redis_road=/usr/local/bin/redis-server
redis_conf=/usr/local/redis/redis-5.0.5/redis.conf

echo -e "\e[1;33m 是否启动?  \e[0m"
echo -e "\e[1;33m 1\是  \e[0m"
echo -e "\e[1;33m 2\退出  \e[0m"

read -p " " choice
case $choice in
1)
ss -ntl | grep 6379 >/dev/null
if  [ $? -eq 0 ];then
     echo -e "\e[1;31m redis has been started !!! \e"
 else
     echo "redis dis中"
     $redis_road $redis_conf
fi
;;
2)
        echo "已退出"
;;
esac

 

posted @ 2020-05-15 10:17  SanPIng  阅读(206)  评论(0编辑  收藏  举报