搭建master

修改redis配置redis.windows.conf:

修改监听端口:  port 26379

修改绑定IP: bind 127.0.0.1

添加redis日志:logfile "..\\logsdata\\redis.master.26379.log.txt"

添加Redis数据库:databases 16

数据库磁盘影像: dbfilename dump.master.26379.rdb

数据存储的位置:dir ..\\redisdata

磁盘数据持久化:appendfilename "appendonly.master.26379.aof"

搭建salve

修改redis配置redis.windows.conf:

修改监听端口:  port 26380

修改  绑定IP: bind 127.0.0.1

添加redis日志:logfile "..\\logsdata\\redis.slave.26380.log.txt"

添加Redis数据库:databases 16

数据库磁盘影像: dbfilename dump.slave.26380.rdb

数据存储的位置:..\\redisdata

主从配置:slaveof 127.0.0.1  26379

磁盘数据持久化:appendfilename "appendonly.slave.26380.aof"

启动Redis

master: ..\Redis-x64-3.2.100-master\redis-server.exe redis.windows.conf

D:\DevTools\redis\Redis-x64-3.2.100-master>redis-server.exe  redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 26379
| `-._ `._ / _.-' | PID: 11900
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[11900] 13 Jun 10:46:54.572 # Server started, Redis version 3.2.100
[11900] 13 Jun 10:46:54.580 * DB saved on disk
[11900] 13 Jun 10:46:54.580 * DB loaded from append only file: 0.008 seconds
[11900] 13 Jun 10:46:54.581 * The server is now ready to accept connections on
ort 26379

slave : ..\Redis-x64-3.2.100-slave\redis-server.exe redis.windows.conf

D:\DevTools\redis\Redis-x64-3.2.100-slave>redis-server.exe  redis.windows.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.100 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 26380
| `-._ `._ / _.-' | PID: 7888
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[7888] 13 Jun 10:47:17.697 # Server started, Redis version 3.2.100
[7888] 13 Jun 10:47:17.708 * DB saved on disk
[7888] 13 Jun 10:47:17.708 * DB loaded from append only file: 0.011 seconds
[7888] 13 Jun 10:47:17.708 * The server is now ready to accept connections on po
rt 26380
[7888] 13 Jun 10:47:17.709 * Connecting to MASTER 127.0.0.1:26379
[7888] 13 Jun 10:47:17.711 * MASTER <-> SLAVE sync started
[7888] 13 Jun 10:47:17.712 * Non blocking connect for SYNC fired the event.
[7888] 13 Jun 10:47:17.713 * Master replied to PING, replication can continue...
[7888] 13 Jun 10:47:17.715 * Partial resynchronization not possible (no cached m
aster)
[7888] 13 Jun 10:47:17.723 * Full resync from master: a6de45b387bcb77291afacb31c
46fe7e1e14366b:1
[7888] 13 Jun 10:47:17.860 * MASTER <-> SLAVE sync: receiving 311 bytes from mas
ter
[7888] 13 Jun 10:47:17.866 * MASTER <-> SLAVE sync: Flushing old data
[7888] 13 Jun 10:47:17.867 * MASTER <-> SLAVE sync: Loading DB in memory
[7888] 13 Jun 10:47:17.869 * MASTER <-> SLAVE sync: Finished with success
[7888] 13 Jun 10:47:17.876 * Background append only file rewriting started by pi
d 11588
[7888] 13 Jun 10:47:18.017 * AOF rewrite child asks to stop sending diffs.
[7888] 13 Jun 10:47:18.119 # fork operation complete
[7888] 13 Jun 10:47:18.121 * Background AOF rewrite terminated with success
[7888] 13 Jun 10:47:18.126 * Residual parent diff successfully flushed to the re
written AOF (0.00 MB)
[7888] 13 Jun 10:47:18.134 * Background AOF rewrite finished successfully
[7888] 13 Jun 10:48:44.466 * DB saved on disk
[7888] 13 Jun 10:53:45.097 * 10 changes in 300 seconds. Saving...
[7888] 13 Jun 10:53:45.101 * Background saving started by pid 11244
[7888] 13 Jun 10:53:45.202 # fork operation complete
[7888] 13 Jun 10:53:45.202 * Background saving terminated with success

常用命令

进入主redis:  Redis-x64-3.2.100-master\redis-cli -h 127.0.0.1 -p 26379

查看所有   keys *

查看某类   keys *session*

清空所有   flushall

在master上新增set name 'wangxinagyu',在slave上可以查看到get name(主从复制)

