Redis主从配置实践
来源:互联网 发布:文件加密锁软件 编辑:程序博客网 时间:2024/05/17 02:25
1.进入安装redis目录,拷贝配置文件供slave使用
#cd /usr/local/redis/redis-2.8.17
#mkdir slave
#cp redis.conf slave/redis_slave_1.conf
#vim slave/redis_slave_1.conf
pidfile /var/run/redis_slave_1.pid
port 6401 #master: port 6379
logfile "logs/redis_slave_1.log"
dbfilename dump_slave_1.rdb #master:dbfilename dump.rdb
slaveof 127.0.0.1 6379 #新增
2.启动主从机检验是否生效
# nohup src/redis-server >>logs/redis_master.log 2>& 1 &
[1] 2759
# nohup src/redis-server ./slave/redis_slave_1.conf >>logs/redis_slave1.log 2>& 1 &
[2] 2769
# tail -f logs/redis_slave.log
[2769] 08 Oct 09:53:31.054 * Connecting to MASTER 127.0.0.1:6379
[2769] 08 Oct 09:53:31.054 * MASTER <-> SLAVE sync started
[2769] 08 Oct 09:53:31.054 * Non blocking connect for SYNC fired the event.
[2769] 08 Oct 09:53:31.055 * Master replied to PING, replication can continue...
[2769] 08 Oct 09:53:31.055 * Partial resynchronization not possible (no cached master)
[2769] 08 Oct 09:53:31.058 * Full resync from master: c04c5262019736bbb30a49a7de799ed687d861df:1
[2769] 08 Oct 09:53:31.134 * MASTER <-> SLAVE sync: receiving 40 bytes from master
[2769] 08 Oct 09:53:31.134 * MASTER <-> SLAVE sync: Flushing old data
[2769] 08 Oct 09:53:31.134 * MASTER <-> SLAVE sync: Loading DB in memory
[2769] 08 Oct 09:53:31.134 * MASTER <-> SLAVE sync: Finished with success
# src/redis-cli
127.0.0.1:6379> set name copher
OK
127.0.0.1:6379> get name
"copher"
127.0.0.1:6379> exit
# src/redis-cli -p 6401
127.0.0.1:6401> get name
"copher"
127.0.0.1:6401> set age 999
(error) READONLY You can't write against a read only slave.
127.0.0.1:6401> set message "message"
(error) READONLY You can't write against a read only slave.
127.0.0.1:6401> exit
#
测试完毕,配置生效。
- Redis主从配置实践
- Redis的主从复制与集群配置实践
- redis-3.0主从搭建实践
- Redis主从配置
- redis主从服务器配置
- redis主从配置
- redis (二)主从配置
- redis主从配置
- Redis主从复制配置
- redis主从复制配置
- redis主从配置
- redis 主从配置
- redis主从配置
- Redis主从配置
- Redis 主从配置
- Redis主从服务器配置
- redis主从配置
- 【Redis续】主从配置
- USC 1329 Decode 坑坑坑gets
- opencv2 cv::Mat 释放内存时 release()的错误
- 'org.springframework.transaction.config.internalTransactionAdvisor': Initialization of bean failed;
- Codeforces 193A. Cutting Figure
- android 自动拒接后再取消自动拒接,该联系人来电界面无图标显示,且点击挂断无反应
- Redis主从配置实践
- 操作系统——磁盘图解
- Unable to execute dex: method ID not in [0, 0xffff]: 65536 问题解决方法
- Spring3 整合log4j
- BZOJ1501 (NOI2005 智慧珠游戏)
- sles11之sudo
- android 视频通话开启呼叫等待后,来第三方的视频通话,接通后通话时间一直显示为0,过几秒之后视频通话自动挂断
- 用接口开发接PO收入库程序
- 获取手机号码和手机运营商信息——android开发