Redis集群搭建(单机集群)

article/2025/11/5 5:14:00

 链接:https://pan.baidu.com/s/1IczvAUFhNz23xvCjlTiI_A?pwd=ruge

  1. Redis入门篇
    https://blog.csdn.net/tongxin_tongmeng/article/details/126620333
  2. 集群配置文件(3主3从)
    1.复制/home/redis/redis-7.0.4/redis.conf到/home/redis/workspace/cluster_one
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7001.conf
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7002.conf
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7003.conf
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7004.conf
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7005.conf
    cp /home/redis/redis-7.0.4/redis.conf /home/redis/workspace/cluster_one/redis_7006.conf2.编辑/home/redis/workspace/cluster_one/redis_7001.conf
    设置服务端口:port 7001
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7001.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7001.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7001.conf
    集群超时时间:cluster-node-timeout 50003.编辑/home/redis/workspace/cluster_one/redis_7002.conf
    设置服务端口:port 7002
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7002.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7002.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7002.conf
    集群超时时间:cluster-node-timeout 50004.编辑/home/redis/workspace/cluster_one/redis_7003.conf
    设置服务端口:port 7003
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7003.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7003.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7003.conf
    集群超时时间:cluster-node-timeout 50005.编辑/home/redis/workspace/cluster_one/redis_7004.conf
    设置服务端口:port 7004
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7004.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7004.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7004.conf
    集群超时时间:cluster-node-timeout 50006.编辑/home/redis/workspace/cluster_one/redis_7005.conf
    设置服务端口:port 7005
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7005.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7005.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7005.conf
    集群超时时间:cluster-node-timeout 50007.编辑/home/redis/workspace/cluster_one/redis_7006.conf
    设置服务端口:port 7006
    解除本机绑定:# bind 127.0.0.1 -::1
    守护方式启动:daemonize yes
    设置pid路径:pidfile /home/redis/workspace/cluster_one/redis_7006.pid
    设置存储路径:dir /home/redis/workspace/cluster_one
    设置连接密码:requirepass 123456
    AOF方式持久化:appendonly yes
    AOF存储文件名:appendfilename "appendonly_7006.aof"
    AOF持久化策略:appendfsync always
    开启集群:cluster-enabled yes
    集群Node名称:luster-config-file nodes_7006.conf
    集群超时时间:cluster-node-timeout 5000

  3. 创建集群

    1.启动redis服务
    redis-server /home/redis/workspace/cluster_one/redis_7001.conf
    redis-server /home/redis/workspace/cluster_one/redis_7002.conf
    redis-server /home/redis/workspace/cluster_one/redis_7003.conf
    redis-server /home/redis/workspace/cluster_one/redis_7004.conf
    redis-server /home/redis/workspace/cluster_one/redis_7005.conf
    redis-server /home/redis/workspace/cluster_one/redis_7006.conf2.创建集群
    redis-cli -a 123456 --cluster create --cluster-replicas 1 192.168.1.4:7001 192.168.1.4:7002 192.168.1.4:7003 192.168.1.4:7004 192.168.1.4:7005 192.168.1.4:7006
    注意:前3个为主节点,后3个为从节点,创建命令只执行一次,重启集群只需要重启redis服务
    

  4. 启动集群

    redis-server /home/redis/workspace/cluster_one/redis_7001.conf
    redis-server /home/redis/workspace/cluster_one/redis_7002.conf
    redis-server /home/redis/workspace/cluster_one/redis_7003.conf
    redis-server /home/redis/workspace/cluster_one/redis_7004.conf
    redis-server /home/redis/workspace/cluster_one/redis_7005.conf
    redis-server /home/redis/workspace/cluster_one/redis_7006.conf

  5. 关闭集群

    1.方式一:redis-cli命令关闭集群(推荐)
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7001 shutdown
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7002 shutdown
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7003 shutdown
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7004 shutdown
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7005 shutdown
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7006 shutdown2.方式二:根据进程号关闭集群(方便)
    ps -ef | grep -i redis
    kill -9 102629 102631 102637 102643 102649 102694


  6. 登录集群

    1.登录集群不同的客户端
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7001
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7002
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7003
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7004
    redis-cli -a 123456 -c -h 192.168.1.4 -p 7005
    redis-cli -a 123456 -c -h 192.168.1.4 -p 70062.客户端切换时需要先退出:quit

  7. 集群信息

  8. 数据备份、恢复


