-
https://redis.io/download下载redis
-
rz -y (若rz命令无效yum install lrzsz -y) 选中文件上传至服务器(均在usr/local下执行)
-
利用tar -zxvf 解压压缩包
-
进入redis文件夹
-
make&&make install编译并安装
-
进入reids/util目录, 执行./install_server.sh
[root@localhost utils]# ./install_server.sh Welcome to the redis service installer This script will help you easily set up a running redis server Please select the redis port for this instance: [6379] Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] Selected default - /etc/redis/6379.conf Please select the redis log file name [/var/log/redis_6379.log] Selected default - /var/log/redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379 # 这个写你新建的那个目录的redis-server Please select the redis executable path [] /usr/local/redis/redis-server Selected config: Port : 6379 Config file : /etc/redis/6379.conf Log file : /var/log/redis_6379.log Data dir : /var/lib/redis/6379 Executable : /usr/local/redis/redis-server Cli Executable : /usr/local/redis/redis-cli Is this ok? Then press ENTER to go on or Ctrl-C to abort. Copied /tmp/6379.conf => /etc/init.d/redis_6379 Installing service... Successfully added to chkconfig! Successfully added to runlevels 345! Starting Redis server... Installation successful!
-
编辑redis.conf文件修改配置
# 使得Redis服务器可以跨网络访问 bind 0.0.0.0 # 设置密码 requirepass "123456" # 指定主服务器,注意:有关slaveof的配置只是配置从服务器,主服务器不需要配置 slaveof 192.168.11.128 6379 # 主服务器密码,注意:有关slaveof的配置只是配置从服务器,主服务器不需要配置 masterauth 123456 #关闭保护模式,可远程连接 protected-mode no #开启后台守护线程 daemonize yes
-
编辑sentinel.conf文件配置哨兵模式
# 禁止保护模式 protected-mode no #开启后台守护线程 daemonize yes #跨网访问 bind 0.0.0.0 # 配置监听的主服务器,这里sentinel monitor代表监控,mymaster代表服务器的名称,可以自定义,192.168.11.128代表监控的主服务器,6379代表端口,2代表只有两个或两个以上的哨兵认为主服务器不可用的时候,才会进行failover操作。 sentinel monitor mymaster 192.168.11.128 6379 2 # sentinel author-pass定义服务的密码,mymaster是服务名称,123456是Redis服务器密码 # sentinel auth-pass <master-name> <password> sentinel auth-pass mymaster 123456
-
启动服务载入配置
# 启动Redis服务器进程 ./redis-server ../redis.conf # 启动哨兵进程 ./redis-sentinel ../sentinel.conf
Linux安装与部署redis 哨兵模式配置
猜你喜欢
转载自blog.csdn.net/rye1009/article/details/104156371
今日推荐
周排行