之前写过一套基于redis-4.0.6版本的测试集群部署

https://www.cnblogs.com/mrice/p/10730309.html

最近生产环境需要部署一套redis-5.0.5版本集群;

环境:

服务器:6台

操作系统:Red Hat Enterprise Linux Server release 7.4

redis:redis-5.0.5

ruby:ruby-2.0.0 (redis-3.3.5.gem)

一、基础安装

1、安装好ruby

2、安装redis-3.3.5.gem

gem install redis-3.3.5.gem

3、修改系统变量

echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
echo > /proc/sys/net/core/somaxconn
sysctl -p

二、redis安装

1、安装redis

压缩安装包后

make && make install

2、配置redis

从安装文件中复制一份redis.conf,下面是配置文件内容,红色字体大家需要注意一下。

bind 10.20.1.56  //修改绑定地址
protected-mode yes
port 6379 //可修改自己规则端口,但集群状态下需要注意,集群使用端口会在此端口上增加10000,所以redis自身端口+10000不能超过65535。
tcp-backlog
timeout
tcp-keepalive
daemonize yes
supervised no
pidfile /mrice/redis-cluster/redis-6379/redis_6379.pid //pid存放位置
loglevel notice
logfile "/mrice/redis-cluster/redis-6379/logs/redis_6379.log"
databases
always-show-logo yes
save
save
save
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir "/mrice/redis-cluster/redis-6379/data" //数据存放目录
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay
repl-disable-tcp-nodelay no
replica-priority
requirepass mrice //增加认证
masterauth mrice //主从复制时认证密码
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit
cluster-enabled yes //开启集群功能
cluster-config-file /mrice/redis-cluster/redis-6379/logs/nodes.conf //集群状态
slowlog-log-slower-than
slowlog-max-len
latency-monitor-threshold
notify-keyspace-events ""
hash-max-ziplist-entries
hash-max-ziplist-value
list-max-ziplist-size -
list-compress-depth
set-max-intset-entries
zset-max-ziplist-entries
zset-max-ziplist-value
hll-sparse-max-bytes
stream-node-max-bytes
stream-node-max-entries
activerehashing yes
client-output-buffer-limit normal
client-output-buffer-limit replica 256mb 64mb
client-output-buffer-limit pubsub 32mb 8mb
hz
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes

3、配置文件修改完后,启动redis服务

redis-server redis.conf

4、建立集群

这里注意的是以之前版本不同的是,通过redis-cli 来完成。

redis-cli --cluster create 10.20.1.51: 10.20.1.52: 10.20.1.53: 10.20.1.54: 10.20.1.55: 10.20.1.56: --cluster-replicas  -a mrice
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
>>> Performing hash slots allocation on nodes...
Master[] -> Slots -
Master[] -> Slots -
Master[] -> Slots -
Adding replica 10.20.1.55: to 10.20.1.51:
Adding replica 10.20.1.56: to 10.20.1.52:
Adding replica 10.20.1.54: to 10.20.1.53:
M: 9cd49f7033ab577919a645bc0b8fed7e14084e02 10.20.1.51:
slots:[-] ( slots) master
M: 2ecfdb47842b341c7dd91d3d5a807787c1790ca2 10.20.1.52:
slots:[-] ( slots) master
M: 6efe5181ae476ae33274b81c8f2f877444381795 10.20.1.53:
slots:[-] ( slots) master
S: 9f3fce417fbe0febe818e1b67a1b402c3b831b61 10.20.1.54:
replicates 6efe5181ae476ae33274b81c8f2f877444381795
S: c13ffcdc2960bd59471eb050c2e8bfdf0a8e36e8 10.20.1.55:
replicates 9cd49f7033ab577919a645bc0b8fed7e14084e02
S: 05a2efa665ee97246591a42836ed62e807b3f240 10.20.1.56:
replicates 2ecfdb47842b341c7dd91d3d5a807787c1790ca2
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.20.1.51:)
M: 9cd49f7033ab577919a645bc0b8fed7e14084e02 10.20.1.51:
slots:[-] ( slots) master
additional replica(s)
S: 05a2efa665ee97246591a42836ed62e807b3f240 10.20.1.56:
slots: ( slots) slave
replicates 2ecfdb47842b341c7dd91d3d5a807787c1790ca2
M: 6efe5181ae476ae33274b81c8f2f877444381795 10.20.1.53:
slots:[-] ( slots) master
additional replica(s)
M: 2ecfdb47842b341c7dd91d3d5a807787c1790ca2 10.20.1.52:
slots:[-] ( slots) master
additional replica(s)
S: c13ffcdc2960bd59471eb050c2e8bfdf0a8e36e8 10.20.1.55:
slots: ( slots) slave
replicates 9cd49f7033ab577919a645bc0b8fed7e14084e02
S: 9f3fce417fbe0febe818e1b67a1b402c3b831b61 10.20.1.54:
slots: ( slots) slave
replicates 6efe5181ae476ae33274b81c8f2f877444381795
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All slots covered.
[root@EOMS-daiwei3-OSS logs]#

5、验证

redis-cli -p 6379 -h 10.20.1.56 -a mrice