http://chatgpt.dhexx.cn/article/t2cUruyC.shtml

相关文章

redis集群搭建(非常详细,适合新手)

redis集群搭建 在开始redis集群搭建之前,我们先简单回顾一下redis单机版的搭建过程 下载redis压缩包,然后解压压缩文件;进入到解压缩后的redis文件目录(此时可以看到Makefile文件),编译redis源文件&#…

centos7 redis集群搭建

redis集群搭建 1 先安装6台redis服务 1 这里使用三台节点 10.0.11.54 10.0.11.56 10.0.11.57,每台节点安装2个redis服务,通过不同的端口号区分 2 复制redis.conf 两份,redis-6479.con redis-6480.conf 将cluster-enabled yes 的注释打开,将 …

Redis集群搭建linux

一、什么是Redis集群 Redis集群是为了能够解决一台主服务器容量不足或者是出现高并发写操作时性能不足的问题,Redis集群就是将多台主服务器进行连接以实现多台主服务器数据同步和共享。 每个Redis集群一共有16384个插槽,这16384个插槽将会被平均分配给群…

Redis 集群搭建

一、redis安装 下载地址:http://redis.io/download 安装步骤: # 安装gcc yum install gcc # 把下载好的redis-5.0.2.tar.gz放在/usr/local文件夹下,并解压wget http://download.redis.io/releases/redis-5.0.2.tar.gz tar xzf redis-5.0…

Redis集群搭建【超详细】

有问题可以关注公众号:提着月亮去火星 一、基本环境 首先我们需要使用VMware配置几个虚拟机,我们需要安装VMWare然后 下载自己的linux镜像文件,在虚拟机上安装linux系统, vm15和centos7下载传送门 提取码: lvb5 。…

redis集群搭建

注意:本测试,基于redis 5.0.7来搭建,redis 4 版本的搭建和redis 5 会有区别 2.修改各个主机 redis.conf 配置文件的配置 按照下图的,几处要求修改: #关闭保护模式,用于公网访问 protected-mode no port…

集群搭建(Redis)(超详细)

