常见中间件安装语句

内容包括:

安装Redis

  • installRedis.sh
cd   /tools
scp  root@10.xx.xx.223:/tools/redis-5.0.5.tar.gz    /tools
yum  install  -y  gcc
  
tar -zxvf redis-5.0.5.tar.gz  -C  /usr/local/
cd /usr/local/redis-5.0.5/
make install  prefix=/usr/local/bin
mkdir /etc/redis

cp /usr/local/redis-5.0.5/redis.conf   /etc/redis/
chmod 777 /etc/redis/redis.conf
sed -i 's/daemonize no/daemonize yes/g'                     /etc/redis/redis.conf
sed -i 's/bind 127.0.0.1/bind 0.0.0.0/g'                    /etc/redis/redis.conf
sed -i 's/# requirepass foobared/requirepass  ljfirst/g'    /etc/redis/redis.conf

cp /usr/local/redis-5.0.5/utils/redis_init_script           /etc/init.d/redis
chmod +x /etc/init.d/redis
sed -i 's/REDISPORT=6379/REDISPORT=redis/g'    /etc/init.d/redis

chkconfig --add   redis
systemctl enable  redis
systemctl status  redis.service
systemctl start   redis.service

  • Redis.conf
protected-mode yes
bind 0.0.0.0
port 6379
daemonize yes

pidfile "/var/run/redis_6379.pid"
logfile "/etc/redis/redis.log"

dir "/etc/redis"
dbfilename "dump.rdb"
replica-read-only yes

masterauth "ljfirst"
requirepass "ljfirst"
replicaof 10.xxx.xxx.214 6379 # 从节点才配置这个

  • Sentinel.conf
port 26379
daemonize yes
protected-mode no
 
pidfile "/var/run/redis-sentinel.pid"
logfile "/etc/redis/sentinel.log"
dir "/tmp"
 
sentinel myid 9632dc4e6abd37cfbc1cf347bcf38f3aa81a2450
sentinel deny-scripts-reconfig yes
sentinel monitor mymaster01 10.xxx.xxx.214 6379 2
sentinel down-after-milliseconds mymaster01 5000

sentinel failover-timeout mymaster01 10000
sentinel client-reconfig-script mymaster01 /etc/redis/transip.sh # 启用VIP的语句
sentinel auth-pass mymaster01   Sxx3d3xxx4

  • VIP绑定脚本
#!/bin/bash
MASTER_IP=$6
LOCAL_IP='10.xxx.xxx.212'
VIP
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值