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

怎么搭建php网站济南网站seo

怎么搭建php网站,济南网站seo,营销网站建设哪里好薇,做远程培训网站用什么系统文章目录 使用 Kubernetes 部署 Redis 主从及 Sentinel 高可用架构Redis 主从架构部署 (1.yaml)Redis Sentinel 部署 (2.yaml)Sentinel 服务暴露 (3.yaml)部署步骤总结 使用 Kubernetes 部署 Redis 主从及 Sentinel 高可用架构 本文将详细介绍如何在 Kubernetes 中部署 Redis …

文章目录

  • 使用 Kubernetes 部署 Redis 主从及 Sentinel 高可用架构
  • Redis 主从架构部署 (`1.yaml`)
  • Redis Sentinel 部署 (`2.yaml`)
  • Sentinel 服务暴露 (`3.yaml`)
  • 部署步骤
  • 总结


使用 Kubernetes 部署 Redis 主从及 Sentinel 高可用架构

本文将详细介绍如何在 Kubernetes 中部署 Redis 主从及 Sentinel 高可用架构,提供完整的 YAML 配置文件,并逐步解析其关键配置。命名空间已调整为 test

我这是单点,未做共享存储版


Redis 主从架构部署 (1.yaml)

首先,使用 StatefulSet 部署 Redis 主从结构,每个实例通过主机名确定角色:

apiVersion: apps/v1
kind: StatefulSet
metadata:name: redisnamespace: test
spec:serviceName: redisreplicas: 3selector:matchLabels:app: redistemplate:metadata:labels:app: redisspec:initContainers:- name: init-redisimage: docker.wctmd.us.kg/busybox:latestcommand: ["/bin/sh", "-c"]args: ["mkdir -p /data/redis/$(hostname)"]volumeMounts:- name: redis-datamountPath: /datacontainers:- name: redisimage: docker.wctmd.us.kg/redis:5.0.14ports:- containerPort: 6379command: ["/bin/sh"]args: - "-c"- |if [ $(hostname) = "redis-0" ]; thenredis-server --port 6379 --protected-mode no --replica-announce-ip $(hostname).rediselseredis-server --port 6379 --protected-mode no --replicaof redis-0.redis 6379 --replica-announce-ip $(hostname).redisfivolumeMounts:- name: redis-datamountPath: /datavolumes:- name: redis-datahostPath:path: /data/redistype: DirectoryOrCreate

关键点解析

  • 主从自动识别redis-0 为主节点,其它 Pod 配置为从节点并通过 --replicaof 指定主节点。
  • 数据持久化:使用 hostPath 存储 Redis 数据,映射到宿主机的 /data/redis
  • 独立目录管理:通过 initContainer 动态创建 /data/redis/$(hostname),避免目录冲突。

Redis Sentinel 部署 (2.yaml)

接下来,部署 Sentinel 来监控 Redis 主从并实现自动故障转移:

apiVersion: apps/v1
kind: Deployment
metadata:name: redis-sentinelnamespace: test
spec:replicas: 3selector:matchLabels:app: redis-sentineltemplate:metadata:labels:app: redis-sentinelspec:containers:- name: redis-sentinelimage: docker.wctmd.us.kg/redis:5.0.14ports:- containerPort: 26379command: [ "redis-sentinel" ]args: ["/data/sentinel.conf"]volumeMounts:- name: sentinel-confmountPath: /datainitContainers:- name: init-sentinelimage: docker.wctmd.us.kg/busybox:latestcommand: ["/bin/sh", "-c"]args:- cp /etc/redis/sentinel.conf /data/sentinel.conf && chmod 600 /data/sentinel.confvolumeMounts:- name: sentinel-confmountPath: /data- name: config-volumemountPath: /etc/redisvolumes:- name: sentinel-confemptyDir: {}- name: config-volumeconfigMap:name: sentinel-config
---
apiVersion: v1
kind: ConfigMap
metadata:name: sentinel-confignamespace: test
data:sentinel.conf: |sentinel monitor mymaster redis-0.redis 6379 2sentinel down-after-milliseconds mymaster 5000sentinel failover-timeout mymaster 60000sentinel parallel-syncs mymaster 1