集群介绍: Redis 集群实现了对Redis的水平扩容,即启动N个redis节点,将整个数据库分布存储在这N个节点中,每个节点存储总数据的1/N。 Redis 集群通过分区(partition)来提供一定程度的可用性(av…

redis集群的搭建

redis单机版,出现单机故障后,导致redis无法使用,如果程序使用 redis,间接导致程序出错。 redis集群的搭建方式一共有三种:主从复制模式,哨兵模式和主从模式。哨兵模式是对主从模式的一种补充,而…

springboot整合Redis哨兵

1.1SpringBoot整合Redis哨兵 1.1.1入门案例 /*** 哨兵测试* 1.配置redis的节点数据集合* 2.利用哨兵机制连接redis节点.* 3.用户通过哨兵 实现缓存操作.* * 参数1: masterName*/ Test public void testSentinel() {//配置哨兵的信息Set<String> sentinels new Ha…

Redis集群搭建的三种方式

一、Redis主从 1.1 Redis主从原理 和MySQL需要主从复制的原因一样&#xff0c;Redis虽然读取写入的速度都特别快&#xff0c;但是也会产生性能瓶颈&#xff0c;特别是在读压力上&#xff0c;为了分担压力&#xff0c;Redis支持主从复制。Redis的主从结构一主一从&#xff0c;一…

Redis集群搭建(非常详细)

https://blog.csdn.net/qq_42815754/article/details/82912130 redis集群搭建 在开始redis集群搭建之前&#xff0c;我们先简单回顾一下redis单机版的搭建过程 下载redis压缩包&#xff0c;然后解压压缩文件&#xff1b; 进入到解压缩后的redis文件目录&#xff08;此时可以看…

什么是TCN?

TCN&#xff08;Two-way communication network&#xff09;即双向通信网络。使用socks5技术&#xff0c;通过特定的中转服务器完成数据传输。 在服务器端部署完成后&#xff0c;用户需要按照指定的密码、加密方式和端口使用客户端软件与其连接。在成功连接到服务器后&#xff…

MS-TCN: Multi-Stage Temporal Convolutional Network for Action Segmentation

论文题目&#xff1a;Multi-Stage Temporal Convolutional Network for Action Segmentation 原文地址&#xff1a;https://arxiv.org/abs/1903.01945 这篇文章涉及的是视频的行为分割问题&#xff08;Action Segmentation&#xff09;&#xff0c;也就是对视频&#xff08;vi…

TCN时间卷积网络介绍

绪论 TCN, Temporal Convolutional Network,时间卷积网络&#xff0c;是一种能够处理时间序列数据的网络结构&#xff0c;论文还评为 2018年10大论文。 1. 模型 输入&#xff1a; x 0 , x 1 , . . . , x t {x_0, x_1,..., x_t} x0​,x1​,...,xt​ 输出&#xff1a; y 0 , …

TCN: TEMPORAL CONVOLUTIONAL NETWORKS

搬运自&#xff1a;Raushan Roy-TEMPORAL CONVOLUTIONAL NETWORKS Learning sequences efficiently and effectively Until recently the default choice for sequence modeling task was RNNs because of their great ability to capture temporal dependencies in sequenti…

【深度学习论文阅读】TCN:An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence

2018年人工智能十佳论文之一&#xff1a;TCN 论文地址&#xff1a;An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling 项目地址&#xff1a;TCN的github链接 文章目录 1. ABSTRACT2. INTRODUCTION & BACKGROUND2.1 Temporal…

wavenet及TCN

一切皆卷积——包括时序相关任务 1.wavenet1.1 wavenet的pytorch实现1.1.1 wavenet类1.1.2 ResidualConv1dGLU 1.2 wavenet在纳米孔测序中的应用 2.Temporal Convolutional Network&#xff08;TCN&#xff09;2.1 TCN模型介绍2.3 TCN代码实现及可视化 3.wavenet/TCN的优点参考…

时序模型(一)—— TCN 时间卷积网络

一、 概述 TCN是18年提出的时序卷积神经网络模型。 时序问题建模&#xff0c;通常采用RNN循环神经网络及其相关变种&#xff0c;比如LSTM、GRU等&#xff0c;这里将卷积神经网络通过膨胀卷积达到抓取长时依赖信息的效果&#xff0c;TCN在一些任务上甚至能超过RNN相关模型。 …

【学习日志】【TCN】时间序列卷积神经网络(1)

1. ask bing&#xff08;Temporal Convolutional Network&#xff09; 问&#xff1a;“我对CNN、RNN、TCN等神经网络没有任何基础&#xff0c;你能直观地给我讲一下TCN的结构、输入输出和原理吗&#xff1f;” bing对TCN的解释如下&#xff1a; TCN是一种用于处理序列数据的神…

LSTM的备胎,用卷积处理时间序列——TCN与因果卷积(理论+Python实践)

什么是TCN TCN全称Temporal Convolutional Network&#xff0c;时序卷积网络&#xff0c;是在2018年提出的一个卷积模型&#xff0c;但是可以用来处理时间序列。 卷积如何处理时间序列 时间序列预测&#xff0c;最容易想到的就是那个马尔可夫模型&#xff1a; P ( y k ∣ x…