redis集群重启分为两步
一、关闭集群节点,删除垃圾数据。
二、启动各节点,创建集群。

一、关闭集群节点,删除垃圾数据

1、查看redis进程

[root@localhost redis-5.0.4]# ps -ef | grep redis
root     31794     1  0 10:23 ?        00:00:00 redis-server *:7001 [cluster]
root     31799     1  0 10:23 ?        00:00:00 redis-server *:7002 [cluster]
root     31804     1  0 10:23 ?        00:00:00 redis-server *:7003 [cluster]
root     31809     1  0 10:23 ?        00:00:00 redis-server *:7004 [cluster]
root     31814     1  0 10:23 ?        00:00:00 redis-server *:7005 [cluster]
root     31819     1  0 10:24 ?        00:00:00 redis-server *:7000 [cluster]
root     31861 31756  0 10:38 pts/0    00:00:00 grep --color=auto redis

2、关闭进程

[root@localhost redis-5.0.4]# kill -9 31794
[root@localhost redis-5.0.4]# kill -9 31799
[root@localhost redis-5.0.4]# kill -9 31804
[root@localhost redis-5.0.4]# kill -9 31809
[root@localhost redis-5.0.4]# kill -9 31814
[root@localhost redis-5.0.4]# kill -9 31819

3、删除历史垃圾数据

在redis的根目录、redis的src子目录中,均执行如下命令:

[root@localhost redis-5.0.4]# rm -rf appendonly.aof
[root@localhost redis-5.0.4]# rm -rf dump.rdb
[root@localhost redis-5.0.4]# rm -rf nodes-*.*
[root@localhost src]# rm -rf appendonly.aof
[root@localhost src]# rm -rf dump.rdb
[root@localhost src]# rm -rf nodes-*.*

二、启动各节点,创建集群

1、逐一启动节点

在redis根目录的src文件夹中,执行如下命令。
(其中/home/cluster-config/redis-5.0.4为conf文件所在路径,根据实际情况来写。)

