之前写过一套基于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. 使用Zabbix通过ILO管理口监控惠普服务器

    https://blog.csdn.net/qq_41571056/article/details/82928542

  2. 构造Map并对其排序

    #构造Map并对其排序 attr_tul = ['a','b','c','d','e','f'] one_tul = [,,,,,] one_dic = {} for i in range(len(a ...

  3. Delphi加密解密算法

    // 加密方法一(通过密钥加密解密)function EncryptString(Source, Key: string): string;function UnEncryptString(Sourc ...

  4. 【Spring】---属性注入

    一.Spring注入属性(有参构造和[set方法]) 注意:在Spring框架中只支持set方法.有参构造方法这两种方法. 使用有参数构造方法注入属性(用的不多,但需要知道): 实体类 package ...

  5. Golang基础(3):数组,切片和字典

    一:数组 数组是一个具有相同类型元素,固定长度的有序集合,一般定义如下:var x [5]int表示数组是一个整数型数组,长度为5数组的几种定义方式 a: var来定义数组,然后依次赋值 packag ...

  6. 安卓和IOS抓包工具

    安卓手机抓包软件:Packet Capture,抓包精灵…… 1.Packet Capture又名无root抓包(一款依托安卓系统自身VPN来达到免Root抓取数据包的应用程序) 功能特点: 捕获网络 ...

  7. 如何用katalon录制回放一个web UI测试—— katalon学习笔记(四)

    ,首先打开katanlon,进入到katalon主界面,选择点击file->new->project ,在创建新项目弹出框中Name输入项输入项目的名称:Type选择web,也就是你要测试 ...

  8. paramiko远程连接linux服务器进行上传下载文件

    花了不少时间来研究paramiko中sftpclient的文件传输,一顿操作猛如虎,最后就一直卡在了路径报错问题,疯狂查阅资料借鉴大佬们的心得,还是搞不好,睡了个午觉醒来,仔细一看原来是指定路径的文件 ...

  9. Go语言入门篇-基本类型排序和 slice 排序

    参见博客:https://blog.csdn.net/u010983881/article/details/52460998 package main import ( "sort" ...

  10. python+selenium浏览器截图

    from selenium import webdriverfrom time import sleep driver = webdriver.Firefox() # 指定和打开浏览器driver.g ...