Redis cluster on Windows
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
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:
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();
- }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10742815/viewspace-2135476/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【Redis】redis-cluster到redis-cluster的快速複製Redis
- 【Azure Redis 快取】Windows版建立 Redis Cluster 實驗 (精簡版)Redis快取Windows
- Redis Cluster原理Redis
- redis cluster 搭建Redis
- Redis Cluster 3.0Redis
- redis cluster 配置Redis
- Redis服務之Redis ClusterRedis
- redis.cluster/memcached.cluster/wmware esxiRedis
- Redis cluster 叢集Redis
- redis cluster 擴容Redis
- redis-cluster心得Redis
- Redis Cluster(叢集)Redis
- 認識Redis叢集——Redis ClusterRedis
- 【Redis】redis遷移資料到redis-clusterRedis
- 搭建redis cluster叢集Redis
- Redis Cluster 叢集部署Redis
- Redis Manager 建立 Redis Cluster —— Docker 安裝RedisDocker
- Redis Manager 建立 Redis Cluster —— 機器安裝Redis
- 【Redis】Redis Cluster-叢集故障轉移Redis
- 【Redis】 redis-cluster刪除指定的keyRedis
- Redis-cluster命令 cluster info 引數資訊解釋Redis
- redis cluster 設定密碼Redis密碼
- Redis Cluster 叢集解決方案Redis
- 深度圖解Redis Cluster原理圖解Redis
- redis-官方cluster分割槽Redis
- redis-cluster主從搭建Redis
- 優雅搭建redis-clusterRedis
- Redis Cluster日常操作命令梳理Redis
- Redis cluster 的使用經驗Redis
- Redis Cluster叢集模式部署Redis模式
- 刪除windows cluster群集Windows
- 【Redis】redis-cluster 安裝遇到的問題Redis
- redis cluster 4.0.9 叢集安裝搭建Redis
- Docker Redis 5.0 叢集(cluster)搭建DockerRedis
- Redis Cluster深入與實踐(續)Redis
- 分散式Redis深度歷險-Cluster分散式Redis
- redis cluster如何支援pipelineRedis
- 玩轉Redis叢集之ClusterRedis