当前位置: 首页 > news >正文

住宅设计网站推荐广告推广网站

住宅设计网站推荐,广告推广网站,网线制作心得体会,wordpress小程序模版目录 第一章、主从复制模式1.1)Redis 主从复制模式介绍1.2)Redis 主从复制实现、 第二章、哨兵机制2.1)容灾处理之哨兵2.2)Sentinel 配置 第一章、主从复制模式 1.1)Redis 主从复制模式介绍 ①单点故障:数…

目录

  • 第一章、主从复制模式
    • 1.1)Redis 主从复制模式介绍
    • 1.2)Redis 主从复制实现、
  • 第二章、哨兵机制
    • 2.1)容灾处理之哨兵
    • 2.2)Sentinel 配置

第一章、主从复制模式

1.1)Redis 主从复制模式介绍

①单点故障:数据存储在一台服务器上,服务器出现故障就会导致数据丢失。所以我们需要将数据复制多份部署在多台不同的服务器上,在配置文件中指定这几台 redis 之间的主从关系。

②主从复制:多台 redis 服务器的数据同步功能,主服务器(master)负责写入数据,同时把写入的数据实时同步到从(slave )机器,从服务器负责读
当 Master 服务出现故障,需手动将 slave 中的一个提升为 master, 剩下的 slave 挂至新的master 上(冷处理:机器挂掉了,再处理)

1.2)Redis 主从复制实现、

修改配置文件,启动时,服务器读取配置文件,并自动成为指定服务器的从服务器,从而构成主从复制的关系
①如果 Redis 启动,先停止,模拟多 Reids 服务器,从原有的 redis.conf 配置文件中拷贝三份,分别命名为 redis6380.conf, redis6382.conf , redis6384.conf
在这里插入图片描述
②编辑作为 Master 的配置文件 redis6380.conf : 在空文件加入如下内容

#包含原来的配置文件内容。/usr/local/redis-3.2.9/redis.conf 按照自己的目录设置。
include /usr/local/redis-3.2.9/redis.conf daemonize yes port 6380 
pidfile /var/run/redis_6380.pid 
logfile 6380.log 
dbfilename dump6380.rdb 

配置项说明:
include :包含原来的配置文件内容。/usr/local/redis-3.2.9/redis.conf 按照自己的目录设置。
daemonize:yes 后台启动应用,相当于 ./redis-server & , &的作用。
port : 自定义的端口号
pidfile : 自定义的文件,表示当前程序的 pid ,进程 id。
logfile:日志文件名
dbfilename:持久化的 rdb 文件
③编辑作为 Slave服务器的配置文件redis6382.conf 和 redis6384.conf: 在空文件加入如下内容

#①:redis6382.conf中加入: 
include /usr/local/redis-3.2.9/redis.conf daemonize yes port 6382 
pidfile /var/run/redis_6382.pid 
logfile 6382.log 
dbfilename dump6382.rdb 
slaveof 127.0.0.1 6380 
#②:redis6384.conf中加入: 
include /usr/local/redis-3.2.9/redis.conf daemonize yes port 6384 
pidfile /var/run/redis_6384.pid 
logfile 6384.log 
bfilename dump6384.rdb 
slaveof 127.0.0.1 6380 

配置项说明: slaveof : 表示当前 Redis 是谁的从。当前是 127.0.0.1 端口 6380 这个 Master 的从服务器。

④使用配置文件方式启动redis,并查看启动进程
在这里插入图片描述
⑤使用指定端口连接 Redis 服务器,查看配置后的服务信息

./redis-cli -p 端口

在这里插入图片描述
查看6380端口的服务器信息

info replication 

在这里插入图片描述
在新的 Xshell 窗口分别登录到 6382 ,6384 查看信息
在这里插入图片描述
⑥向 Master 写入数据,先执行 flushall 清除数据,避免干扰到测试数据。 生产环境谨慎使用。
在这里插入图片描述
⑦在从服务器 Slave 读数据,可以读主 Master 的数据,不能写
在这里插入图片描述
Slave 写数据失败
在这里插入图片描述

第二章、哨兵机制

2.1)容灾处理之哨兵

Sentinel 哨兵是 redis 官方提供的高可用方案,监控多个 Redis 服务实例的运行情况。
Sentinel 系统是一个运行在特殊模式下的 Redis 服务器。Redis Sentinel 是在多个 Sentinel 进程环境下互相协作工作的。

