iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >Redis 5.02官方集群的搭建过程
  • 458
分享到

Redis 5.02官方集群的搭建过程

2024-04-02 19:04:59 458人浏览 八月长安
摘要

这篇文章主要介绍“Redis 5.02官方集群的搭建过程”,在日常操作中,相信很多人在Redis 5.02官方集群的搭建过程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Re

这篇文章主要介绍“Redis 5.02官方集群的搭建过程”,在日常操作中,相信很多人在Redis 5.02官方集群的搭建过程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Redis 5.02官方集群的搭建过程”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

1、下载安装Redis

# wget Http://download.redis.io/releases/redis-stable.tar.gz
# tar xfz redis-stable.tar.gz
# cd redis-stable
# make
# 设置命令执行路径
# cat ~/.bash_profile
PATH=$PATH:$HOME/bin:/data/redis-stable/src

2、创建集群的数据目录和配置文件

在两台服务器上面,要创建6个redis实例(三主三从),每个服务器,分布创建3个数据目录和3个配置文件。

集群主节点

10.152.5.12:7000

10.152.5.12:7001

10.153.115.24:7003

集群从节点

10.152.5.12:7002

10.153.115.24:7004

10.153.115.24:7005

# 10.152.5.12
# 创建数据目录
# mkdir redis_cluster
# cd redis_cluster
# mkdir 7000 7001 7002
# 创建配置文件
# cd 7000
# grep -v "^#" redis_7000.conf
protected-mode no
port 7000
daemonize yes
supervised no
pidfile /var/run/redis_7000.pid
loglevel notice
logfile "/data/redis_cluster/redis_7000.log"
dir ./
appendonly yes
cluster-enabled yes
cluster-config-file nodes_7000.conf
cluster-node-timeout 5000
# 启动服务
redis-server /data/redis_cluster/7000/redis_7000.conf &
# 10.152.5.12
# mkdir redis_cluster
# cd redis_cluster
# mkdir 7003 7004 7005

3、初始化集群

# redis-cli --cluster create 10.152.5.12:7000 10.152.5.12:7001 10.153.115.24:7003 10.152.5.12:7002 10.153.115.24:7004 10.153.115.24:7005  --cluster-replicas 1
>>> PerfORMing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 10.153.115.24:7004 to 10.152.5.12:7000
Adding replica 10.152.5.12:7002 to 10.153.115.24:7003
Adding replica 10.153.115.24:7005 to 10.152.5.12:7001
M: 65dba2ed08ecb139589710f9efdfd7eeacbb3775 10.152.5.12:7000
   slots:[0-5460] (5461 slots) master
M: 08e714061bdb817c23c72f1e5c9a72ab878a0c8f 10.152.5.12:7001
   slots:[10923-16383] (5461 slots) master
M: 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 10.153.115.24:7003
   slots:[5461-10922] (5462 slots) master
S: 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 10.152.5.12:7002
   replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4
S: c33f01a81258077f3D6cd5f97c91a85225279bff 10.153.115.24:7004
   replicates 65dba2ed08ecb139589710f9efdfd7eeacbb3775
S: 18092c18796972c26785a9cfa408cb3a52107818 10.153.115.24:7005
   replicates 08e714061bdb817c23c72f1e5c9a72ab878a0c8f
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.152.5.12:7000)
M: 65dba2ed08ecb139589710f9efdfd7eeacbb3775 10.152.5.12:7000
   slots:[0-5460] (5461 slots) master
   1 additional replica(s)
S: c33f01a81258077f3d6cd5f97c91a85225279bff 10.153.115.24:7004
   slots: (0 slots) slave
   replicates 65dba2ed08ecb139589710f9efdfd7eeacbb3775
S: 18092c18796972c26785a9cfa408cb3a52107818 10.153.115.24:7005
   slots: (0 slots) slave
   replicates 08e714061bdb817c23c72f1e5c9a72ab878a0c8f
M: 08e714061bdb817c23c72f1e5c9a72ab878a0c8f 10.152.5.12:7001
   slots:[10923-16383] (5461 slots) master
   1 additional replica(s)
S: 030fc4d0e02bb7f8245b0bbecf428066daf23a7a 10.152.5.12:7002
   slots: (0 slots) slave
   replicates 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4
M: 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4 10.153.115.24:7003
   slots:[5461-10922] (5462 slots) master
   1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

查看进程和日志

