您好,登錄后才能下訂單哦!
這篇文章主要介紹redis cluster如何安裝,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
1.安裝redis
tar xzf redis-3.0.1.tar.gz
cd redis-3.0.1
make
mkdir cluster
mkdir /etc/redis mkdir -p /data/store/redis
mkdir -p /data/outputs/logs/redis
在兩邊都要走
2,配置redis
[root@slave2 redis-3.0.0]# vim redis.conf //解壓的根目錄,有redis.conf,做以下修改 port 6379 pidfile redis-6379.pid dbfilename dump-6379.rdb appendfilename "appendonly-6379.aof" cluster-config-file nodes-6379.conf cluster-enabled yes cluster-node-timeout 5000 appendonly yes dir /data/store/redis/
cp redis.conf /etc/redis/redis-6379.conf
cp redis.conf /etc/redis/redis-6380.conf
cp redis.conf /etc/redis/redis-6381.conf
sed -i "s/6379/6380/g" /etc/redis/redis-6380.conf
sed -i "s/6379/6381/g" /etc/redis/redis-6381.conf
scp /etc/redis/redis-6379.conf 10.1.10.223:/etc/redis/redis-6379.conf scp /etc/redis/redis-6380.conf 10.1.10.223:/etc/redis/redis-6380.conf
scp /etc/redis/redis-6381.conf 10.1.10.223:/etc/redis/redis-6381.conf 3啟動 ./redis-server /etc/redis/redis-6379.conf > /data/outputs/logs/redis/redis-6379.log 2>&1 & ./redis-server /etc/redis/redis-6380.conf > /data/outputs/logs/redis/redis-6380.log 2>&1 &
./redis-server /etc/redis/redis-6381.conf > /data/outputs/logs/redis/redis-6381.log 2>&1 & 兩邊都啟動
netstat -tpnl |grep redis tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 18201/./redis-serve tcp 0 0 0.0.0.0:6380 0.0.0.0:* LISTEN 18204/./redis-serve tcp 0 0 0.0.0.0:6381 0.0.0.0:* LISTEN 18207/./redis-serve tcp 0 0 0.0.0.0:16379 0.0.0.0:* LISTEN 18201/./redis-serve tcp 0 0 0.0.0.0:16380 0.0.0.0:* LISTEN 18204/./redis-serve tcp 0 0 0.0.0.0:16381 0.0.0.0:* LISTEN 18207/./redis-serve tcp 0 0 :::6379 :::* LISTEN 18201/./redis-serve tcp 0 0 :::6380 :::* LISTEN 18204/./redis-serve tcp 0 0 :::6381 :::* LISTEN 18207/./redis-serve tcp 0 0 :::16379 :::* LISTEN 18201/./redis-serve tcp 0 0 :::16380 :::* LISTEN 18204/./redis-serve tcp 0 0 :::16381 :::* LISTEN 18207/./redis-serve
ll /data/store/redis/ 4安裝ruby,rubygem yum -y install gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-d yum -y install ruby rubygems 替換掉源 gem source -l gem sources --remove gem sources -a gem install redis --version 3.0.1 5 建立cluster
redis-trib.rb create --replicas 1 10.1.10.90:6379 10.1.10.90:6380 10.1.10.90:6381 10.1.10.223:6379 10.1.10.223:6380 10.1.10.223:6381 >>> Creating cluster Connecting to node 10.1.10.90:6379: OK Connecting to node 10.1.10.90:6380: OK Connecting to node 10.1.10.90:6381: OK Connecting to node 10.1.10.223:6379: OK Connecting to node 10.1.10.223:6380: OK Connecting to node 10.1.10.223:6381: OK >>> Performing hash slots allocation on 6 nodes... Using 3 masters: 10.1.10.223:6379 10.1.10.90:6379 10.1.10.223:6380 Adding replica 10.1.10.90:6380 to 10.1.10.223:6379 Adding replica 10.1.10.223:6381 to 10.1.10.90:6379 Adding replica 10.1.10.90:6381 to 10.1.10.223:6380 M: 365b339b2585ca27fd5ba4383e626bf1ffa14bff 10.1.10.90:6379 slots:5461-10922 (5462 slots) master S: cecc5521194616ce1175000de91a40d514993250 10.1.10.90:6380 replicates 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 S: ac87e0b7fee4d54c0cf5af6b579f9256f66cd35d 10.1.10.90:6381 replicates e0063b5583add6b18b7c2d93cae070fcf5f9e176 M: 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 10.1.10.223:6379 slots:0-5460 (5461 slots) master M: e0063b5583add6b18b7c2d93cae070fcf5f9e176 10.1.10.223:6380 slots:10923-16383 (5461 slots) master S: a64d338f828698b207835a5a3a83c78ffd44a101 10.1.10.223:6381 replicates 365b339b2585ca27fd5ba4383e626bf1ffa14bff 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.1.10.90:6379) M: 365b339b2585ca27fd5ba4383e626bf1ffa14bff 10.1.10.90:6379 slots:5461-10922 (5462 slots) master M: cecc5521194616ce1175000de91a40d514993250 10.1.10.90:6380 slots: (0 slots) master replicates 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 M: ac87e0b7fee4d54c0cf5af6b579f9256f66cd35d 10.1.10.90:6381 slots: (0 slots) master replicates e0063b5583add6b18b7c2d93cae070fcf5f9e176 M: 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 10.1.10.223:6379 slots:0-5460 (5461 slots) master M: e0063b5583add6b18b7c2d93cae070fcf5f9e176 10.1.10.223:6380 slots:10923-16383 (5461 slots) master M: a64d338f828698b207835a5a3a83c78ffd44a101 10.1.10.223:6381 slots: (0 slots) master replicates 365b339b2585ca27fd5ba4383e626bf1ffa14bff [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
以上是“redis cluster如何安裝”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。