D:\DevTools\redis\Redis-x64-3.2.100-master>redis-cli -h 127.0.0.1 -p 26379
127.0.0.1:26379> keys *
1) "yuanqin_hash"
2) "yuanqin"
3) "yuanqin_set"
4) "yuanqin_list"
5) "yuanqin_zset"
127.0.0.1:26379> set name 'wangxinagyu'
OK
D:\DevTools\redis\Redis-x64-3.2.100-slave>redis-cli -h 127.0.0.1 -p 26380
127.0.0.1:26380> get name
"wangxiangyu"

集群模式哨兵操作(Redis的setntinel操作命令):

sentinel masters

sentinel slaves etreasury

sentinel get-master-addr-by-name eteasury

ping

备注

附件解压之后,上述涉及IP(127.0.0.1)的地方直接改成本机IP即可以使用。

附件下载:

https://github.com/xywhero/Devtools.git

windows系统上搭建redis集群哨兵及主从复制的更多相关文章

  1. 在Windows系统下搭建Redis集群

    准备工作 需要4个部件:Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb.使用redis-trib.rb工具来 ...

  2. windows环境下搭建Redis集群

    转载请注明出处,原文章地址: https://www.cnblogs.com/tommy-huang/p/6240083.html Redis集群: 如果部署到多台电脑,就跟普通的集群一样:因为Red ...

  3. 在windows上搭建redis集群

    一 所需软件 Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis redis下载地址   ...

  4. 在windows上搭建redis集群(redis-cluster)

    一 所需软件:Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis redis下载地址   ...

  5. 在windows上搭建redis集群(redis-cluster)(转载)

    一 所需软件:Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二 安装配置redis  redis下载地址 ...

  6. Windows环境下搭建Redis集群(Redis-x64-3.2.100)

    一 .前期准备Redis.Ruby语言运行环境.Redis的Ruby驱动redis-xxxx.gem.创建Redis集群的工具redis-trib.rb 二.安装配置redisredis下载地址 ht ...

  7. Redis实战(五)CentOS 7上搭建Redis集群

    高可用Redis(十二):Redis Cluster https://www.cnblogs.com/renpingsheng/p/9862485.html https://www.cnblogs.c ...

  8. Windows下搭建Redis集群

    Redis集群: 如果部署到多台电脑,就跟普通的集群一样:因为Redis是单线程处理的,多核CPU也只能使用一个核, 所以部署在同一台电脑上,通过运行多个Redis实例组成集群,然后能提高CPU的利用 ...

  9. Redis集群搭建(转自一菲聪天的“Windows下搭建Redis集群”)

    配置Redis参考:http://blog.csdn.net/zsg88/article/details/73715947 使用Ruby配置集群参考:https://www.cnblogs.com/t ...

随机推荐

  1. 1093. Count PAT's

    The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and ...

  2. A1095. Cars on Campus

    Zhejiang University has 6 campuses and a lot of gates. From each gate we can collect the in/out time ...

  3. 网络流 KM dinic

    study from: https://blog.csdn.net/A_Comme_Amour/article/details/79356220 1. Edmonds-Karp 无优化 最坏时间复杂度 ...

  4. 2018.10.19浪在ACM 集训队第一次测试赛

    2018.10.19浪在ACM 集训队第一次测试赛 待参考资料: [1]:https://blog.csdn.net/XLno_name/article/details/78559973?utm_so ...

  5. HTML中使用<input>添加的按钮打开一个链接

    在HTML中,<form>表单的<input type="button">可以添加一个按钮.如果想让该按钮实现<a> 的超链接功能,需要如下实现 ...

  6. k8s部署prometheus

    https://www.kancloud.cn/huyipow/prometheus/527092 https://songjiayang.gitbooks.io/prometheus/content ...

  7. Tensorflow-gpu版本安装

    目录 服务器选型 NVIDIA GPU驱动安装 cuda和cudnn的安装 cuda安装 cudnn的安装 tensorflow-gpu安装 最近给公司部署一套深度学习相关的环境,以tensorflo ...

  8. Liunx软Raid实现

    Liunx软Raid实现 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 在配置软Raid之前,我们首先要了解一下什么是Raid,Raid又分哪几个系列?哪个又是最靠谱的组合?我们生 ...

  9. POJ - 1584 A Round Peg in a Ground Hole(判断凸多边形,点到线段距离,点在多边形内)

    http://poj.org/problem?id=1584 题意 按照顺时针或逆时针方向输入一个n边形的顶点坐标集,先判断这个n边形是否为凸包. 再给定一个圆形(圆心坐标和半径),判断这个圆是否完全 ...

  10. vue常用UI组件

    Mint UI 项目主页:http://mint-ui.github.io/#!/zh-cn demo:http://elemefe.github.io/mint-ui/#/ github地址:htt ...