之前写过一套基于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. 【后台管理系统】—— Ant Design Pro 项目爬坑(一)

    1.表单rule中可以分对象处理不同规则 <FormItem label="类型名称" {...formLayout}> { form.getFieldDecorato ...

  2. Text Classification

    Text Classification For purpose of word embedding extrinsic evaluation, especially downstream task. ...

  3. 【C++进阶】getline

    在<istream>中的getline函数有两种重载形式: istream& getline (char* s, streamsize n );istream& getli ...

  4. $.ajax函数调接口,报异常No converter found for return value of type: class java.util.ArrayList

    接口正常执行,返回给前端后报服务器500异常,异常详情: org.springframework.http.converter.HttpMessageNotWritableException: No ...

  5. idea中@data不生效

    idea中@data不生效,原因是idea中没有安装插件,记得重启

  6. centos6.5+jdk1.7+mysql5.6+tomcat8.0部署jpress

    前言:此篇记录在linux下搭建环境部署jpress,mysql使用的是源码安装 1.准备 2.安装 3.部署 1.准备 a.准备centos6.5服务器环境 mysql-5.6.19.tar.gz  ...

  7. windows7如何用键盘模拟鼠标操作

    windows7如何用键盘模拟鼠标操作 https://jingyan.baidu.com/article/6dad5075104907a123e36e38.html 听语音 37453人看了这个视频 ...

  8. laravel 中 同个主域名下,多个项目共享session登录状态

    共享session的前提是session在一个公共的地方,比如database,redis等,laravel框架提供了很大驱动选择: 这里只需要在配置文件里配置三个地方即可 'driver' => ...

  9. 【MM系列】SAP 创建工厂

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[MM系列]SAP 创建工厂   前言部分 大家 ...

  10. linux/linux学习笔记-初识linux(mooc)

    一.linux简介 linux版本:内核版本和发行版本 linux企业应用: 1.基于linux的企业服务器 2.linux在嵌入式领域应用 android底层Linux : ios底层unix li ...