redis cluster 配置
測試redis在三臺主機上配置cluster
redis:3.0.5
os:centos 6.6
host:192.108.56.117 ct6601
192.108.56.119 ct6602
192.108.56.120 ct6604
所需檔案:redis-3.0.5.tar.gz,ruby-2.2.3.tar.gz,rubygems-2.5.0.tgz,redis-3.2.2.gem
以下是下載地址:
redis-3.0.5.tar.gz
ruby-2.2.3.tar.gz
rubygems-2.5.0.tgz
redis-3.2.2.gem
#在ct6601,ct6602,ct6604上執行相同操作
#列出需要安裝的檔案
[root@ct6601 ~]# cd ~
[root@ct6601 ~]# ls
redis-3.0.5.tar.gz
redis-3.2.2.gem
ruby-2.2.3.tar.gz
rubygems-2.5.0.tgz
#安裝ruby
[root@ct6601 ~]# tar -xzvf ruby-2.2.3.tar.gz
[root@ct6601 ~]# cd ruby-2.2.3
[root@ct6601 ruby-2.2.3]# ./configure -prefix=/usr/local/ruby
[root@ct6601 ruby-2.2.3]# make
[root@ct6601 ruby-2.2.3]# make install
[root@ct6601 ruby-2.2.3]# cp ruby /usr/local/bin/
#安裝rubygem
[root@ct6601 ruby-2.2.3]# cd ~
[root@ct6601 ~]# tar -xzvf rubygems-2.5.0.tgz
[root@ct6601 ~]# cd rubygems-2.5.0
[root@ct6601 rubygems-2.5.0]# ruby setup.rb
[root@ct6601 rubygems-2.5.0]# cp bin/gem /usr/local/bin/
#安裝gem-redis
[root@ct6601 rubygems-2.5.0]# cd ~
[root@ct6601 ~]# gem install -l redis-3.2.2.gem
#安裝redis
[root@ct6601 ~]# tar -xzvf redis-3.0.5.tar.gz
[root@ct6601 ~]# cd redis-3.0.5
[root@ct6601 redis-3.0.5]# make
[root@ct6601 redis-3.0.5]# make install
[root@ct6601 redis-3.0.5]# cp src/redis-trib.rb /usr/local/bin/
#配置redis引數
[root@ct6601 redis-3.0.5]# mkdir -p /usr/local/redis/6379 /usr/local/redis/6380
[root@ct6601 ~]# cat > /usr/local/redis/6379/redis.conf <<EOF
port 6379
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
EOF
[root@ct6601 ~]# cat > /usr/local/redis/6380/redis.conf <<EOF
port 6380
daemonize yes
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
EOF
#啟動redis
#這裡注意要cd到對應目錄再執行,不然aof檔案和node.conf檔案會放在當前執行的目錄
[root@ct6601 ~]# cd /usr/local/redis/6379
[root@ct6601 6379]# redis-server redis.conf
[root@ct6601 6379]# cd /usr/local/redis/6380
[root@ct6601 6380]# redis-server redis.conf
[root@ct6601 6380]# ps -ef|grep redis
root 12566 1 0 19:56 ? 00:00:00 redis-server *:6379 [cluster]
root 12574 1 0 19:56 ? 00:00:00 redis-server *:6380 [cluster]
root 12582 12534 0 19:56 pts/4 00:00:00 grep redis
#在任意一臺主機上執行,以完成cluster建立
[root@ct6601 6380]# redis-trib.rb create --replicas 1 192.108.56.117:6379 192.108.56.117:6380 192.108.56.119:6379 192.108.56.119:6380 192.108.56.120:6379 192.108.56.120:6380
#簡單驗證
[root@ct6601 6380]# redis-cli -c
127.0.0.1:6379> set mykey hello,select;
-> Redirected to slot [14687] located at 192.108.56.120:6379
OK
[root@ct6602 6380]# redis-cli -c
127.0.0.1:6379> get mykey
-> Redirected to slot [14687] located at 192.108.56.120:6379
"hello,select;"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28539951/viewspace-1868385/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- redis偽叢集配置Cluster叢集模式Redis模式
- 【Redis】redis-cluster到redis-cluster的快速複製Redis
- Redis Cluster原理Redis
- redis cluster 搭建Redis
- Redis Cluster 3.0Redis
- Redis cluster on WindowsRedisWindows
- 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模式
- 【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
- Redis4.0 Cluster — Centos7RedisCentOS