Redis 主从模式
系统:Centos6.6x64
安装目录:/usr/local/
主:192.168.100.103
从:192.168.100.104
,下载安装:
安装依赖:
# yum install gcc tcl ruby -y
# wget http://download.redis.io/releases/redis-3.2.4.tar.gz
# tar xf redis-3.2..tar.gz
# mv redis-3.2. /opt/redis
# cd /opt/redis
# make
# make test ,内核修改配置
echo "vm.overcommit_memory=1" >> /etc/sysctl.conf
/sbin/sysctl -p ,iptables端口开发 selinux关闭设置:
# cat /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport -j ACCEPT ,创建 数据 日志目录
mkdir -p redis/{log,data}
5,redis 主从配置
主服务:192.168.100.103
# cat redis.conf bind 192.168.100.103
protected-mode yes
port
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /opt/redis/log/redis.log
databases
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /opt/redis/data
requirepass passwd
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes
从服务:192.168.100.104
# cat redis.conf bind 192.168.100.104
protected-mode yes
port
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /var/run/redis_6379.pid
loglevel notice
logfile /opt/redis/log/redis.log
databases
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /opt/redis/data
slaveof 192.168.100.103
masterauth passwd
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
slave-priority
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit slave 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
aof-rewrite-incremental-fsync yes
6,启动测试:
# /opt/redis# nohup src/redis-server redis.conf &
# ps-ef|grep redis # /usr/local/redis/bin/redis-cli ping
7,测试:
主服务103上执行创建:
# /usr/local/redis/bin/redis-cli -h 192.168.100.103 -a passwd set test 从服务104上执行查看:
# /usr/local/redis/bin/redis-cli -h 192.168.100.104 get test
性能测试
# /usr/local/redis/bin/redis-benchmark 关闭服务
# /usr/local/redis/bin/redis-cli -p 6379 shutdown 强制刷新数据到磁盘【Redis默认是异步写入磁盘的】
# /usr/local/redis/bin/redis-cli -p 6379 save
Redis 主从模式的更多相关文章
- 【Redis】Redis学习(三) Redis 主从模式详解
不管任何程序,只运行一个实例都是不可靠的,一旦因为网络原因导致所在机器不可达,或者所在服务器挂掉,那么这个程序将不能对外提供服务了,Redis也是一样的.不过Redis的主从并不是解决这个问题的,一些 ...
- 【Redis】Redis 主从模式搭建
主从模式介绍 Redis虽然读取写入的速度都特别快,但是也会产生读压力特别大的情况.为了分担读压力,Redis支持主从复制,Redis的主从结构可以采用一主多从或者级联结构,Redis主从复制可以根据 ...
- 使用docker搭建redis主从模式
前期准备: 本地Linux版本:CentOS Linux release 7.5.1804 (Core)Docker版本:Docker version 1.13.1, build dded712/1. ...
- redis的主从模式搭建及注意事项
前言:本文先分享下如何搭建redis的主从模式配置,以及主从模式配置的注意事项.后续会继续分享如何实现一个高可用的redis服务,redis的Sentinel 哨兵模式及集群搭建. 安装: 1,yum ...
- Linux下Redis安装使用,主从模式,哨兵模式与PHP扩展(PHP7适用)
一,软件准备 #redis wget http://download.redis.io/releases/redis-3.0.7.tar.gz #phpredis 非php7使用 下载后文件名为:ph ...
- Redis 单例、主从模式、sentinel 以及集群的配置方式及优缺点对比(转)
摘要: redis作为一种NoSql数据库,其提供了一种高效的缓存方案,本文则主要对其单例,主从模式,sentinel以及集群的配置方式进行说明,对比其优缺点,阐述redis作为一种缓存框架的高可用性 ...
- Redis主从配置以及哨兵模式
Redis主从模式,应用写master,读slave,减轻master的压力. 配置主结点: daemonize yes port 6379bind 0.0.0.0 pidfile /opt/redi ...
- Redis 单机模式,主从模式,哨兵模式(sentinel),集群模式(cluster),第三方模式优缺点分析
Redis 的几种常见使用方式包括: 单机模式 主从模式 哨兵模式(sentinel) 集群模式(cluster) 第三方模式 单机模式 Redis 单副本,采用单个 Redis 节点部署架构,没有备 ...
- Redis四大模式之主从配置
Redis工作模式主要有单机模式.主从模式(slave).哨兵模式(sentinel).集群模式(cluster)这四种,本文主要讲解一下主从模式的部署方式. 我是windows单机进行的这套搭建操作 ...
随机推荐
- mysql学习笔记三 —— 数据恢复与备份
要点: 1.存储引擎2.导入导出3.备份与恢复 查看当前数据库中的所有表use db1:show tables: 1.存储引擎 不同的发动机(引擎)适用的汽车类型不一样. 存储和处理的不同方式.不同的 ...
- [Java] Thread的start()和run()函数区别
1.start()方法来启动线程,真正实现了多线程运行,这时无需等待run方法体代码执行完毕而直接继续执行下面的代码: 通过调用Thread类的start()方法来启动一个线程,这时此线程是处于就绪状 ...
- python之小应用:读取csv文件并处理01数据串
目的:读取csv文件内容,把0和1的数据串取出来,统计出现1的连续次数和各次数出现的频率次数 先读取csv文件内容: import csv def csv_read(file): list = [] ...
- Lucene 分析的意思是按照某种规则进行内容拆分 支持模糊搜索
Lucene 分析的意思是按照某种规则进行内容拆分 里面的域的值是拆分后的内容
- hdu 3911 Black And White (线段树 区间合并)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3911 题意: 给你一段01序列,有两个操作: 1.区间异或,2.询问区间最长的连续的1得长度 思路: ...
- day10 递归
死循环,因此递归必须要定义一个明确的结束条件 def calc(n): print(n) calc(n) calc(10) return 表示终止符号,最终会得出一个确切的返回值,且可以赋值 def ...
- 21 Zabbix系统性能优化建议
点击返回:自学Zabbix之路 点击返回:自学Zabbix4.0之路 点击返回:自学zabbix集锦 21 Zabbix系统性能优化建议 1. Zabbix性能变慢的可能表现: zabbix队列有太多 ...
- Android 安装 卸载 更新 程序
安装程序的方法: .通过Intent机制,调出系统安装应用,重新安装应用的话,会保留原应用的数据. 1. String fileName =Environment.getExternalStorage ...
- 【Luogu5108】仰望半月的夜空(后缀数组)
[Luogu5108]仰望半月的夜空(后缀数组) 题面 洛谷 题解 实名举报这题在比赛之前还不是这个样子的,还被我用SAM给水过去了 很明显求出\(SA\)之后就是按照\(SA\)的顺序从前往后考虑每 ...
- WinRM不起作用 Connecting to remote server failed with the following error message : WinRM cannot complete the operation
当我运行下面的 powershell 脚本时: $FarmAcct = 'domain\user' $secPassword = ConvertTo-SecureString 'aaa' -AsP ...