redis-cluster集群安装(基于redis-3.2.10)
上节主要演示了redis单节点的安装部署,对于数据量更大的服务可以安装redis-cluster进行处理
1. 安装ruby
yum install ruby ruby-devel rubygems rpm-build -y
rpm -qa|grep ruby
ruby -v
2.安装redis-cluster
gem install redis --version 3.2.
gem list
3.到redis源码目录找到集群创建工具
/bin/cp /server/tools/redis-3.2./src/redis-trib.rb /usr/local/redis/bin/
4.创建redis-cluster集群节点
(1)创建节点目录,修改配置文件
[root@redis-server tools]# mkdir -p /usr/local/redis/redis-cluster/{7001,7002,7003}
cluster-enabled yes
cluster-config-file /usr/local/redis/redis-cluster//nodes-.conf
cluster-node-timeout
appendonly yes
[root@redis-server tools]# sh -x add_redis-cluster-port_rc.sh
+ echo '------ Start Create redis-cluster ------'
------ Start Create redis-cluster ------
+ redisport1=
+ redisport2=
+ redisport3=
+ redis_path=/usr/local/redis
+ redis_cluster_path=/usr/local/redis/redis-cluster
++ grep -v 127.0.0.1
++ grep -v inet6
++ grep inet
++ awk '{print $2}'
++ /sbin/ifconfig -a
++ tr -d addr:
+ localIP=192.168.1.71
+ '[' -z ']'
+ echo 'The redis-port is 8001'
The redis-port is
+ '[' -z ']'
+ echo 'The redis-port is 8002'
The redis-port is
+ '[' -z ']'
+ echo 'The redis-port is 8003'
The redis-port is
+ echo /usr/local/redis/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
/usr/local/redis/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
+ sleep
+ mkdir -p /usr/local/redis/redis-cluster/ /usr/local/redis/redis-cluster/ /usr/local/redis/redis-cluster/
+ cd /server/tools/
+ /bin/cp democonf_redis-cluster_6379.conf /usr/local/redis/redis-cluster//conf-.conf
+ sed -i s###g /usr/local/redis/redis-cluster//conf-.conf
+ /bin/cp democonf_redis-cluster_6379.conf /usr/local/redis/redis-cluster//conf-.conf
+ sed -i s###g /usr/local/redis/redis-cluster//conf-.conf
+ /bin/cp democonf_redis-cluster_6379.conf /usr/local/redis/redis-cluster//conf-.conf
+ sed -i s###g /usr/local/redis/redis-cluster//conf-.conf
+ tree /usr/local/redis/redis-cluster
/usr/local/redis/redis-cluster
├──
│ └── conf-.conf
├──
│ └── conf-.conf
└──
└── conf-.conf directories, files
+ echo '------ Start redis-cluster nodes ------'
------ Start redis-cluster nodes ------
+ sleep
+ /usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
+ /usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
+ /usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
++ date +%F
+ echo '# redis-cluster-port for 8001,8002,8003 in 2017-09-21'
+ echo '/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster/8001/conf-8001.conf'
+ echo '/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster/8002/conf-8002.conf'
+ echo '/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster/8003/conf-8003.conf'
+ tail - /etc/rc.local
tail: 无法使用 inotify 机制,回归为 polling 机制
# redis-cluster-port for ,, in --
/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
/usr/local/redis/bin/redis-server /usr/local/redis/redis-cluster//conf-.conf
+ echo '------ Create redis-cluster ------'
------ Create redis-cluster ------
+ sleep
+ /usr/local/redis/bin/redis-trib.rb create --replicas 192.168.1.71: 192.168.1.71: 192.168.1.71:
>>> Creating cluster
Connecting to node 192.168.1.71:: OK
Connecting to node 192.168.1.71:: OK
Connecting to node 192.168.1.71:: OK
>>> Performing hash slots allocation on nodes...
Using masters:
192.168.1.71:
192.168.1.71:
192.168.1.71:
M: 97ca887459268c2effca0af3263dcd00e83cae37 192.168.1.71:
slots:- ( slots) master
M: e43cda13f069241a25786bb4916e21e7e8a5e1d5 192.168.1.71:
slots:- ( slots) master
M: 53383a751348ed8bd2ec88fd487ada344c7a7bc8 192.168.1.71:
slots:- ( slots) master
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 192.168.1.71:)
M: 97ca887459268c2effca0af3263dcd00e83cae37 192.168.1.71:
slots:- ( slots) master
M: e43cda13f069241a25786bb4916e21e7e8a5e1d5 192.168.1.71:
slots:- ( slots) master
M: 53383a751348ed8bd2ec88fd487ada344c7a7bc8 192.168.1.71:
slots:- ( slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All slots covered.
+ echo '------ Test redis-cluster ------'
------ Test redis-cluster ------
+ sleep
+ grep --color=auto redis-server
+ netstat -anptl
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 0.0.0.0: 0.0.0.0:* LISTEN /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
tcp 192.168.1.71: 192.168.1.71: ESTABLISHED /redis-server
+ /usr/local/redis/bin/redis-cli -c -p
127.0.0.1:> exit
+ echo '------ Create redis-cluster is OK! ------'
------ Create redis-cluster is OK! ------
[root@zstest1 tools]#
redis-cluster集群安装(基于redis-3.2.10)的更多相关文章
- redis cluster 集群 安装 配置 详解
redis cluster 集群 安装 配置 详解 张映 发表于 2015-05-01 分类目录: nosql 标签:cluster, redis, 安装, 配置, 集群 Redis 集群是一个提供在 ...
- Redis Cluster集群知识学习总结
Redis集群解决方案有两个: 1) Twemproxy: 这是Twitter推出的解决方案,简单的说就是上层加个代理负责分发,属于client端集群方案,目前很多应用者都在采用的解决方案.Twem ...
- centos6下redis cluster集群部署过程
一般来说,redis主从和mysql主从目的差不多,但redis主从配置很简单,主要在从节点配置文件指定主节点ip和端口,比如:slaveof 192.168.10.10 6379,然后启动主从,主从 ...
- 深入分析redis cluster 集群
深入分析redis cluster 集群安装配置详解 下面小编来为各位介绍一篇深入分析redis cluster 集群安装配置详解,如果你希望做数据库集群就可以来看看此文章的哦. http://rub ...
- CentOS7 安装Redis Cluster集群
上一篇中已经讲到了如何安装单击版Redis,这一篇我们来说下如何安装Cluster,关于哨兵模式这里我就不写文章安装了,有兴趣的同学可以自己去研究,哨兵模式可以在主从模式下在创建三台机器的哨兵集群监控 ...
- 【原创】强撸基于 .NET 的 Redis Cluster 集群访问组件
Hello 大家好,我是TANZAME,我们又见面了.今天我们来聊聊怎么手撸一个 Redis Cluster 集群客户端,纯手工有干货,您细品. 随着业务增长,线上环境的QPS暴增,自然而然将当前的单 ...
- Redis Cluster集群搭建与应用
1.redis-cluster设计 Redis集群搭建的方式有多种,例如使用zookeeper,但从redis 3.0之后版本支持redis-cluster集群,redis-cluster采用无中心结 ...
- Redis cluster集群:原理及搭建
Redis cluster集群:原理及搭建 2018年03月19日 16:00:55 阅读数:6120 1.为什么使用redis? redis是一种典型的no-sql 即非关系数据库 像python的 ...
- Redis Cluster集群搭建<原>
一.环境配置 一台window 7上安装虚拟机,虚拟机中安装的是centos系统. 二.目标 Redis集群搭建的方式有多种,根据集群逻辑的位置,大致可以分为三大类:基于客户端分片的Redis ...
- redis cluster 集群畅谈(三) 之 水平扩容、slave自动化迁移
上一篇http://www.cnblogs.com/qinyujie/p/9029522.html, 主要讲解 实验多master写入.读写分离.实验自动故障切换(高可用性),那么本篇我们就来聊了聊r ...
随机推荐
- visual studio多工程开发配置
文章:带你玩转Visual Studio——带你多工程开发 带你玩转Visual Studio——带你理解微软的预编译头技术 通过上一篇文章带你玩转Visual Studio——带你多工程开发的讲解, ...
- python中的排序
今天在http://www.pythontip.com刷题的时候遇到一个排序的问题:一个列表中既有字符串,又有数字,该怎么排序. list = [1,2,5,4,'d','s','e',45] lis ...
- 2018 Multi-University Training Contest 2 Solution
A - Absolute 留坑. B - Counting Permutations 留坑. C - Cover 留坑. D - Game puts("Yes") #include ...
- Python 读取写入配置文件 ConfigParser
https://blog.csdn.net/piaodexin/article/details/77371343 https://www.cnblogs.com/feeland/p/4502931.h ...
- 20145122 《Java程序设计》第二周学习总结
20145122 <Java程序设计>第2周学习总结 教材学习内容总结 在大一的时候我们学习了C语言,所以对第三章的知识不是很陌生,但有些新知识需要记忆. java常用的数据类型: byt ...
- git将多个commit合并成一个新的commit
问题: 有以下commit: 323udd ede234 6e7s6e 要合并第一个和第二个commit 方法有二: 方法一 使用git rebase -i hash-id,-i表示以交互模式进行co ...
- 【转】Linux系统平均负载3个数字的含义
文章作者:姜南(Slyar) 文章来源:Slyar Home (www.slyar.com) 转载请注明,谢谢合作. 越来越多人开始接触Linux操作系统,从VPS到无线路由的刷机系统(如OpenWR ...
- POJ 3660 Cow ContestCow(Floyd传递闭包)题解
题意:给出m个关系,问你能确定机头牛的排名 思路:要确定排名那必须要把他和其他n-1头牛比过才行,所以Floyd传递闭包,如果赢的+输的有n-1就能确定排名. 代码: #include<cstd ...
- CentOS6安装Pyhon3
一,从官方下载Python3.6 [root@linux-node1 src]# pwd /usr/local/src [root@linux-node1 src]# wget https://www ...
- tfn2k工具使用介绍
主要介绍tfn2k(Linux),因为它最著名嘛!主要分为使用说明 然后在说安装所以有点长 (注意:有的人拿VPS来做DDOS·问题是有的人发现了会关闭你VPS的·除非你认识他或者你自己有服务器而不是 ...