centOS7安裝redis5.0.7
阿新 • • 發佈:2020-07-24
安裝Ruby語言
0.檢視哪些是穩定版
http://www.ruby-lang.org/zh_cn/downloads/
1.網站下載
https://cache.ruby-china.com/pub/ruby/ruby-2.6.6.tar.xz
2.也可以wget下載
wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-6.6.6.tar.gz
3.若沒有xz,先安裝xz
xz ruby-2.6.6.tar.xz
tar -vxf ruby-2.6.6.tar
mv ruby-2.6.6 /usr/local/
mkdir ruby
cd ruby-2.6.6/
.configure --prefix=/usr/local/ruby
make
make install
./ruby -v
4.上面沒有問題,配置環境
echo "export PATH=$PATH:/usr/local/ruby/bin" >> /etc/profile
source /etc/profile
ruby -v
安裝redis5.0.7
1.網站下載
http://download.redis.io/releases/
2.解壓
tar -vxf redis-5.0.7.tar.gz
mv redis-5.0.7 /usr/local/
mkdir redis
3.簡易配置
cd redis-5.0.7/
vim redis.conf
----ctrl+ins複製
#bind 127.0.0.1
protected-mode no
timeout 3600
daemonize yes
4.安裝
cd redis-5.0.7/
make
make install prefix=/usr/local/redis
cd ../redis
mkdir etc
cd etc
mkdir log
cp /usr/local/redis-5.0.7/redis.conf /usr/local/redis/etc/
5.啟動
cd /usr/local/redis/bin
./redis-server ../etc/redis.conf
./redis-cli -c -p 6379
叢集配置
1.配置redis.conf
cd /usr/local/redis
mkdir etc
mkdir log
cd etc
mkdir 8000 8001 8002 8003 8004 8005
cp /usr/local/redis-5.0.7/redis.conf /usr/local/redis/etc/8000/
vim 8000/redis.conf
--
logfile "/usr/local/redis/log/6379.log"
dbfilename dump8000.rdb
appendonly yes
appendfilename "appendonly6379.aof"
cluster-enabled yes
cluster-config-file nodes_8000.conf
cluster-node-timeout 15000
:%s/6379/8000/g
2.建立叢集,8003,8004,8005之後分
redis-cli --cluster create 192.168.246.130:8000 192.168.246.130:8001
192.168.246.130:8002
3.登入
cluster info
cluster nodes
4.動態新增節點,啟動8003,8004,8005
redis-cli --cluster add-node 192.168.246.130:8005 192.168.246.130:8000
redis-cli -c -p 8000
cluster info
cluster nodes
檢視狀態
5.動態新增從節點
redis-cli --cluster add-node 192.168.246.130:8003 192.168.246.130:8000 --cluster-slave --cluster-master-id 25f77d1d595a1b7bad8f14058914792fcc3bad4a
redis-cli --cluster add-node 192.168.246.130:8004 192.168.246.130:8001 --cluster-slave --cluster-master-id 5e2633717488152e8e8ad640b73b5b937e1d08aa
redis-cli --cluster add-node 192.168.246.130:8005 192.168.246.130:8002 --cluster-slave --cluster-master-id 75c81e6f02e8e9cd32235b65a35f6f54d08b01b1
6.一鍵新增節點
redis-cli --cluster add-node 192.168.246.130:8000 192.168.246.130:8001 192.168.246.130:8002 192.168.246.130:8003 192.168.246.130:8004 192.168.246.130:8005 --cluster-replicas 1
一主一叢