redis-sentinel

C#两大知名Redis客户端连接哨兵集群的姿势

戏子无情 提交于 2020-04-17 08:28:24
【推荐阅读】微服务还能火多久?>>> 原文: C#两大知名Redis客户端连接哨兵集群的姿势 前言 前面利用《Docker-Compose搭建Redis高可用哨兵集群》, 我们的思路是将Redis、Sentinel、Redis Client App链接到同一个网桥网络,这个网桥内的Redis Client App就可以使用ContainerIP访问网桥内任意redis节点。 同一网桥网络访问 规避了Docker上发生的NAT,端口映射的复杂性, 但实际上并不是最常规的做法(今天咱们也不说Docker host形式部署Redis-Sentinel了)。 Redis Client App独立组网遇到的问题 很多时候,Redis-Sentinel与Redis Client App独立组网,涉及Docker宿主机NAT转换和 Port映射。 Sentinel,Docker或其他形式的网络地址转换或端口映射应谨慎混合。 我实际测试发现,如果将前文Sentinel.conf中Master(ContainerIP,Port) 换成(宿主机IP,映射Port), 确实会引起混乱,无法找到正确的Slaves, 无法正常故障转移。 为了解决Redis-Sentinel在Docker环境下因为NAT,Forward Port导致的无法正确获知Slaves和正确故障转移的问题。 Redis3.2之后可以

利用Docker搭建Redis集群

和自甴很熟 提交于 2020-04-17 01:07:12
【推荐阅读】微服务还能火多久?>>> Redis集群搭建 运行Redis镜像 分别使用以下命令启动3个Redis docker run --name redis-6379 -p 6379:6379 -d hub.c.163.com/library/redis docker run --name redis-6380 -p 6380:6379 -d hub.c.163.com/library/redis docker run --name redis-6381 -p 6381:6379 -d hub.c.163.com/library/redis 使用 docker ps 命令,查看是否启动成功 配置Redis集群 分别使用 dokcer inspect 容器ID 命令,查看3个Redis内网IP地址 在Networks栏,可以看见该容器的Docker内网IP地址。 redis-6379:172.17.0.2:6379 redis-6380:172.17.0.3:6379 redis-6381:172.17.0.4:6379 进入Docker容器内部 使用redis-6379为主机,其余两台为从机 使用 docker exec -ti 容器ID /bin/bash 分别进入三个Redis容器 进入容器后,使用 redis-cli 命令,连接redis服务端 连接服务后,使用 info

Redis 主从切换的集群管理

亡梦爱人 提交于 2020-04-12 18:00:52
Redis单点时,当一台机器挂机了,redis的服务完全停止,这时就会影响其他服务的正常运行。下面利用redis sentinel做一个主从切换的集群管理。 下面两段官方的说辞: Redis Sentinel provides high availability for Redis. In practical terms this means that using Sentinel you can create a Redis deployment that resists without human intervention to certain kind of failures. Redis Sentinel also provides other collateral tasks such as monitoring, notifications and acts as a configuration provider for clients. 环境配置: 由于我这次配置没有太多的机器,参考前面的主从搭建,测试环境就两台Linux机器,所以用了一台Windows机器做了一个slave。 Windows只支持64位,所以要找64位的机器,参考此博客http://blog.csdn.net/renfufei/article/details/38474435

redis随笔

与世无争的帅哥 提交于 2020-04-11 14:47:23
redis redis的安装一 安装的准备 首先得买一个服务器(我买的阿里云ecs轻量级); 再下载远程客户端(我用的Xshell,Xftp); 打开Xftp将下载好得redis压缩包传输Xftp中,在进入Xshell中Linux命令安装; rides安装 下载地址:https://redis.io/ 安装: 1,Linux进入redis所在目录; 2,执行命令:tar -zxvf redis-3.2.10.tar.gz //个人建议将软件安装在/usr/local目录下,执行命令:tar -zxvf redis-3.2.10.tar.gz -C /usr/local/redis,当然解压完了move也可以; 3,进入解压后的目录进行编译,cd redis-3.2.10. 执行命令:make ,make命令后可能报错,如果报错,解决如下: 报错一:那可能是没有gcc (linux下的一个编译器,是c,c++程序的编译器) 使用命令yum进行安装,yum -y install gcc 报错二:error:jemalloc/jemalloc.h:No such file or disectoty //可能找不到c语言中的头文件 执行 make MALLOC = libc 4,安装完gcc之后,make distclean 清理下上次make后产生的文件,再make redis启动:

三台服务器上离线安装redis哨兵集群,一主二从三哨兵

被刻印的时光 ゝ 提交于 2020-04-09 04:18:12
三台服务器上离线安装redis哨兵集群,一主二从三哨兵 系统安装好gcc环境,(不然编译redis会报错)。依旧不知道怎么离线安装gcc环境的可查看 CentOS下离线安装gcc环境,图文详细 下载 点击官网地址下载Linux版的redis http://download.redis.io/releases/redis-5.0.4.tar.gz 上传 put D:\AppStore\redis\redis-5.0.4.tar.gz /root 安装 tar xzf redis-5.0.4.tar.gz mv redis-5.0.4 /usr/local/redis cd /usr/local/redis/redis-5.0.4 make make install 如果执行make报错如下 致命错误:jemalloc/jemalloc.h:没有那个文件或目录 则使用 make MALLOC=libc 节点配置 现有三台虚拟机,那就按照一主二从来弄吧。进入redis.conf更改如下 192.168.1.115(主节点) bind 192.168.1.115 daemonize yes masterauth 666666 requirepass 666666 pidfile /st/redis/pid/redis_6379.pid logfile "/st/redis/log

redis哨兵模式(sentinel)及其配置

好久不见. 提交于 2020-04-07 12:30:29
一主两从三哨兵 哨兵模式基于redis主从复制,详细参考我写的博客https://my.oschina.net/architectliuyuanyuan/blog/3068255 创建vim sentinel.conf 里面加一句 指定端口号,必须指定 启动哨兵redis-sentinel sentinel.conf 主服务器宕机,哨兵会从从服务器中选择一台服务器作为主服务器,这里为了简单,支配了一台哨兵 先把服务器宕掉 现在已经没有主服务器了,哨兵会选择一台从服务器来作为主服务器 即使6379上线了,也再也做不了主服务器了 来源: oschina 链接: https://my.oschina.net/u/3747976/blog/3068279

Redis之如何安装Redis

若如初见. 提交于 2020-03-12 09:20:26
1.下载Redis版本 下载链接在这里, http://download.redis.io/releases/ 2.解压 执行如下命令,如下List-1 List-1 tar -zxvf redis-3.2.10.tar.gz 3.进入redis目录,执行命令 List-2 cd redis-3.2.10 sudo make test 4.执行install命令 编译安装,如下 List-3 sudo make install 5.查看结果 List-4 mjduan@mjduandeMacBook-Pro:/opt/software/code-tool/redis-3.2.10 % ll src/redis-* -rwxr-xr-x 1 root wheel 94K 9 2 23:20 src/redis-benchmark -rw-r--r--@ 1 mjduan wheel 29K 7 28 2017 src/redis-benchmark.c -rw-r--r-- 1 root wheel 44K 9 2 23:20 src/redis-benchmark.o -rwxr-xr-x 1 root wheel 14K 9 2 23:16 src/redis-check-aof -rw-r--r--@ 1 mjduan wheel 6.2K 7 28 2017 src

Replication(副本,主从模式)

对着背影说爱祢 提交于 2020-03-09 17:27:41
At the base of Redis replication (excluding the high availability features provided as an additional layer by Redis Cluster or Redis Sentinel) there is a very simple to use and configure leader follower (master-slave 主从模式) replication: it allows replica Redis instances to be exact copies of master instances. The replica will automatically reconnect to the master every time the link breaks, and will attempt to be an exact copy of it regardless of what happens to the master. This system works using three main mechanisms(主从节点之间的数据复制,有以下三种机制): When a master and a replica instances are well

Introduction to Redis (redis简介)

荒凉一梦 提交于 2020-03-09 16:29:08
Redis ( means REmote DIctionary Server ) is an open source (BSD licensed), in-memory data structure store , used as a database, cache and message broker. It supports data structures such as strings (字符串), hashes (哈希表), lists (列表), sets (集合), sorted sets (带排序的集合)with range queries, bitmaps , hyperloglogs , geospatial indexes with radius queries and streams . Redis has built-in replication (副本), Lua scripting , LRU eviction (过期算法), transactions (事务)and different levels of on-disk persistence (硬盘持久化), and provides high availability via Redis Sentinel (哨兵模式)and automatic partitioning with Redis

Best Practice to Upgrade Redis with Sentinels?

僤鯓⒐⒋嵵緔 提交于 2020-01-25 04:03:45
问题 I have three redis nodes being watched by 3 sentinels. I've searched around and the documentation seems to be unclear as to how best to upgrade a configuration of this type. I'm currently on version 3.0.6 and I want to upgrade to the latest 5.0.5. I have a few questions on the procedure around this. Is it ok to upgrade two major versions? I did this in our staging environment and it seemed to be fine. We use pretty basic redis functionality and there are no breaking changes between the