Windows 部署 Redis 群集(转)
1,下载Redis for windows 的最新版本,解压到 c:\Redis 目录下备用
https://github.com/MSOpenTech/redis/releases
当前我使用的是 3.0.501
2,下载 RubyInstaller
http://rubyinstaller.org/downloads/
安装时,勾选
Install Td/Tk Support
Add Ruby executables to your PATH
Associate .rb and .rbw files with this Ruby installation
3,下载 redis-trib.rb , 放到 c:\redis 目录下备用
https://raw.githubusercontent.com/antirez/redis/unstable/src/redis-trib.rb
4,新建6个子文件夹
cmd
cd c:\redis
mkdir 7000 7001 7002 7003 7004 7005
5,将如下配置修改,分别放入上一步新建的6个子文件夹中, 保存为 redis.conf:
port 7000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yes
注意,将 port 和 cluster-config-file 改掉(每个文件都不一样)
6, 为方便启动这些 Redis 实例,新建如下 bat 文件:
@echo off
cd c:\Redis
start Redis-Server ./7000/redis.conf
start Redis-Server ./7001/redis.conf
start Redis-Server ./7002/redis.conf
start Redis-Server ./7003/redis.conf
start Redis-Server ./7004/redis.conf
start Redis-Server ./7005/redis.conf
7, 运行上步新建的 bat 文件,会打开6个窗口,每个窗口承载一个 Redis 实例,端口从 7000 至 7005
在 c:\Redis 文件夹下会出现 nodes-7000.conf 至 nodes-7005.conf 这几个文件
8,安装 GEM,Redis 的 ruby 支持环境
9,创建群集
打开 cmd , 执行以下命令:
cd c:\redis
redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
--replicas 1 即自动分配 Slave , 如果想手动指定 Slave , 将该值变为 0 即可, 地址列表中,只需要 3个实例即可。
由于使用的是 6个实例,自动分配 Slave ,所以前3个为 master , 后3 个为 slave, 并确定3个主节点的 slots 范围。
如果确认没有问题, 输入 yes
如果群集创建成功, 会输出 OK XXXXX
如果出现:
err slot xxx is already busy, 请删除 appendonly.aof 及 nodes-xxx.conf (cluster-config-file 所指的文件) 文件
10, 测试一下:
redis-cli.exe -c -p 7000
--------------------------------------
以上是同一台机器上的群集部署方案,同一台虚拟机,使用不同的实例, 创建群集时,一路顺利。
但是将实例部署到不同的机器上,我分别在6台虚拟机上安装了 Redis, 但一开始创建群集的时候,就卡在这里:
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join....................
一直在这个 Waiting for the cluster to join 这里。。。
用 redis-trib.rb check 192.168.18.111:6379 检查,提示
[ERR] Not all 16384 slots are covered by nodes
具体的就是某台 master 上的 sloats 是 0
用客户端连接到那个没有分配 sloat 的 redis 实例,发送以下命令:
cluster meet 192.168.18.111 6379
回头在用 Redis-trib.rb check 检查, 发现
[OK] All 16384 slots covered.
但是群集的创建还是卡在那个 waiting 上 ,
继续在其它节点上发送 cluster meet 命令,回头在用 redis-trib.rb check , 神奇的 Not all 16384 slots are covered by nodes 居然又来了。
将那个slots 为 0的实例做为 slave (放到参数列表的最后),在创建,顺利通过!这个问题真是神奇啊!
出处:http://www.cnblogs.com/xling/p/5253063.html
Windows 部署 Redis 群集(转)的更多相关文章
- Windows 部署 Redis 群集
1,下载Redis for windows 的最新版本,解压到 c:\Redis 目录下备用https://github.com/MSOpenTech/redis/releases当前我使用的是 3. ...
- 部署 Redis 群集
Windows 部署 Redis 群集 1,下载Redis for windows 的最新版本,解压到 c:\Redis 目录下备用https://github.com/MSOpenTech/re ...
- windows环境redis主从安装部署
准备工作 下载windows环境redis,我下载的是2.4.5,解压,拷贝一主(master)两从(slaveof).主机端口使用6379,两从的端口分别为6380和6381, 我本地索性用6379 ...
- 在windows下部署Redis 当作系统服务器自动启动
部署Redis 其实Redis是可以安装成windows服务的,开机自启动,命令如下: redis-server --service-install redis.windows.conf 安装完之后, ...
- windows下Redis 主从读写分离部署
原文:windows下Redis 主从读写分离部署 1.可直接下载window下的运行文件(下面这个链接) 也可以浏览github 查看相应的版本说明文档 https://github.com/Ser ...
- Windows下Redis集群安装与部署
1.下载 Redis-x64-3.2.100.zip 安装程序 官网下载地址:http://redis.io/download GitHub下载地址:https://github.com/micros ...
- 如何在Windows上部署Redis集群和SpringBoot进行整合
一.安装Redis的Windows版本并进行配置 (1)下载链接 https://github.com/microsoftarchive/redis/releases (2)将下载后的Redis复制成 ...
- window下使用Redis Cluster部署Redis集群
日常的项目很多时候都需要用到缓存.redis算是一个比较好的选择.一般情况下做一个主从就可以满足一些比较小的项目需要.在一些并发量比较大的项目可能就需要用到集群了,redis在Windows下做集群可 ...
- Windows下Redis中RedisQFork位置调整
redis-server.exe redis.windows.conf 使用上面命令启动redis服务的时候报了以下错误信息: The Windows version of Redis allocat ...
随机推荐
- Find the Maximum sum
Given an array of n elements.Find the maximum sum when the array elements will be arranged in such w ...
- 从0到上线开发企业级电商项目_前端_01_sublime使用技巧
一.用户设置 { "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", &quo ...
- 【转】完美解读Linux中文件系统的目录结构
一.前 言 接触Linux也有一段时间了,不过这几天在编译开源程序时,才发现自己对linux文件系统的目录结构了解的不够透彻,很多重要目录都说不清楚是用来干嘛的,于是在网上百度了一下这方面的介绍,根据 ...
- leetcode — reorder-list
/** * Source : https://oj.leetcode.com/problems/reorder-list/ * * Given a singly linked list L: L0→L ...
- Vue 爬坑之路(三)—— 使用 vue-router 跳转页面
使用 Vue.js 做项目的时候,一个页面是由多个组件构成的,所以在跳转页面的时候,并不适合用传统的 href,于是 vue-router 应运而生. 官方文档: https://router.vue ...
- RAID常用级别的比较
[转]RAID常用级别的比较 特点 硬盘及容量 性能及安全 典型应用 raid 0 用于平行存储,即条带.其原理是把连续的数据分成几份,然后分散存储到阵列中的各个硬盘上.任何一个磁盘故障,都将导致数据 ...
- MySQL优化三 表结构优化
由于MySQL数据库是基于行(Row)存储的数据库,而数据库操作 IO 的时候是以 page(block)的方式,也就是说,如果我们每条记录所占用的空间量减小,就会使每个page中可存放的数据行数增大 ...
- numpy库常用基本操作
NumPy数组的维数称为秩(rank),一维数组的秩为1,二维数组的秩为2,以此类推.在NumPy中,每一个线性的数组称为是一个轴(axes),秩其实是描述轴的数量.比如说,二维数组相当于是一个一维数 ...
- jQuery Ajax 操作函数 (七)
函数 描述 jQuery.ajax() 执行异步 HTTP (Ajax) 请求. .ajaxComplete() 当 Ajax 请求完成时注册要调用的处理程序.这是一个 Ajax 事件. .ajaxE ...
- button的padding属性在i8下和chrome下表现不一致
button的padding属性在i8下和chrome下表现不一致 在ie8下会撑破很多像素,撑破布局 padding: 10px 48px; padding: 1px 35px \0; /* pro ...