安装脚本 #!/bin/bash wget https://download.redis.io/releases/redis-5.0.5.tar.gz tar -xf redis-5.0.5.tar.gz -C /usr/local/ cd /usr/local/redis-5.0.5/ make MALLOC=lib cd /usr/local/redis-5.0.5/src/ && make all make install sed -i '/bind/s#127.0.0.1#0.0.0.0#g' /usr/local/redis-5.0.5/redis.conf sed -i '/daemonize/s#no#yes#g' /usr/local/redis-5.0.5/redis.conf sed -i '/protected-mode/s#yes#no#g' /usr/local/redis-5.0.5/redis.conf \cp /usr/local/redis-5.0.5/utils/redis_init_script /etc/init.d/redis sed -i '/CONF/s#/etc/redis/\${REDISPORT}.conf#/usr/local/redis-5.0.5/redis.conf#g' /etc/init.d/redis #chkconfig --add redis #service redis start 多实例安装脚本,先把基础安装好 #!/bin/bash for i in 0 1 2 3 do #创建多实例端口 mkdir -p /application/redis/638$i #复制启动程序 \cp /usr/local/redis-5.0.5/src/redis-server /application/redis/638$i #复制配置文件,注意此处基于单实力配置完成 \cp /usr/local/redis-5.0.5/redis.conf /application/redis/638$i #修改程序存储目录 sed -i "/dir/s#.*#dir /application/redis/638$i/#g" /application/redis/638$i/redis.conf #修改其他端口信息 sed -i "s#6379#638$i#g" /application/redis/638$i/redis.conf #允许远程链接redis sed -i '/protected-mode/s#yes#no#g' /application/redis/638$i/redis.conf done #启动脚本 #!/bin/bash for i in 0 1 2 3 do /application/redis/638$i/redis-server /application/redis/638$i/redis.conf done