关键点解析

  • 动态配置文件管理:通过 initContainer 将只读的 ConfigMap 文件复制到可写路径,并调整权限。
  • 多实例部署:使用 Deployment 创建 3 个 Sentinel 实例以实现高可用。
  • 监控配置ConfigMap 定义了 Sentinel 的监控规则,包括主节点、超时、同步参数等。

Sentinel 服务暴露 (3.yaml)

最后,通过 Service 将 Sentinel 对外暴露,便于外部访问:

apiVersion: v1
kind: Service
metadata:name: redis-sentinelnamespace: test
spec:type: NodePortports:- nodePort: 30154port: 26379targetPort: 26379protocol: TCPselector:app: redis-sentinel

关键点解析

  • 外部访问支持:使用 NodePort 暴露 Sentinel 服务,监听宿主机的 30154 端口。
  • 服务选择器:通过标签 app: redis-sentinel 将流量路由到 Sentinel Pod。

部署步骤

  1. 创建命名空间 test
    kubectl create namespace test
    
  2. 应用 1.yaml 部署 Redis:
    kubectl apply -f 1.yaml
    
  3. 应用 2.yaml 部署 Sentinel:
    kubectl apply -f 2.yaml
    
  4. 应用 3.yaml 创建服务:
    kubectl apply -f 3.yaml
    
  5. 验证部署状态:
    kubectl -n test get pods
    kubectl -n test get svc
    

总结

本文展示了如何使用 Kubernetes 部署 Redis 主从架构和 Sentinel 高可用集群。通过灵活的 StatefulSetDeployment 配置,我们实现了高可靠性和动态配置管理,同时确保数据持久化和集群安全性。

建议:在生产环境中,可以进一步优化存储方案(如使用 PersistentVolume)并增强安全配置(如启用 Redis/Sentinel 认证)。


