Redis主从配置
来源:互联网 发布:flotherm软件免费下载 编辑:程序博客网 时间:2024/06/16 05:07
环境:
OS:Red Hat Linux As 5
DB:redis-2.8.19
---------------------------------------------主库安装--------------------------------------------
[root@node1 redis]#tar xzf redis-2.8.19.tar.gz
[root@node1 redis]#cd redis-2.8.19
[root@node1 redis]#make
启动redis
[root@node1 redis]#cd src
[root@node1 src]# ./redis-server
---------------------------------------------从库安装--------------------------------------------
1.安装跟主机同版本的redis
[root@node1 redis]#tar xzf redis-2.8.19.tar.gz
[root@node1 redis]#cd redis-2.8.19
[root@node1 redis]#make
2.配置redis.conf文件
在安装的目录下找到redis.conf文件,编辑该文件
找到如下项,将主机的ip地址和端口口填上
slaveof
如:
slaveof 192.168.56.101 6379
3.启动redis
[root@node1 redis]#cd src
[root@node1 src]# ./redis-server /soft/redis/redis/redis.conf
[27858] 12 Mar 15:45:46.995 # Server started, Redis version 2.8.19
[27858] 12 Mar 15:45:46.995 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
[27858] 12 Mar 15:45:46.995 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
[27858] 12 Mar 15:45:46.995 * The server is now ready to accept connections on port 6379
[27858] 12 Mar 15:45:47.994 * Connecting to MASTER 192.168.56.101:6379
[27858] 12 Mar 15:45:47.995 * MASTER <-> SLAVE sync started
[27858] 12 Mar 15:45:47.998 * Non blocking connect for SYNC fired the event.
[27858] 12 Mar 15:45:47.998 * Master replied to PING, replication can continue...
[27858] 12 Mar 15:45:48.000 * Partial resynchronization not possible (no cached master)
[27858] 12 Mar 15:45:48.003 * Full resync from master: 61bd7da80aa956fb7c396169b6650b45efa25d45:1
[27858] 12 Mar 15:45:48.041 * MASTER <-> SLAVE sync: receiving 32 bytes from master
[27858] 12 Mar 15:45:48.042 * MASTER <-> SLAVE sync: Flushing old data
[27858] 12 Mar 15:45:48.042 * MASTER <-> SLAVE sync: Loading DB in memory
[27858] 12 Mar 15:45:48.042 * MASTER <-> SLAVE sync: Finished with success
4.验证
主库上操作
[root@node1 src]# ./redis-cli
127.0.0.1:6379> set yourname test
OK
127.0.0.1:6379>
从库上操作
[root@node2 src]# ./redis-cli
127.0.0.1:6379> get yourname
"test"
127.0.0.1:6379>
--The End --
- Redis主从配置
- redis主从服务器配置
- redis主从配置
- redis (二)主从配置
- redis主从配置
- Redis主从复制配置
- redis主从复制配置
- redis主从配置
- redis 主从配置
- redis主从配置
- Redis主从配置
- Redis 主从配置
- Redis主从服务器配置
- redis主从配置
- Redis主从配置实践
- 【Redis续】主从配置
- Redis主从配置
- redis 主从配置实例
- 将Faster RCNN的python demo改成C++ demo
- git bash使用指南(markdown版本)
- Android:防止过快点击造成多次事件
- 23种设计模式
- iOS做一个iPhone相册,每个图片都能放大缩小并且翻到第⼆张图时,再翻回来就变成原来的大 ⼩.使⽤UIPageControl与UIScrollView结合.
- Redis主从配置
- ubuntu pci wifi bcm4322 无法使用 解决方法
- Compact Composite Descriptors 紧致图像描述子
- 微信自定义分享功能
- MFC下,配置OpenGL所需文件、配置方法与注意事项
- SIMPLE Descriptors (Extended) 简单图像描述子
- C#中在WebClient中使用post发送数据实现方法
- android socket通信
- 三角函数