centos7搭建redis集群
更新:HHH   时间:2023-1-7


  1. 下载:
    https://redis.io/
  2. 解压:
    tar -xzf redis-5.0.3.tar.gz
  3. 进入目录:
    cd redis-5.0.3
  4. 编译安装:
    make
  5. 创建配置文件夹:
    mkdir  -p  /usr/local/redis/redis_1
    mkdir  -p  /usr/local/redis/redis_2
    mkdir  -p  /usr/local/redis/redis_3
    mkdir  -p  /usr/local/redis/redis_4
    mkdir  -p  /usr/local/redis/redis_5
    mkdir  -p  /usr/local/redis/redis_6
  6. 创建配置文件:
    vim /usr/local/redis/redis_1/redis.conf
    port  7001
    bind  172.20.10.12
    requirepass  123456
    daemonize  yes
    pidfile  /var/run/redis_1.pid
    cluster-enabled  yes
    cluster-config-file  nodes_1.conf
    cluster-node-timeout  10100
    appendonly  no
  7. 启动:
    src/redis-server /usr/local/redis/redis_1/redis.conf
    src/redis-server /usr/local/redis/redis_2/redis.conf
    src/redis-server /usr/local/redis/redis_3/redis.conf
    src/redis-server /usr/local/redis/redis_4/redis.conf
    src/redis-server /usr/local/redis/redis_5/redis.conf
    src/redis-server /usr/local/redis/redis_6/redis.conf
  8. 初始化:
    src/redis-cli  --cluster  create  172.20.10.12:7001  172.20.10.12:7002  172.20.10.12:7003  172.20.10.12:7004  172.20.10.12:7005  172.20.10.12:7006  -a  123456  --cluster-replicas  1
  9. 检测状态:
    src/redis-cli  --cluster  check  172.20.10.12:7001  -a  123456
  10. 连接:
    src/redis-cli  -c  -h  172.20.10.12  -p  7001  -a  123456
  11. 停止:
    pkill  redis

    广告

    给大家推荐几个好用的工具

  12. 时间校验工具
  13. ip查询工具
  14. 二维码生成工具
  15. json格式化工具
  16. 时间缀-时间转换工具
返回web开发教程...