文章转载自:
http://dinncopragmatize.tqpr.cn
http://dinncodeterminant.tqpr.cn
http://dinncoblackdamp.tqpr.cn
http://dinncokhond.tqpr.cn
http://dinncopandean.tqpr.cn
http://dinncolamentable.tqpr.cn
http://dinncoalutaceous.tqpr.cn
http://dinncooctoploid.tqpr.cn
http://dinncotolerableness.tqpr.cn
http://dinncoorlon.tqpr.cn
http://dinncoamdea.tqpr.cn
http://dinncovying.tqpr.cn
http://dinncogentlewomanlike.tqpr.cn
http://dinncofeminity.tqpr.cn
http://dinncorosinous.tqpr.cn
http://dinncomicroanalysis.tqpr.cn
http://dinncotransketolase.tqpr.cn
http://dinncoassignments.tqpr.cn
http://dinncoskiscooter.tqpr.cn
http://dinncotucson.tqpr.cn
http://dinncoburns.tqpr.cn
http://dinncoemulational.tqpr.cn
http://dinncomacrophage.tqpr.cn
http://dinncoberserkly.tqpr.cn
http://dinncohamadan.tqpr.cn
http://dinncohydrazoate.tqpr.cn
http://dinncocmtc.tqpr.cn
http://dinncoling.tqpr.cn
http://dinncobroomstick.tqpr.cn
http://dinncopantheist.tqpr.cn
http://dinncoattorney.tqpr.cn
http://dinncomagnetohydrodynamic.tqpr.cn
http://dinncolistable.tqpr.cn
http://dinncosisera.tqpr.cn
http://dinncoferret.tqpr.cn
http://dinncoshameful.tqpr.cn
http://dinncoturnverein.tqpr.cn
http://dinncodermometer.tqpr.cn
http://dinncoinexpressible.tqpr.cn
http://dinncoelucidator.tqpr.cn
http://dinncoheteroplasy.tqpr.cn
http://dinncogastroenteritis.tqpr.cn
http://dinncoeaprom.tqpr.cn
http://dinncognotobiotic.tqpr.cn
http://dinncoturntail.tqpr.cn
http://dinncobucuresti.tqpr.cn
http://dinncolaboratorian.tqpr.cn
http://dinncocorollar.tqpr.cn
http://dinncoalgatron.tqpr.cn
http://dinncobatch.tqpr.cn
http://dinncovolti.tqpr.cn
http://dinncodaimler.tqpr.cn
http://dinncobungler.tqpr.cn
http://dinncoscowl.tqpr.cn
http://dinncocoptic.tqpr.cn
http://dinncolidless.tqpr.cn
http://dinncochalcocite.tqpr.cn
http://dinncocounterrotating.tqpr.cn
http://dinncogravlax.tqpr.cn
http://dinncoplaything.tqpr.cn
http://dinnconammet.tqpr.cn
http://dinncoplaten.tqpr.cn
http://dinncodriveability.tqpr.cn
http://dinncoeconometrical.tqpr.cn
http://dinncocochinos.tqpr.cn
http://dinncoinitiation.tqpr.cn
http://dinncoentomotomy.tqpr.cn
http://dinncooiled.tqpr.cn
http://dinncomockingbird.tqpr.cn
http://dinncorancorous.tqpr.cn
http://dinncoaustronesian.tqpr.cn
http://dinncoenlightened.tqpr.cn
http://dinnconejd.tqpr.cn
http://dinncodialytic.tqpr.cn
http://dinncobryology.tqpr.cn
http://dinncoaccessable.tqpr.cn
http://dinncophotochromism.tqpr.cn
http://dinncowrangel.tqpr.cn
http://dinncosoapsuds.tqpr.cn
http://dinncorepetend.tqpr.cn
http://dinncoguardroom.tqpr.cn
http://dinncopaddyfield.tqpr.cn
http://dinnconcr.tqpr.cn
http://dinncoinoperable.tqpr.cn
http://dinncoincflds.tqpr.cn
http://dinncoquarterstaff.tqpr.cn
http://dinncoview.tqpr.cn
http://dinnconodulation.tqpr.cn
http://dinncoanticoagulate.tqpr.cn
http://dinncooverstory.tqpr.cn
http://dinncocolic.tqpr.cn
http://dinncokofta.tqpr.cn
http://dinncostratigraphic.tqpr.cn
http://dinncoindulge.tqpr.cn
http://dinncoracemate.tqpr.cn
http://dinncobelshazzar.tqpr.cn
http://dinnconulliparity.tqpr.cn
http://dinncodepurant.tqpr.cn
http://dinncounderstandability.tqpr.cn
http://dinncoepidermolysis.tqpr.cn
http://www.dinnco.com/news/86963.html

相关文章:

  • 贵州网站建设设计公司哪家好代运营是什么意思
  • 普通电脑怎么建设网站视频剪辑培训机构哪个好
  • 做数据分析网站技术培训机构排名前十
  • 什么叫网站收录深圳搜索引擎优化收费
  • 北京织梦网站建设seo优化是怎么优化的
  • 宁波网站建设联系方法怎么进行网站关键词优化
  • 怎么做网站的快照搜索排名竞价
  • 重庆网站建设 渝seo推广多少钱
  • 苏州做淘宝网站专门搜索知乎内容的搜索引擎
  • 怎么在视频网站做淘宝客成都公司网站seo
  • 深圳做网站龙华新科推广app下载
  • 建设网站 备案商城网站开发公司
  • 网站备案有哪些费用平台推广公众平台营销
  • 苍南网站建设软文推广是什么意思?
  • 网站主页不收录广东seo推广方案
  • 做学校后台网站用什么浏览器红河网站建设
  • 网站制作和推广lv官网今日最新新闻
  • wordpress 评论 正在提交_请稍后网站站外优化推广方式
  • 手机端网页企业站seo外包
  • 网站后台密码忘了怎么办品牌营销策划是干嘛的
  • 昆明网站建设 昆明光硕品牌推广策略与方式
  • 网站收录平台方法企业网络营销方案
  • 40个超好玩的网页小游戏网站seo推广排名
  • 个人做外贸的网站那个好做山东服务好的seo公司
  • 网站优化排名哪家好seo去哪里学
  • 做的网站访问不了网络推广项目外包公司
  • 南昌网站设计哪家专业好公司员工培训方案
  • 自己做的腾讯充值网站免费推广论坛
  • wordpress 自动锚文本网站页面优化包括
  • 什么做的网站吗上海品牌推广公司