系统: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 主从模式的更多相关文章

  1. 【Redis】Redis学习(三) Redis 主从模式详解

    不管任何程序,只运行一个实例都是不可靠的,一旦因为网络原因导致所在机器不可达,或者所在服务器挂掉,那么这个程序将不能对外提供服务了,Redis也是一样的.不过Redis的主从并不是解决这个问题的,一些 ...

  2. 【Redis】Redis 主从模式搭建

    主从模式介绍 Redis虽然读取写入的速度都特别快,但是也会产生读压力特别大的情况.为了分担读压力,Redis支持主从复制,Redis的主从结构可以采用一主多从或者级联结构,Redis主从复制可以根据 ...

  3. 使用docker搭建redis主从模式

    前期准备: 本地Linux版本:CentOS Linux release 7.5.1804 (Core)Docker版本:Docker version 1.13.1, build dded712/1. ...

  4. redis的主从模式搭建及注意事项

    前言:本文先分享下如何搭建redis的主从模式配置,以及主从模式配置的注意事项.后续会继续分享如何实现一个高可用的redis服务,redis的Sentinel 哨兵模式及集群搭建. 安装: 1,yum ...

  5. Linux下Redis安装使用,主从模式,哨兵模式与PHP扩展(PHP7适用)

    一,软件准备 #redis wget http://download.redis.io/releases/redis-3.0.7.tar.gz #phpredis 非php7使用 下载后文件名为:ph ...

  6. Redis 单例、主从模式、sentinel 以及集群的配置方式及优缺点对比(转)

    摘要: redis作为一种NoSql数据库,其提供了一种高效的缓存方案,本文则主要对其单例,主从模式,sentinel以及集群的配置方式进行说明,对比其优缺点,阐述redis作为一种缓存框架的高可用性 ...

  7. Redis主从配置以及哨兵模式

    Redis主从模式,应用写master,读slave,减轻master的压力. 配置主结点: daemonize yes port 6379bind 0.0.0.0 pidfile /opt/redi ...

  8. Redis 单机模式,主从模式,哨兵模式(sentinel),集群模式(cluster),第三方模式优缺点分析

    Redis 的几种常见使用方式包括: 单机模式 主从模式 哨兵模式(sentinel) 集群模式(cluster) 第三方模式 单机模式 Redis 单副本,采用单个 Redis 节点部署架构,没有备 ...

  9. Redis四大模式之主从配置

    Redis工作模式主要有单机模式.主从模式(slave).哨兵模式(sentinel).集群模式(cluster)这四种,本文主要讲解一下主从模式的部署方式. 我是windows单机进行的这套搭建操作 ...

随机推荐

  1. Sql保留两位小数方法

    2.176544保留两位小数 1.select Convert(decimal(18,2),2.176544)  结果:2.18 2.select Round(2.176544,2) 结果:2.180 ...

  2. 如何停止处于stopping状态的windows服务

    工作中有时需要启动和停止windows service,有时候会出现服务处于stopping或者starting的状态,但是,在services界面中,start service/stop servi ...

  3. BZOJ3626 LNOI2014LCA(树链剖分+主席树)

    开店简化版. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> ...

  4. hdu1728 逃离迷宫

    给定一个m × n (m行, n列)的迷宫,迷宫中有两个位置,gloria想从迷宫的一个位置走到另外一个位置,当然迷宫中有些地方是空地,gloria可以穿越,有些地方是障碍,她必须绕行,从迷宫的一个位 ...

  5. 【Gym 100733D】Little thief Shi(取数,DP)

    题 Shi realized that he was almost out of money, even renting Shitalian lands. Shi was walking on a s ...

  6. install nagios pnp4nagios on centos 6

    安装配置Apache.PHP(忽略此次安装步骤) 安装nagiosrpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release ...

  7. KEIL中函数定义存在但go to definition却不跳转的原因

    可能是 go to definition 函数的地方,被包含在一个未使能的条件编译宏内部,因为这样KEIL在编译时,就未将该条件编译宏内部的信息编译入工程的Browse Information.

  8. 【bzoj3438】 小M的作物

    http://www.lydsy.com/JudgeOnline/problem.php?id=3438 (题目链接) 题意 $n$种作物,每种可以种在A田也可以种在B田,两种种植方法有不同的收益.$ ...

  9. 基于SpringMVC的文件(增删改查)上传、下载、更新、删除

    一.项目背景 摘要:最近一直在忙着项目的事,3个项目过去了,发现有一个共同的业务,那就是附件的处理,附件包括各种文档,当然还有图片等特殊文件,由于时间的关系,每次都是匆匆忙忙的搞定上线,称这项目的空档 ...

  10. SURF算法

    一.原理: Sift算法的优点是特征稳定,对旋转.尺度变换.亮度保持不变性,对视角变换.噪声也有一定程度的稳定性:缺点是实时性不高,并且对于边缘光滑目标的特征点提取能力较弱. Surf(Speeded ...