# ps -ef|grep redis
root     32071 23964 18 11:01 pts/0    00:09:31 redis-server *:7003 [cluster]
root     32120 23964  1 11:02 pts/0    00:00:42 redis-server *:7004 [cluster]
root     32165 23964  1 11:03 pts/0    00:00:41 redis-server *:7005 [cluster]
root     34550 32071  0 11:39 pts/0    00:00:00 redis-aof-rewrite *:7003 [cluster]
# tail redis_7003.log
30922:M 07 Dec 2018 10:41:38.391 * Ready to accept connections
32071:C 07 Dec 2018 11:01:32.731 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
32071:C 07 Dec 2018 11:01:32.731 # Redis version=5.0.2, bits=64, commit=00000000, modified=0, pid=32071, just started
32071:C 07 Dec 2018 11:01:32.731 # Configuration loaded
32071:M 07 Dec 2018 11:01:32.733 * Node configuration loaded, I'm 7a0a2c7b7778467fa6d5d2d5cab52ad35aa77bf4
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.2 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in cluster mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 7003
 |    `-._   `._    /     _.-'    |     PID: 32071
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               
32071:M 07 Dec 2018 11:01:32.734 # WARNING: The tcp backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
32071:M 07 Dec 2018 11:01:32.734 # Server initialized
32071:M 07 Dec 2018 11:01:32.734 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
32071:M 07 Dec 2018 11:01:32.734 * Ready to accept connections
32071:M 07 Dec 2018 11:06:15.060 # configEpoch set to 3 via CLUSTER SET-CONFIG-EPOCH
32071:M 07 Dec 2018 11:06:15.116 # IP address for this node updated to 10.153.115.24
32071:M 07 Dec 2018 11:06:18.146 * Replica 10.152.5.12:7002 asks for synchronization
32071:M 07 Dec 2018 11:06:18.146 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'b8db3eb5c491ab9e2ff92de627925a93105DDD96', my replication IDs are '054964ff1a25320ff6d97c24594f2683e30d43c0' and '0000000000000000000000000000000000000000')
32071:M 07 Dec 2018 11:06:18.146 * Starting BGSAVE for SYNC with target: disk
32071:M 07 Dec 2018 11:06:18.146 * Background saving started by pid 32349
32349:C 07 Dec 2018 11:06:18.147 * DB saved on disk
32349:C 07 Dec 2018 11:06:18.148 * RDB: 0 MB of memory used by copy-on-write
32071:M 07 Dec 2018 11:06:18.196 * Background saving terminated with success
32071:M 07 Dec 2018 11:06:18.196 * Synchronization with replica 10.152.5.12:7002 succeeded
32071:M 07 Dec 2018 11:06:20.001 # Cluster state changed: ok
32071:M 07 Dec 2018 11:31:25.118 * 1 changes in 900 seconds. Saving...
32071:M 07 Dec 2018 11:31:25.118 * Background saving started by pid 33740
33740:C 07 Dec 2018 11:31:25.119 * DB saved on disk
33740:C 07 Dec 2018 11:31:25.120 * RDB: 0 MB of memory used by copy-on-write
32071:M 07 Dec 2018 11:31:25.218 * Background saving terminated with success
32071:M 07 Dec 2018 11:31:37.418 * Starting automatic rewriting of AOF on 6722641000% growth
32071:M 07 Dec 2018 11:31:37.418 * Background append only file rewriting started by pid 33751
32071:M 07 Dec 2018 11:31:38.420 * AOF rewrite child asks to stop sending diffs.
33751:C 07 Dec 2018 11:31:38.420 * Parent agreed to stop sending diffs. Finalizing AOF...
33751:C 07 Dec 2018 11:31:38.420 * Concatenating 5.25 MB of AOF diff received from parent.

到此,关于“Redis 5.02官方集群的搭建过程”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程网网站,小编会继续努力为大家带来更多实用的文章!

您可能感兴趣的文档:

--结束END--

本文标题: Redis 5.02官方集群的搭建过程

