Redis3.0 叢集搭建
一。使用環境centos7 redis 3.2.12
二。安裝redis
tar -xzvf redis-3.2.12.tar.gz
cd redis-3.2.12
make
make install
修改redis.conf
#bind 127.0.0.1---允許外網訪問
daemonize yes---允許後臺執行
cluster-enabled yes---允許叢集
三。叢集搭建
1.重複步驟二,
碰到問題:You need tcl 8.5 or newer in order to run the Redis test
-
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
-
tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/
-
cd /usr/local/tcl8.6.1/unix/
-
./configure
-
make
-
make install
碰到問題:ruby 安裝
wget https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.3.tar.gz
tar zxvf ruby-2.2.3.tar.gz
cd ruby-2.2.3
./configure --prefix=/usr/local/ruby
make
make install
測試ruby . ruby -v 列印版本號就安裝ok了。
啟動叢集:
src/redis-server redis-cluster/3301/redis.conf
src/redis-server redis-cluster/3302/redis.conf
src/redis-server redis-cluster/3303/redis.conf
src/redis-server redis-cluster/3304/redis.conf
src/redis-server redis-cluster/3305/redis.conf
src/redis-server redis-cluster/3306/redis.conf
執行ruby命令:
src/redis-trib.rb create --replicas 1 127.0.0.1:3301 127.0.0.1:3302 127.0.0.1:3303 127.0.0.1:3304 127.0.0.1:3305 127.0.0.1:3306
測試:
ok,顯示到這裡就表示搭建成功了。
附件: