linux下安装redis 启动,停止,连接 编辑 删除
http://happyqing.iteye.com/blog/2348255
linux安装redis主备安装配置
http://happyqing.iteye.com/blog/2353516
建议最少配3个哨兵,
如果只有两台服务器,(一个服务器也可装多个redis,端口不同)
主redis服务器,1个哨兵
从redis服务器,2个哨兵
java端配置连接池,连接多个哨兵
http://blog.csdn.net/csolo/article/details/53196293
在一台机器上测试
sentinel26379.conf
#保护模式 protected-mode no #端口 port 26379 #守护进程 #daemonize yes #设置pid文件路径 pidfile /opt/redis/sentinel_26379.pid #工作路径,不用改 dir /tmp #设置日志文件路径 #logfile /opt/redis/logs/sentinel26379.log # 哨兵监控这个master,在至少quorum个哨兵实例都认为master down后把master标记为odown # (objective down客观down;相对应的存在sdown,subjective down,主观down)状态。 # slaves是自动发现,不用指定slaves。 sentinel monitor mymaster 192.168.2.11 6379 2 # master或slave多长时间(默认30秒)不能使用后标记为s_down状态。 sentinel down-after-milliseconds mymaster 10000 #选项指定了在执行故障转移时, 最多可以有多少个从服务器同时对新的主服务器进行同步, 这个数字越小, 完成故障转移所需的时间就越长。 sentinel parallel-syncs mymaster 1 #若sentinel在该配置值内未能完成failover操作(即故障时master/slave自动切换),则认为本次failover失败。 sentinel failover-timeout mymaster 180000 #设置master和slaves的密码 sentinel auth-pass mymaster redis2016
sentinel26380.conf
#保护模式 protected-mode no #端口 port 26380 #守护进程 #daemonize yes #设置pid文件路径 pidfile /opt/redis/sentinel_26380.pid #工作路径,不用改 dir /tmp #设置日志文件路径 #logfile /opt/redis/logs/sentinel26380.log # 哨兵监控这个master,在至少quorum个哨兵实例都认为master down后把master标记为odown # (objective down客观down;相对应的存在sdown,subjective down,主观down)状态。 # slaves是自动发现,不用指定slaves。 sentinel monitor mymaster 192.168.2.11 6379 2 # master或slave多长时间(默认30秒)不能使用后标记为s_down状态。 sentinel down-after-milliseconds mymaster 10000 #选项指定了在执行故障转移时, 最多可以有多少个从服务器同时对新的主服务器进行同步, 这个数字越小, 完成故障转移所需的时间就越长。 sentinel parallel-syncs mymaster 1 #若sentinel在该配置值内未能完成failover操作(即故障时master/slave自动切换),则认为本次failover失败。 sentinel failover-timeout mymaster 180000 #设置master和slaves的密码 sentinel auth-pass mymaster redis2016
sentinel26381.conf
#保护模式 protected-mode no #端口 port 26381 #守护进程 #daemonize yes #设置pid文件路径 pidfile /opt/redis/sentinel_26381.pid #工作路径,不用改 dir /tmp #设置日志文件路径 #logfile /opt/redis/logs/sentinel26381.log # 哨兵监控这个master,在至少quorum个哨兵实例都认为master down后把master标记为odown # (objective down客观down;相对应的存在sdown,subjective down,主观down)状态。 # slaves是自动发现,不用指定slaves。 sentinel monitor mymaster 192.168.2.11 6379 2 # master或slave多长时间(默认30秒)不能使用后标记为s_down状态。 sentinel down-after-milliseconds mymaster 10000 #选项指定了在执行故障转移时, 最多可以有多少个从服务器同时对新的主服务器进行同步, 这个数字越小, 完成故障转移所需的时间就越长。 sentinel parallel-syncs mymaster 1 #若sentinel在该配置值内未能完成failover操作(即故障时master/slave自动切换),则认为本次failover失败。 sentinel failover-timeout mymaster 180000 #设置master和slaves的密码 sentinel auth-pass mymaster redis2016
sentinel monitor mymaster 192.168.2.11 6379 2
这个要配局域网IP,否则远程连不上,
最后的quorum最后配成2,否则容易切换失败
模拟
可以同时结束redis6379,sentinel26379的进程
查看redis6380日志
查看sentinel26380和sentinel26381的日志,
可以看到主从切换的过程
启动
/opt/redis/bin/redis-sentinel /opt/redis/conf/sentinel26379.conf
/opt/redis/bin/redis-sentinel /opt/redis/conf/sentinel26380.conf
/opt/redis/bin/redis-sentinel /opt/redis/conf/sentinel26381.conf
连接
/opt/redis/bin/redis-cli -h 192.168.2.11 -p 26379 -a redis2016
停止
/opt/redis/bin/redis-cli -h 192.168.2.11 -p 26379 -a redis2016 shutdown
相关推荐
Linux下安装配置redis详细教程,并配置哨兵模式,redis中文详解. 注意:对只使用redis服务,只需要在主Redis里面配置requirepass,在从Redis里面配置masterauth,密码保持一致,密码尽可能复杂,以免被攻击破解。 ...
方便那些只是偶尔配置Redis,过段时间就忘掉的同学,本配置包里包含说明和4.0.1安装包,稍微用点心可以一步到位的教程。
该资源是本人在学习redis过程中积累总结的经验以分享给大家:redis-sentinel高可用一键配置工具就是一键帮你从下载->安装->配置 好 redis 高可用的服务环境,省去了很多弯路,节约了更多的时间花在自己项目的主要...
1.0 redis持久化 Redis是一种内存型数据库,一旦服务器进程退出,数据库的数据就会丢失,为了解决这个问题,Redis提供了两种持久化的方案,将内存中的数据保存到磁盘中,避免...也可以在redis.conf中配置,定期执行。
3、在Linux下,最好能做成系统服务的方式启停,方便使用 4、以上至少5个配置文件+5个启停脚本,部署在三台机器上 5、对于单点模式也可使用! 过程比较麻烦,容易出错,对于systemctl 服务制作,没做过的人员需要查...
依赖关系使用和 ,所以第一步是安装依赖项: $ pip install redis$ pip install pyyaml如果要在 linux 系统范围内安装 python yaml,还可以使用包管理器,例如: $ sudo apt-get install python-yaml$ sudo yum ...
linux 上安装redis, 哨兵配置,此案列只有一主,没有从redis,所以 sentinel monitor mymaster 10.110.4.94 6379 1 配置成这样
视频详细讲解,需要的小伙伴自行百度网盘下载,链接...05_linux环境安装redis 06_redis 持久化 07_redis 事务 08_删除策略 09_redis服务器配置 10_高级数据类型 11_主从复制 12_哨兵模式 13_cluster 14_企业级解决方案
breadis 充当整个 redis 集群的简单代理,其行为与普通的单个 redis 实例完全相同(因此任何现有的 redis 驱动程序都可以与 breadis 对话)。 这可能看起来有点傻,因为您可以在应用程序中使用集群感知驱动程序来与...
redis集群部署+哨兵模式配置 配置redis主从复制,配置哨兵模式,实现主从自动切换 1、准备至少三台Linux服务器并关闭防火墙 2、安装软件包 3、下载redis源码包并安装
今天小编就为大家分享一篇解决Redis设置密码重启后失效的问题,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
linux 上安装redis 时配置文件redis.conf需要注意的点,redis安装包,哨兵配置都将上传至此。需要的可以下载
一键开启: Redis Standalone、Redis Sentinel、Redis Cluster三种类型的应用,无需手动配置初始化。Failover: 支持哨兵,集群的高可用模式。伸缩: 提供完善的垂直和水平在线伸缩功能。完善运维: 提供自动运维和...
本课程共28节,内容包括nosql基本特点,linux环境下的下载安装与启动,常用命令,配置文件讲解,5种基本数据类型的特点、数存储结构和操作命令,redis安全策略,使用redis实现web服务器的session共享,持久化方式和...
#My First SpringBoot Web Project####我的第一个SpringBoot Web项目####当前...本地部署linux服务器系统之后再学习使用缓存穿透(待加入,同7),测试使用Executors(用于并发测试),双重检测集成redis哨兵模式(待加入,同7)
│ 05-哨兵.avi │ 06-搭建Redis的集群环境.avi │ 08-插槽的分配和key的关系.avi │ 09-新增节点.avi │ 10-移除集群中的节点.avi │ 11-集群的故障转移.avi │ 12-MySQL的查询优化.avi │ 13-数据库结构优化.avi ...
linux环境下使用docker-compose脚本安装常用的软件和配置,如redis、fastdfs、rabbitmq、redis-sentinel主从+哨兵。 智慧课堂辅助App的设计与实现所用到文件...
Redis | 分布式缓存数据库 | [https://redis.io/](https://redis.io/) Solr & Elasticsearch | 分布式全文搜索引擎 | [http://lucene.apache.org/solr/](http://lucene.apache.org/solr/) [https://www.elastic.co/]...