千家信息网

redis cluster如何安装

发表于:2024-11-12 作者:千家信息网编辑
千家信息网最后更新 2024年11月12日,这篇文章主要介绍redis cluster如何安装,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!1.安装redistar xzf redis-3.0.1.tar.gzcd re
千家信息网最后更新 2024年11月12日redis cluster如何安装

这篇文章主要介绍redis cluster如何安装,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

1.安装redis

tar xzf redis-3.0.1.tar.gz

cd redis-3.0.1
make

mkdir cluster

mkdir /etc/redismkdir -p /data/store/redis

mkdir -p /data/outputs/logs/redis

在两边都要走

2,配置redis

[root@slave2 redis-3.0.0]#  vim redis.conf   //解压的根目录,有redis.conf,做以下修改port 6379pidfile redis-6379.piddbfilename dump-6379.rdb appendfilename "appendonly-6379.aof" cluster-config-file nodes-6379.conf cluster-enabled yes cluster-node-timeout 5000 appendonly yesdir /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.conf3启动./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 redistcp 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.15 建立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 clusterConnecting to node 10.1.10.90:6379: OKConnecting to node 10.1.10.90:6380: OKConnecting to node 10.1.10.90:6381: OKConnecting to node 10.1.10.223:6379: OKConnecting to node 10.1.10.223:6380: OKConnecting to node 10.1.10.223:6381: OK>>> Performing hash slots allocation on 6 nodes...Using 3 masters:10.1.10.223:637910.1.10.90:637910.1.10.223:6380Adding replica 10.1.10.90:6380 to 10.1.10.223:6379Adding replica 10.1.10.223:6381 to 10.1.10.90:6379Adding replica 10.1.10.90:6381 to 10.1.10.223:6380M: 365b339b2585ca27fd5ba4383e626bf1ffa14bff 10.1.10.90:6379 slots:5461-10922 (5462 slots) masterS: cecc5521194616ce1175000de91a40d514993250 10.1.10.90:6380 replicates 7b0ea5f49bb33a74cdb956febed94bda260c1ad9S: ac87e0b7fee4d54c0cf5af6b579f9256f66cd35d 10.1.10.90:6381 replicates e0063b5583add6b18b7c2d93cae070fcf5f9e176M: 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 10.1.10.223:6379 slots:0-5460 (5461 slots) masterM: e0063b5583add6b18b7c2d93cae070fcf5f9e176 10.1.10.223:6380 slots:10923-16383 (5461 slots) masterS: a64d338f828698b207835a5a3a83c78ffd44a101 10.1.10.223:6381 replicates 365b339b2585ca27fd5ba4383e626bf1ffa14bffCan 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 clusterWaiting 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) masterM: cecc5521194616ce1175000de91a40d514993250 10.1.10.90:6380 slots: (0 slots) master replicates 7b0ea5f49bb33a74cdb956febed94bda260c1ad9M: ac87e0b7fee4d54c0cf5af6b579f9256f66cd35d 10.1.10.90:6381 slots: (0 slots) master replicates e0063b5583add6b18b7c2d93cae070fcf5f9e176M: 7b0ea5f49bb33a74cdb956febed94bda260c1ad9 10.1.10.223:6379 slots:0-5460 (5461 slots) masterM: e0063b5583add6b18b7c2d93cae070fcf5f9e176 10.1.10.223:6380 slots:10923-16383 (5461 slots) masterM: 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如何安装"这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!

0