10.20.1.56:> INFO cluster
# Cluster
cluster_enabled:
10.20.1.56:> CLUSTER INFO
cluster_state:ok
cluster_slots_assigned:
cluster_slots_ok:
cluster_slots_pfail:
cluster_slots_fail:
cluster_known_nodes:
cluster_size:
cluster_current_epoch:
cluster_my_epoch:
cluster_stats_messages_ping_sent:
cluster_stats_messages_pong_sent:
cluster_stats_messages_sent:
cluster_stats_messages_ping_received:
cluster_stats_messages_pong_received:
cluster_stats_messages_fail_received:
cluster_stats_messages_received:
10.20.1.56:> CLUSTER SLOTS
) ) (integer)
) (integer)
) ) "10.20.1.53"
) (integer)
) "6efe5181ae476ae33274b81c8f2f877444381795"
) ) "10.20.1.54"
) (integer)
) "9f3fce417fbe0febe818e1b67a1b402c3b831b61"
) ) (integer)
) (integer)
) ) "10.20.1.51"
) (integer)
) "9cd49f7033ab577919a645bc0b8fed7e14084e02"
) ) "10.20.1.55"
) (integer)
) "c13ffcdc2960bd59471eb050c2e8bfdf0a8e36e8"
) ) (integer)
) (integer)
) ) "10.20.1.52"
) (integer)
) "2ecfdb47842b341c7dd91d3d5a807787c1790ca2"
) ) "10.20.1.56"
) (integer)
) "05a2efa665ee97246591a42836ed62e807b3f240"

redis-5.0.5 集群部署的更多相关文章

  1. redis 3.0的集群部署

    转载请注明出处:http://hot66hot.iteye.com/admin/blogs/2050676 最近研究redis-cluster,正好搭建了一个环境,遇到了很多坑,系统的总结下,等到re ...

  2. (转)redis 3.0的集群部署

    一:关于redis cluster 1:redis cluster的现状 reids-cluster计划在redis3.0中推出,可以看作者antirez的声明:http://antirez.com/ ...

  3. Redis 5.0.3集群部署

    参考文章 https://blog.csdn.net/yyTomson/article/details/85783753 https://www.cnblogs.com/zy-303/p/102731 ...

  4. Redis 中常见的集群部署方案

    Redis 的高可用集群 前言 几种常用的集群方案 主从集群模式 全量同步 增量同步 哨兵机制 什么是哨兵机制 如何保证选主的准确性 如何选主 选举主节点的规则 哨兵进行主节点切换 切片集群 Redi ...

  5. Redis 3.0 Cluster集群配置

    Redis 3.0 Cluster集群配置 安装环境依赖 安装gcc:yum install gcc 安装zlib:yum install zib 安装ruby:yum install ruby 安装 ...

  6. Redis 5.0.5集群搭建

    Redis 5.0.5集群搭建 一.概述 Redis3.0版本之后支持Cluster. 1.1.redis cluster的现状 目前redis支持的cluster特性: 1):节点自动发现 2):s ...

  7. hbase-2.0.4集群部署

    hbase-2.0.4集群部署 1. 集群节点规划: rzx1 HMaster,HRegionServer rzx2 HRegionServer rzx3 HRegionServer 前提:搭建好ha ...

  8. 配置redis 4.0.11 集群

    配置redis 4.0.11 集群 准备redis 软件和redis配置文件 启动Redis服务 /data/soft/redis/src/redis-check-aof --fix /log/red ...

  9. redis3.0.5集群部署安装详细步骤

    Redis集群部署文档(centos6系统) (要让集群正常工作至少需要3个主节点,在这里我们要创建6个redis节点,其中三个为主节点,三个为从节点,对应的redis节点的ip和端口对应关系如下) ...

  10. 1--redis3.0.5集群部署安装详细步骤

    Redis集群部署文档(centos6系统) (要让集群正常工作至少需要3个主节点,在这里我们要创建6个redis节点,其中三个为主节点,三个为从节点,对应的redis节点的ip和端口对应关系如下) ...

随机推荐

  1. SecureCRT通过密钥登录

    转载  https://blog.csdn.net/langkeziju/article/details/53024031 说明:一般的密码方式登录容易被密码暴力破解.所以一般我们会将 SSH 的端口 ...

  2. es6 语法的

    es5 中提供了 两个声明变量的方式 var function es6 中提供了 四种声明变量的方式 let const class import 现在,定义变量的关键字有 6 个了 备注:不能忽略函 ...

  3. SpringBoot(十二):SpringBoot整合Kafka

    https://blog.csdn.net/saytime/article/details/79950635

  4. gson转换json到bean时重命名

    @Expose   @SerializedName("0001") public Map<String,ChannelBean> c0001 = new HashMap ...

  5. GitHub - 解决 GitHub Page 404

    带有下划线的文件报 404 解决:在仓库文件夹根目录添加.nojekyll文件 参见: Bypassing Jekyll on GitHub Pages - The GitHub Blog How t ...

  6. springboot使用MockMvc测试controller

    通常,在我们平时开发项目时,如果想要输入URL对Controller进行测试,在代码编辑之后,需要重启服务器,建立http client进行测试.这样会使得测试变得很麻烦,比如,启动速度慢,测试验证不 ...

  7. Burp Suite批量网页操作

    1.打开md5解密网站,并输入“21232F297A57A5A743894A0E4A801FC3”,不要点击[Decrypt It!] 1.启动Burp Suite,并设置浏览器代理 3.点击[Dec ...

  8. [转帖]NetSuite 进入中国市场满一年,甲骨文公布首份成绩单

    NetSuite 进入中国市场满一年,甲骨文公布首份成绩单 https://baijiahao.baidu.com/s?id=1617073148682281883&wfr=spider&am ...

  9. Eclipse使用jdbc连接MySql数据库报:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

    在使用eclipse连接mysql数据库时报异常: java.sql.SQLException: Access denied for user 'root'@'localhost' (using pa ...

  10. 从汇编到C

    一. 设置栈 1.1. C语言运行时需要和栈的意义 1.1.1. “C语言运行时(runtime)”需要一定的条件,这些条件由汇编来提供.C语言运行时主要是需要栈 1.1.2. C语言与栈的关系 a. ...