本文链接: https://www.lsjlt.com/news/60477.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Redis 5.02官方集群的搭建过程
    这篇文章主要介绍“Redis 5.02官方集群的搭建过程”,在日常操作中,相信很多人在Redis 5.02官方集群的搭建过程问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Re...
    99+
    2024-04-02
  • redis集群搭建的方法
    这篇文章主要介绍redis集群搭建的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!redis集群搭建在介绍正式内容之前,首先我们来介绍一下redis单机版的搭建步骤是怎样的。下载...
    99+
    2024-04-02
  • redis搭建集群的方法
    这篇文章给大家分享的是有关redis搭建集群的方法的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。redis集群的搭建集群搭建:Redis集群至少需要3个节点第一步:创建一个文件夹...
    99+
    2024-04-02
  • 搭建Redis集群的方法
    这篇文章主要讲解了“搭建Redis集群的方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“搭建Redis集群的方法”吧!Redis集群是一个由多个主从节点群组成的分布式服务集群,它具有复制、...
    99+
    2023-06-27
  • greenplum集群的搭建过程
    本篇内容主要讲解“greenplum集群的搭建过程”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“greenplum集群的搭建过程”吧!环境说明本次环境一共四台虚拟机,一台为master,三台为s...
    99+
    2023-06-02
  • Redis6.0搭建集群Redis-cluster的方法
    此处以三台服务器部署为例,IP地址分别为192.168.124.23,192.168.124.24,192.168.124.25 使用普通用户ubuntu登录 总共三个主节点和三个从...
    99+
    2024-04-02
  • windows下搭建redis集群的方法
    小编给大家分享一下windows下搭建redis集群的方法,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!前言:集群是指通过添加服...
    99+
    2024-04-02
  • Redis集群搭建的三种方式
    Redis集群搭建的三种方式@TOC 1.Redis主从 1.1 Redis主从原理 和MySQL需要主从复制的原因一样,Redis虽然读取写入的速度都特别快,但是也会产生性能瓶颈,特别是在读压力上,...
    99+
    2023-09-15
    redis java linux
  • k8s部署redis集群搭建过程示例详解
    目录写在前面一、redis集群搭建1.1使用redis-cli创建集群1.2redis集群状态验证(可选)1.3重启pod,验证集群(可选)1.4创建Service服务1.5 Spr...
    99+
    2023-02-21
    k8s部署搭建redis集群 k8s redis集群搭建
  • Redis集群搭建的方式有哪些
    这篇文章主要介绍Redis集群搭建的方式有哪些,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!一、单节点实例单节点实例还是比较简单的,平时做个测试,写个小程序如果需要用到缓存的话,启动一个Redis 还是很轻松的,做为...
    99+
    2023-06-15
  • redis集群搭建的方法是什么
    要搭建Redis集群,可以按照以下步骤进行操作:1. 准备多台服务器,每台服务器上都安装Redis。2. 在每台服务器上的Redis...
    99+
    2023-09-09
    redis
  • redis集群如何搭建
    这篇文章给大家分享的是有关redis集群如何搭建的内容。小编觉得挺实用的,因此分享给大家做个参考。一起跟随小编过来看看吧。介绍安装环境与版本用两台虚拟机模拟6个节点,一台机器3个节点,创建出3 master...
    99+
    2024-04-02
  • 如何搭建redis集群
    这篇文章主要讲解了“如何搭建redis集群”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何搭建redis集群”吧!redis集群搭建在开始redis集群搭建之前,我们先简单回顾一下redi...
    99+
    2023-06-25
  • mongodb linux下集群搭建过程
    mongodb的集群结构如上图 网上有个mongo3.0的集群例子: https://www.jb51.net/article/191388.htm router提供入口,mong...
    99+
    2024-04-02
  • Nacos集群搭建过程详解
    目录1.集群结构图2.搭建集群2.1.初始化数据库2.2.下载nacos2.3.配置Nacos2.4.启动2.5.nginx反向代理2.6.优化1.集群结构图 官方给出的Nacos集...
    99+
    2024-04-02
  • redis集群搭建过程(非常详细,适合新手)
    目录redis集群搭建一、Redis Cluster(Redis集群)简介二、集群搭建需要的环境 三、集群搭建具体步骤如下(注意要关闭防火墙) 四、结语 redis集群搭建 在开始r...
    99+
    2024-04-02
  • Redis自动化安装及集群实现搭建过程
    Redis实例安装 安装说明:自动解压缩安装包,按照指定路径编译安装,复制配置文件模板到Redis实例路的数据径下,根据端口号修改 配置文件模板 配置文件,当前shell脚本,安装包 参数1:base...
    99+
    2024-04-02
  • Windows下搭建Redis集群的方法步骤
    目录Redis集群:在Windows系统下搭建Redis集群:1.下载并安装Redis2.下载并安装ruby3.创建Redis集群Redis集群: 如果部署到多台电脑,就跟普通的集群...
    99+
    2024-04-02
  • docker怎么搭建redis集群
    要搭建Redis集群,可以使用Docker来简化部署过程。下面是一些搭建Redis集群的步骤: 首先,确保已经安装了Docker...
    99+
    2023-10-26
    docker redis
  • 详解Redis集群搭建的三种方式
    目录一、单节点实例二、主从模式(master/slaver)三、sentinel 模式四、cluster 模式一、单节点实例 单节点实例还是比较简单的,平时做个测试,写个小程序如果需...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作