Redis cluster on Windows
2017-08-09 10:02
239 查看
1. Create new folder 'cluster' under redis-64.3.0.503. Create subfolder 7001 -7006 under the folder 'cluster'. Copy redis.windows.conf.
redis
|---7001/redis.conf
|---7002/redis.conf
|---7003/redis.conf
|---7004/redis.conf
|---7005/redis.conf
|---7006/redis.conf
There are 3 master nodes and 3 slave nodes.
2. Update configuration in redis.conf
port 7001
cluster-enabled yes
cluster-config-file nodes.conf
3. Download Ruby from http://rubyinstaller.org/downloads/.
Install redis dependency under ruby: gem install redis
4. Startup redis:
cluster\7001>..\..\redis-server.exe redis.conf
cluster\7002>..\..\redis-server.exe redis.conf
cluster\7003>..\..\redis-server.exe redis.conf
cluster\7004>..\..\redis-server.exe redis.conf
cluster\7005>..\..\redis-server.exe redis.conf
cluster\7006>..\..\redis-server.exe redis.conf
5. Setup cluster:
D:\Tools\ruby-2.3.3-x64-mingw32>bin\ruby.exe ..\redis-3.2.8\src\redis-trib.rb create --replicas 1 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 127.0.0.1:7006
Done.
Java client example:
public static void main(String[] args) throws Exception {
Set<HostAndPort> nodes = new HashSet<HostAndPort>();
nodes.add(new HostAndPort("127.0.0.1", 7001));
nodes.add(new HostAndPort("127.0.0.1", 7002));
nodes.add(new HostAndPort("127.0.0.1", 7003));
nodes.add(new HostAndPort("127.0.0.1", 7004));
nodes.add(new HostAndPort("127.0.0.1", 7005));
nodes.add(new HostAndPort("127.0.0.1", 7006));
JedisCluster cluster = new JedisCluster(nodes );
cluster.set("a", "1");
System.out.println(cluster.get("a"));
cluster.close();
}
redis
|---7001/redis.conf
|---7002/redis.conf
|---7003/redis.conf
|---7004/redis.conf
|---7005/redis.conf
|---7006/redis.conf
There are 3 master nodes and 3 slave nodes.
2. Update configuration in redis.conf
port 7001
cluster-enabled yes
cluster-config-file nodes.conf
3. Download Ruby from http://rubyinstaller.org/downloads/.
Install redis dependency under ruby: gem install redis
4. Startup redis:
cluster\7001>..\..\redis-server.exe redis.conf
cluster\7002>..\..\redis-server.exe redis.conf
cluster\7003>..\..\redis-server.exe redis.conf
cluster\7004>..\..\redis-server.exe redis.conf
cluster\7005>..\..\redis-server.exe redis.conf
cluster\7006>..\..\redis-server.exe redis.conf
5. Setup cluster:
D:\Tools\ruby-2.3.3-x64-mingw32>bin\ruby.exe ..\redis-3.2.8\src\redis-trib.rb create --replicas 1 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 127.0.0.1:7006
Done.
Java client example:
public static void main(String[] args) throws Exception {
Set<HostAndPort> nodes = new HashSet<HostAndPort>();
nodes.add(new HostAndPort("127.0.0.1", 7001));
nodes.add(new HostAndPort("127.0.0.1", 7002));
nodes.add(new HostAndPort("127.0.0.1", 7003));
nodes.add(new HostAndPort("127.0.0.1", 7004));
nodes.add(new HostAndPort("127.0.0.1", 7005));
nodes.add(new HostAndPort("127.0.0.1", 7006));
JedisCluster cluster = new JedisCluster(nodes );
cluster.set("a", "1");
System.out.println(cluster.get("a"));
cluster.close();
}
相关文章推荐
- [PowerShell Utils] Remotely install Hyper-V and Failover Cluster feature on a list of windows 2012 servers
- redis on windows
- 解决 Redis on Windows Setup Wizard ended prematurely
- How To Configure a Redis Cluster on CentOS 7
- SQL Server AlwaysON从入门到进阶(4)——分析和部署Windows Server Failover Cluster
- 在windows上搭建redis集群(redis-cluster)
- 在windows上搭建redis集群(redis-cluster)
- SQL Server AlwaysON从入门到进阶(4)——分析和部署Windows Server Failover Cluster
- 解决 Redis on Windows Setup Wizard ended prematurely
- windows-x64下redis-cluster集群环境的搭建(一)
- Redis on Windows
- Redis on Windows
- redis on windows
- redis run on windows
- 基于SQL Alwayson的Windows Server 2012 WSFC搭建指南(2)——Windows 2012 Cluster搭建
- Windows系统下访问Linux的redis单机版及redis-cluster方法
- hadoop集群搭建-Windows (hadoop cluster on Windows)
- 基于SQL Alwayson的Windows Server 2012 WSFC搭建指南(2)——Windows 2012 Cluster搭建
- MSSQL 2008 database storage migration on windows 2008 cluster