[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7001.conf

当出现如下界面,代表该节点进程启动成功
(如果没出现下述代码,使用命令 ps -ef | grep redis 查看进程7001,启动成功即可)

[root@localhost src]# redis-server /home/cluster-config/redis-7001.conf
31863:C 09 Apr 2021 10:39:30.752 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31863:C 09 Apr 2021 10:39:30.752 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31863, just started
31863:C 09 Apr 2021 10:39:30.752 # Configuration loaded

参照上述步骤,启动其他节点

[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7001.conf
31863:C 09 Apr 2021 10:39:30.752 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31863:C 09 Apr 2021 10:39:30.752 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31863, just started
31863:C 09 Apr 2021 10:39:30.752 # Configuration loaded
[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7000.conf
31868:C 09 Apr 2021 10:39:34.964 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31868:C 09 Apr 2021 10:39:34.964 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31868, just started
31868:C 09 Apr 2021 10:39:34.964 # Configuration loaded
[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7002.conf
31873:C 09 Apr 2021 10:39:38.254 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31873:C 09 Apr 2021 10:39:38.254 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31873, just started
31873:C 09 Apr 2021 10:39:38.254 # Configuration loaded
[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7003.conf
31878:C 09 Apr 2021 10:39:41.368 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31878:C 09 Apr 2021 10:39:41.368 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31878, just started
31878:C 09 Apr 2021 10:39:41.368 # Configuration loaded
[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7004.conf
31883:C 09 Apr 2021 10:39:45.240 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31883:C 09 Apr 2021 10:39:45.240 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31883, just started
31883:C 09 Apr 2021 10:39:45.240 # Configuration loaded
[root@localhost src]# redis-server /home/cluster-config/redis-5.0.4/redis-7005.conf
31888:C 09 Apr 2021 10:39:48.042 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
31888:C 09 Apr 2021 10:39:48.042 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=31888, just started
31888:C 09 Apr 2021 10:39:48.042 # Configuration loaded

所有节点启动完成后,使用命令查看进程启动情况

[root@localhost src]# ps -ef | grep redis
root     31794     1  0 10:23 ?        00:00:00 redis-server *:7001 [cluster]
root     31799     1  0 10:23 ?        00:00:00 redis-server *:7002 [cluster]
root     31804     1  0 10:23 ?        00:00:00 redis-server *:7003 [cluster]
root     31809     1  0 10:23 ?        00:00:00 redis-server *:7004 [cluster]
root     31814     1  0 10:23 ?        00:00:00 redis-server *:7005 [cluster]
root     31819     1  0 10:24 ?        00:00:00 redis-server *:7000 [cluster]
root     31861 31756  0 10:38 pts/0    00:00:00 grep --color=auto redis

2、创建集群

在redis根目录的src文件夹中,执行如下命令。
1)111111是redis的密码。
2)cluster-replicas 1,表示1个从节点

redis-cli -a 111111 --cluster create 192.168.201.1:7000 192.168.201.1:7001 192.168.201.1:7002 192.168.201.1:7003 192.168.201.1:7004 192.168.201.1:7005 --cluster-replicas 1

over~

Linux redis集群重启相关推荐

  1. Linux Redis集群搭建与集群客户端实现

    硬件环境 本文适用的硬件环境如下 Linux版本:CentOS release 6.7 (Final) Redis版本:3.2.1 Redis已经成功安装,安装路径为/home/idata/yangf ...

  2. linux redis集群搭建

    假设你有6台服务器,ip地址分别为192.168.1.1  192.168.1.2  192.168.1.3  192.168.1.4   192.168.1.5  192.168.1.6 一.首先, ...

  3. 搭建redis集群-(伪分布式)

    安装redis #关闭防火墙并且安装iptables(防火墙) 并在防火墙中添加规则,也可以用firewalld.service 防火墙 #如果是用firewalld.service 的防火墙的话下面 ...

  4. (六)Redis集群搭建

    1. 原理 redis cluster在设计的时候,就考虑到了去中心化,去中间件,也就是说,集群中的每个节点都是平等的关系,都是对等的,每个节点都保存各自的数据和整个集群的状态.每个节点都和其他所有节 ...

  5. linux redis-trib.rb,linux 关于redis-trib.rb构建redis集群

    之前搭建集群漏下的坑, 今次再搭一次. 环境 ruby环境 yum install ruby rubygems -y redis的gem环境 gem install redis-3.2.2.gem 部 ...

  6. Redis集群环境之linux搭建多机版---已完结,跟着一步一步来你就可以集群成功

    上一篇踩着各种坑写了Redis集群环境之linux搭建单机版,这一篇准备就多机版集群进行搭建,主要目的一来是在上一篇的基础上进行精华提粹总结,二来是把单机版与多机版的区别进行记录. 首先软硬件环境: ...

  7. LINUX安装REDIS集群

    linux安装单机版redis已经在另一篇文章说过了,下边来搞集群,环境是新浪云服务器: redis3.0以后开始支持集群. 前言:redis用什么做集群? 用一个叫redis-trib.rb的rub ...

  8. linux部署redis集群遇到的问题

    版本信息: redis:5.0.8 linux服务器:CentOS 7 不同版本问题处理方式可能有所不同 1.在java程序中,连接不上redisCluster. 报错信息: no reachable ...

  9. Linux中的redis集群搭建

    看在多的书,若果不实践一次,我觉得效果并不好,只有自己完完整整的做一次! 所以今天打算搭建一个redis集群来练练手~! 1.Linux CentOS  , redis-3.2.4 版本 2.配置环境 ...

最新文章

  1. 工作发狂:Mybatis 中$和#千万不要乱用!
  2. 告诉你,Spring Boot 真是个牛逼货!
  3. 中国法院裁定:禁售部分型号苹果手机
  4. oracle dba_seg,Oracle DBA 应知应会 -- PGA自动管理
  5. ubuntu上Nginx的HTTPS enablement
  6. 如何判断一条曲线是否自己相交?
  7. JedisConnectionException: java.Net.SocketTimeoutException: Read timed
  8. stl vector 函数_vector :: crbegin()函数,以及C ++ STL中的示例
  9. 订单编号的数据类型是什么_领域模型与代数数据类型(第三期)
  10. 黄冈中学首页布局(自己做的)
  11. Facebook是如何大幅提升TLS连接效率的?
  12. 第八章 深度强化学习-Nature深度Q网络(Nature DQN)
  13. List集合排序(Lambda表达式)
  14. css中的单位换算_GitHub - WangQiangrong/cssUnitTransform: css单位转换工具
  15. RHCE-ansible第二次实验,通过ansible远程yum安装
  16. 使用百度siteapp开发网站的App-(IOS和Android版本)
  17. 华为/荣耀 笔记本 HiboardDataReport.exe应用程序错误
  18. Python 实现分离GIF图片,-pillow
  19. 使用PHP的http请求客户端guzzle如何添加请求头
  20. 解决办法: Cannot resolve the collation conflict between Japanese_CI_AS and SQL_...

热门文章

  1. 网络流--最小费用最大流 (理解)
  2. 归并排序过程实现c语言,C语言归并排序详解
  3. 软件设计师通关宝典(有这一个就够了!)
  4. 朗读软件文字转语音怎么弄?推荐三个好用的软件
  5. 小技巧:安装Linux的五种方法和心得(转)
  6. mysql数据库备份自动备份_设置mysql数据库自动备份
  7. Python 自动化工具pyautogui 安装过程详解
  8. Redis 有哪些应用场景?
  9. 报表中引入图片并导出
  10. AOP是什么?如何使用AOP?