一,准備工作
1,下載redis包redis-3.2.0.tar.gz
2,下載tcl8.6.5-src.tar.gz (針對tcl版本過低的centos系統)
二,創建redis用戶
useradd redis
passwd redis 輸入密碼
三,安裝
1,創建redis安裝目錄
mkdir -p /usr/local/redis
chown -R redis.redis /usr/local/redis
1,將redis安裝包上傳到/usr/local/redis目錄並解壓
3,進入 redis-3.2.0 文件夾編譯安裝(其實我覺得沒必要再編譯安裝,直接進入src目錄運行命令就可以)
編譯安裝過程中可能會出現一些錯誤 所以最好編譯安裝之前運行一下以下的命令
yum install ruby
yum install rubygems
wget https://rubygems.global.ssl.fastly.net/gems/redis-3.2.1.gem
gem install -l ./redis-3.2.1.gem
。。。過程中還會出現tcl版本過低的問題,在網上找資料升級一下就可以了
4,創建集群需要的目錄並拷貝redis
mkdir -p /usr/local/cluster
mkdir -p /usr/local/cluster/7000
mkdir -p /usr/local/cluster/7001
mkdir -p /usr/local/cluster/7002
mkdir -p /usr/local/cluster/7003
mkdir -p /usr/local/cluster/7004
mkdir -p /usr/local/cluster/7005
cp -rf /usr/local/redis3.2.0/* /usr/local/cluster/7000/
cp -rf/usr/local/redis3.2.0* /usr/local/cluster/7001/
cp -rf/usr/local/redis3.2.0* /usr/local/cluster/7002/
cp -rf/usr/local/redis3.2.0* /usr/local/cluster/7003/
cp -rf/usr/local/redis3.2.0* /usr/local/cluster/7004/
cp -rf/usr/local/redis3.2.0* /usr/local/cluster/7005/
5,修改配置文件redis.conf
vi /usr/local/cluster/7000/redis.conf
##修改配置文件中的下面選項
port 7000
daemonize yes
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
appendonly yes
#同樣再對其它配置文件進行修改
vi /usr/local/cluster/7001/redis.conf
vi /usr/local/cluster/7002/redis.conf
vi /usr/local/cluster/7003/redis.conf
vi /usr/local/cluster/7004/redis.conf
vi /usr/local/cluster/7005/redis.conf
cd /usr/local/cluster/7000/src
./redis-server ../redis.conf
6,創建redis集群
cd /usr/local/redis3.0/src
./redis-trib.rb create --replicas 1 127.0.0.1:7000 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
http://xxxxxx/Linuxjc/1134290.html TechArticle