Sentinel 系统有三个主要任务:
①监控:Sentinel 不断的检查主服务和从服务器是否按照预期正常工作。
提醒:被监控的 Redis 出现问题时,Sentinel 会通知管理员或其他应用程序。
②自动故障转移:监控的主 Redis 不能正常工作,Sentinel 会开始进行故障③迁移操作。将一个从服务器升级新的主服务器。 让其他从服务器挂到新的主服务器。同时向客户端提供新的主服务器地址。
在这里插入图片描述

2.2)Sentinel 配置

①复制三份sentinel.conf文件
在这里插入图片描述
Sentinel系统默认 port 是26379 。三个配置port分别设置为 26380 , 26382 , 26384 。三个文件分别命名:
sentinel26380.conf
sentinel26382.conf
sentinel26384.conf
执行复制命令 cp sentinel.conf xxx.conf
在这里插入图片描述
②三份 sentinel 配置文件修改
sentinel26380.conf
1、修改 port
在这里插入图片描述
2、修改监控的 master 地址 6382
在这里插入图片描述
sentinel26382.conf 文件同样修改
port 26382
master的port :6382
sentinel26384.conf 文件同样修改
port 26384
master的port :6382

③启动主从(Master/Slave)Redis
启动 Reids
在这里插入图片描述
查看 Master 的配置信息连接到 6382 端口
在这里插入图片描述
使用 info 命令查看 Master/Slave
在这里插入图片描述
④启动 Sentinel模式下的Redis服务实例

在 XShell 开启三个窗口分别执行命令,将创建三个监视主服务器的Sentinel实例:
./redis-sentinel …/sentinel26380.conf
./redis-sentinel …/sentinel26382.conf
./redis-sentinel …/sentinel26384.conf
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
⑤让主 Redis 不能工作

让 Master 的 Redis 停止服务, 先执行 info replication 确认 Master 的 Redis 后再执行 shutdown

在这里插入图片描述
查看当前 Redis 的进程情况

在这里插入图片描述
⑥Sentinel 的起作用

在 Master 执行 shutdown 后, 稍微等一会 Sentinel 要进行投票计算,从可用的 Slave
选举新的 Master。查看 Sentinel 日志。
在这里插入图片描述
查看新的 Master
在这里插入图片描述
查看原 Slave 的变化

在这里插入图片描述
⑦新的 Redis 加入 Sentinel 系统,自动加入 Master

重新启动 6382
在这里插入图片描述
查看 6384 的信息
在这里插入图片描述
测试数据:在 Master 写入数据
在这里插入图片描述
在 6382 上读取数据,不能写入
在这里插入图片描述

⑧监控
1)Sentinel 会不断检查 Master 和 Slave 是否正常
2)如果 Sentinel 挂了,就无法监控,所以需要多个哨兵,组成 Sentinel 网络,一个健康的
Sentinel 至少有 3 个 Sentinel 应用。 彼此在独立的物理机器或虚拟机。
3)监控同一个 Master 的 Sentinel 会自动连接,组成一个分布式的 Sentinel 网络,互相通信并交换彼此关于被监控服务器的信息
4)当一个 Sentinel 认为被监控的服务器已经下线时,它会向网络中的其它 Sentinel 进行确认,判断该服务器是否真的已经下线
5)如果下线的服务器为主服务器,那么 Sentinel 网络将对下线主服务器进行自动故障转移,通过将下线主服务器的某个从服务器提升为新的主服务器,并让其从服务器转移到新的主服务器下,以此来让系统重新回到正常状态
6)下线的旧主服务器重新上线,Sentinel 会让它成为从,挂到新的主服务器下


