• redis使用笔记


    redis 配置文件 一般在/etc/redis/redis.conf

    设置Redis认证密码后,客户端登录时需要使用-a参数输入认证密码,不添加该参数虽然也可以登录成功,但是没有任何操作权限。如下:

    $ ./redis-cli -h 127.0.0.1 -p 6379 -a mypasswd

    redis 主从复制

    复制redis.conf  文件

    cp redis.conf redis_6380.conf

    生成 redis_6380.conf文件

    修改 redis_6380.conf配置文件参数 

    logfile,pidfile, port ,dbfilename,

    启用6380的redis进程

    ./redis-server /etc/redis/redis_6380.conf

    root@homestead:/usr/bin# ps -ef | grep redis

    redis      852     1  0 02:34 ?        00:00:08 /usr/bin/redis-server 0.0.0.0:6379

    root      3717     1  0 04:31 ?        00:00:00 ./redis-server 0.0.0.0:6380

    root      3722  3127  0 04:31 pts/1    00:00:00 grep --color=auto redis

    进入redis_6380 ,设置主服务器为6379

    127.0.0.1:6380> slaveof 127.0.0.1 6379  

    127.0.0.1:6380> info

    这时看到 master_link_status:down 主从复制失败

    这时需要重启redis,通过kill 进程id 重启就可以了

    redis高可用之哨兵

    创建哨兵配置 如 /etc/redis/sentinel_26379.conf

    port 26379
    daemonize yes
    logfile "26379.log"
    dir "./"
    sentinel monitor mymaster 127.0.0.1 6379 2
    sentinel down-after-milliseconds mymaster 30000
    sentinel parallel-syncs mymaster 1
    sentinel failover-timeout mymaster 15000
    bind 127.0.0.1

    启用哨兵进程26379 监控master

    $ ./redis-server /etc/redis/sentinel_26379.conf --sentinel

    3 以上同样方式,创建配置文件  sentinel_26380.conf,sentinel_26381.conf

     参考自 https://blog.csdn.net/niugang0920/article/details/97141175

    https://www.cnblogs.com/guolianyu/p/10249687.html

  • 相关阅读:
    fastjson 简单使用 及其JSONObject使用
    HttpClient 的使用
    python操作excel xlwt (转)
    matplotlib 设置标题 xy标题等
    matplotlib 饼状图
    Mac下面 matplotlib 中文无法显示解决
    matplotlib 折线图
    matplotlib条形图
    matplotlib直方图
    python matplotlib配置
  • 原文地址:https://www.cnblogs.com/lianruihong/p/13207193.html
Copyright © 2020-2023  润新知