zoukankan      html  css  js  c++  java
  • redis环境搭建笔记

    一, 启动方式

    1,后台启动 在redis.conf文件里将daemonize属性的值设为yes

     

     

    二,主从复制配置

    1,准备条件:

    环境:linux , redis安装包,

    2 新建一个包masteSlave文件,在该文件下新建6380与6382文件

    在安装目录下把redis.conf文件daemonize属性设为yes后台启动,然后把改文件分别复制到masteSlave/6380,masteSlave/6381。在该两个文件port属性分别改为6380与6381

    3,把端口为6380的当成主,6381当成葱。在6381/redis.conf文件下添加slaveof 本地ip 端口即可。

    4,分别通过6380与6381下的redis.conf配置文件启动

    5,测试:

    在6380端口下 set  test 1111

    在6381端口下 get  test 即可看到效果。

     

     

    三,伪集群搭建

    才有redis默认的集群方式,三主三从

    1,准备条件

    环境:liniux,redis安装包,端口从8001-8005

    2,新建redis_cluster文件,在该文件下新建8001-8005的文件

    4,进入到redis安装目录 

     修改配置文件redis.conf

    daemonize yes

    cluster-enabled yes

    cluster-config-file nodes.conf  #nodes.conf -nodes5.conf

    cluster-node-timeout 5000

    appendonly yes

    对端口参数,cluster-config-file 文件修改

    5,启动6个实例

    6,创建集群

    ./redis-trib.rb  create --replicas 1 127.0.0.1:8000 127.0.0.1:8001 127.0.0.1:8002 127.0.0.1:8003 127.0.0.1:8004 127.0.0.1:8005

     

     

     

     

     

  • 相关阅读:
    学习笔记 线程异步请求过程
    学习笔记 urllib
    学习笔记 requests + BeautifulSoup
    python3 kmp 字符串匹配
    python3:实现字符串的全排列(有重复字符)
    python3:实现字符串的全排列(无重复字符)
    python 贝叶斯算法
    knn算法
    python基础5
    python基础4
  • 原文地址:https://www.cnblogs.com/chengAddress/p/6070658.html
Copyright © 2011-2022 走看看