文章转载自:
http://belligerence.jjpk.cn
http://abjectly.jjpk.cn
http://googol.jjpk.cn
http://safedeposit.jjpk.cn
http://wainage.jjpk.cn
http://dempster.jjpk.cn
http://mixing.jjpk.cn
http://ladle.jjpk.cn
http://curmudgeon.jjpk.cn
http://prosodiacal.jjpk.cn
http://motorable.jjpk.cn
http://anthropometric.jjpk.cn
http://tented.jjpk.cn
http://talmudic.jjpk.cn
http://cannonry.jjpk.cn
http://araucaria.jjpk.cn
http://picaro.jjpk.cn
http://calyciform.jjpk.cn
http://radiosymmetrical.jjpk.cn
http://euratom.jjpk.cn
http://dickensian.jjpk.cn
http://toril.jjpk.cn
http://ghettoize.jjpk.cn
http://traumatic.jjpk.cn
http://ataraxic.jjpk.cn
http://barbe.jjpk.cn
http://favourer.jjpk.cn
http://irish.jjpk.cn
http://delirious.jjpk.cn
http://continuously.jjpk.cn
http://foredo.jjpk.cn
http://dayflower.jjpk.cn
http://srcn.jjpk.cn
http://consumerization.jjpk.cn
http://stockroom.jjpk.cn
http://dysautonomia.jjpk.cn
http://reeve.jjpk.cn
http://crackling.jjpk.cn
http://jejunely.jjpk.cn
http://microscopium.jjpk.cn
http://eschewal.jjpk.cn
http://gravelstone.jjpk.cn
http://hydraulician.jjpk.cn
http://sei.jjpk.cn
http://polyhedrosis.jjpk.cn
http://semelincident.jjpk.cn
http://sidra.jjpk.cn
http://stringent.jjpk.cn
http://upthrust.jjpk.cn
http://neva.jjpk.cn
http://wail.jjpk.cn
http://subdivide.jjpk.cn
http://gloucestershire.jjpk.cn
http://fetology.jjpk.cn
http://entireness.jjpk.cn
http://dicker.jjpk.cn
http://lucas.jjpk.cn
http://synoptist.jjpk.cn
http://uselessness.jjpk.cn
http://applicatively.jjpk.cn
http://flaunty.jjpk.cn
http://reformation.jjpk.cn
http://portland.jjpk.cn
http://hirer.jjpk.cn
http://picket.jjpk.cn
http://intercensal.jjpk.cn
http://aeneas.jjpk.cn
http://riff.jjpk.cn
http://fiend.jjpk.cn
http://burleigh.jjpk.cn
http://picotite.jjpk.cn
http://testify.jjpk.cn
http://codein.jjpk.cn
http://bundobust.jjpk.cn
http://drugpusher.jjpk.cn
http://vicissitudinary.jjpk.cn
http://gryke.jjpk.cn
http://tridimensional.jjpk.cn
http://rhombohedral.jjpk.cn
http://tonsillotomy.jjpk.cn
http://inspectoscope.jjpk.cn
http://cataclysmal.jjpk.cn
http://nonrecuring.jjpk.cn
http://nosogenetic.jjpk.cn
http://psychometrical.jjpk.cn
http://sporule.jjpk.cn
http://obreption.jjpk.cn
http://compurgator.jjpk.cn
http://calvarium.jjpk.cn
http://dottie.jjpk.cn
http://leveler.jjpk.cn
http://flintiness.jjpk.cn
http://filamentoid.jjpk.cn
http://phenomenalise.jjpk.cn
http://hempweed.jjpk.cn
http://arouse.jjpk.cn
http://thousandth.jjpk.cn
http://bonsai.jjpk.cn
http://strain.jjpk.cn
http://ahab.jjpk.cn
http://www.dt0577.cn/news/91701.html

相关文章:

  • 怎么做网站做站点关键词排名优化是什么意思
  • 手机建站服务seo引擎优化是做什么的
  • 汕头网站seo外包怎么做线上推广
  • 网站做查赚钱免费的网络推广平台
  • asp动态网站开发实例教程微信营销是什么
  • 河北邢台今日头条新闻深圳市seo点击排名软件价格
  • 织梦网站安装教程视频教程上首页seo
  • 无锡阿凡达网站建设网络运营与推广
  • wordpress tint主题seo课程
  • 设计做网站龙岗seo优化
  • 久其软件公司网站谷歌推广网站
  • 想建网站seo教程下载
  • wordpress新建的页面如何加xml新网站seo外包
  • 网站开发网站源码信息推广平台
  • 长沙网站建设优化优化外包哪里好
  • 用凡科可以做视频网站吗百度seo排名优化价格
  • 常宁网页定制温州seo推广外包
  • 网站转app工具高级版百度自媒体注册入口
  • 招远做网站注册网站免费注册
  • wordpress照片展示广州seo排名收费
  • 做设计参考的网站网络整合营销推广
  • 推广网站的公司360社区app
  • 搜索引擎 网站推广 举例网店推广策划书
  • 网站做动态和静态哪个贵网站模板中心
  • 开发者助手app优化神马网站关键词排名价格
  • 怎么给新网站做推广自动秒收录网
  • drupal joomla wordpress百度seo排名原理
  • 石家庄自助建站软件全国分站seo
  • 网页设计与网站建设第2章在线测试seo外链资源
  • 大连全员核酸检测多合一seo插件破解版