redis 叢集構建
redis叢集:
[root@yt2-db-test-vm16-124-10 data_6379]# redis-cli --cluster create --cluster-replicas 1 10.16.124.10:6379 10.16.124.11:6378 10.16.124.11:6379 10.16.124.12:6378 10.16.124.12:6379 10.16.124.10:6378
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 10.16.124.11:6379 to 10.16.124.10:6379
Adding replica 10.16.124.12:6379 to 10.16.124.11:6378
Adding replica 10.16.124.10:6378 to 10.16.124.12:6378
M: a373bfeafe4484fed9d88e06d4c34f9a8bcc7047 10.16.124.10:6379
slots:[0-5460] (5461 slots) master
M: 62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb 10.16.124.11:6378
slots:[5461-10922] (5462 slots) master
S: 3a6960c7f781bdd342fcb90fb9fd65499e7bee57 10.16.124.11:6379
replicates a373bfeafe4484fed9d88e06d4c34f9a8bcc7047
M: 366c2088f00aaff161a1abf5a831160ef26b8646 10.16.124.12:6378
slots:[10923-16383] (5461 slots) master
S: 94f7df592c031a56dd0370dc04f0f9c564cbd423 10.16.124.12:6379
replicates 62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb
S: 31e19cc8bb5c0c8dfb8e78c735daa634e33644ad 10.16.124.10:6378
replicates 366c2088f00aaff161a1abf5a831160ef26b8646
Can I set the above configuration? (type 'yes' to accept): yes
>>> 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
.
>>> Performing Cluster Check (using node 10.16.124.10:6379)
M: a373bfeafe4484fed9d88e06d4c34f9a8bcc7047 10.16.124.10:6379
slots:[0-5460] (5461 slots) master
1 additional replica(s)
M: 366c2088f00aaff161a1abf5a831160ef26b8646 10.16.124.12:6378
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
S: 31e19cc8bb5c0c8dfb8e78c735daa634e33644ad 10.16.124.10:6378
slots: (0 slots) slave
replicates 366c2088f00aaff161a1abf5a831160ef26b8646
S: 3a6960c7f781bdd342fcb90fb9fd65499e7bee57 10.16.124.11:6379
slots: (0 slots) slave
replicates a373bfeafe4484fed9d88e06d4c34f9a8bcc7047
S: 94f7df592c031a56dd0370dc04f0f9c564cbd423 10.16.124.12:6379
slots: (0 slots) slave
replicates 62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb
M: 62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb 10.16.124.11:6378
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
127.0.0.1:6379> CLUSTER nodes
366c2088f00aaff161a1abf5a831160ef26b8646 10.16.124.12:6378@16378 master - 0 1669263296463 4 connected 10923-16383
31e19cc8bb5c0c8dfb8e78c735daa634e33644ad 10.16.124.10:6378@16378 slave 366c2088f00aaff161a1abf5a831160ef26b8646 0 1669263295000 4 connected
a373bfeafe4484fed9d88e06d4c34f9a8bcc7047 10.16.124.10:6379@16379 myself,master - 0 1669263295000 1 connected 0-5460
3a6960c7f781bdd342fcb90fb9fd65499e7bee57 10.16.124.11:6379@16379 slave a373bfeafe4484fed9d88e06d4c34f9a8bcc7047 0 1669263293453 1 connected
94f7df592c031a56dd0370dc04f0f9c564cbd423 10.16.124.12:6379@16379 slave 62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb 0 1669263295460 2 connected
62da0a5ad744251d6b2d2ce13fdc1ff611d30ddb 10.16.124.11:6378@16378 master - 0 1669263294000 2 connected 5461-10922
127.0.0.1:6379>
127.0.0.1:6379> cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:160
cluster_stats_messages_pong_sent:172
cluster_stats_messages_sent:332
cluster_stats_messages_ping_received:167
cluster_stats_messages_pong_received:160
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:332
基本錯誤處理:
127.0.0.1:6379> get mykey
(error) MOVED 14687 10.16.124.12:6378
這是因為 我們登入的本機不是啟用了叢集模式
[root@yt2-db-test-vm16-124-10 data_6379]# redis-cli -c
127.0.0.1:6379> get mykey
-> Redirected to slot [14687] located at 10.16.124.12:6378
"redis over"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/133735/viewspace-2924917/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Docker構建redis叢集環境DockerRedis
- redis5.* 手動構建叢集Redis
- Redis系列:搭建Redis叢集(叢集模式)Redis模式
- redis 叢集Redis
- redis叢集Redis
- windows+nginx+iis+redis+Task.MainForm構建分散式架構 之 (nginx+iis構建服務叢集)WindowsNginxRedisAIORM分散式架構
- Redis cluster 叢集Redis
- redis叢集搭建Redis
- redis系列:叢集Redis
- 搭建 Redis 叢集Redis
- Redis Cluster(叢集)Redis
- Redis 叢集方法Redis
- Redis叢集方案Redis
- Redis 叢集方案Redis
- Redis-叢集Redis
- redis叢集原理Redis
- redis偽叢集配置Cluster叢集模式Redis模式
- Redis叢集 - cluster叢集、資料分片Redis
- Mac 下 利用 docker 構建 MySQL 叢集MacDockerMySql
- Redis叢集模式和常用資料結構Redis模式資料結構
- 構建Zookeeper叢集(zkcluster) ~一篇文章玩轉zk叢集^.^
- 認識Redis叢集——Redis ClusterRedis
- Redis(5.0) 叢集搭建Redis
- redis叢集的搭建Redis
- 搭建Redis原生叢集Redis
- docker-redis叢集DockerRedis
- Redis--叢集搭建Redis
- Docker搭建Redis叢集DockerRedis
- redis叢集指導Redis
- 安裝 REDIS 叢集Redis
- redis叢集報錯Redis
- 搭建redis cluster叢集Redis
- 構建MHA實現MySQL高可用叢集架構MySql架構
- 使用docker-compose構建elasticsearch叢集DockerElasticsearch
- solr叢集構建的基本流程介紹Solr
- Jedis操作單節點redis,叢集及redisTemplate操作redis叢集(一)Redis
- 基於Dokcer搭建Redis叢集(主從叢集)Redis
- 【Redis】用python操作redis叢集RedisPython