redis副本集

1.数据库配置细节:

a.拷贝多个redis.conf文件;b.开启daemonize yes; c.Pid文件名字; d.指定端口; e.Log文件名字; f:Dump.rdb名字

2.配置redis.conf文件

a.daemonize yes ; b.port 6379; c. pidfile /var/run/redis_6379.pid; d.logfile "6379.log" ;

e. save 900 1

    save 300 10
    save 60 10000

 f. dbfilename dump6379.rdb

3.命令:info replication, 查看是否是主数据库

4. redis-server /myredis/redis6379.conf => redis-cli -p 6379 

   redis-server /myredis/redis6380.conf=> redis-cli -p 6380=>slaveof 127.0.0.1 6379

  redis-server /myredis/redis6381.conf=> redis-cli -p 6381=>slaveof 127.0.0.1 6380

5.反客为主:127.0.0.1 6380>slaveof no one ,6380变为主数据库了

-------------------------------------------------

6.哨兵模式配置,生产常用

配置文件: sentinel.conf:   sentinel monitor host6379 127.0.0.1 6379 1

启动:

redis-server /myredis/redis6379.conf => redis-cli -p 6379 

   redis-server /myredis/redis6380.conf=> redis-cli -p 6380=>slaveof 127.0.0.1

  redis-server /myredis/redis6381.conf=> redis-cli -p 6381=>slaveof 127.0.0.1 6379

redis-sentinel /myredis/sentinel.conf

上一篇:Python——网络编程基础


下一篇:TODO:Ubuntu下安装Node