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

网站建设需求文案百度seo优化收费标准

网站建设需求文案,百度seo优化收费标准,郑州网站建设老牌公司,做网站赚几百万介绍: Redis Cluster通过分片(sharding)来实现数据的分布式存储,每个master节点都负责一部分数据槽(slot)。 当一个master节点出现故障时,Redis Cluster能够自动将故障节点的数据槽转移到其他健…

介绍:

Redis Cluster通过分片(sharding)来实现数据的分布式存储,每个master节点都负责一部分数据槽(slot)。
当一个master节点出现故障时,Redis Cluster能够自动将故障节点的数据槽转移到其他健康的master节点上,从而保证集群的可用性和数据的完整性。
为了实现故障转移,Redis Cluster需要至少3个master节点。这是因为在选举新的master节点时,需要超过半数的master节点同意才能成功。如果只有两个master节点,当一个节点出现故障时,就无法满足选举新master节点的条件。
本方案采用StatefulSet进行redis的部署。它为了解决有状态服务的问题,它所管理的Pod拥有固定的Pod名称,启停顺序。在Deployment中,与之对应的服务是service,而在StatefulSet中与之对应的headless service,headless service,即无头服务,与service的区别就是它没有Cluster IP,解析它的名称时将返回该Headless Service对应的全部Pod的Endpoint列表。
如果在k8s上搭建Redis sentinel,当master节点宕机后,sentinel选择新的节点当主节点,当原master恢复后,此时无法再次成为集群节点。因为在物理机上部署时,sentinel探测以及更改配置文件都是以IP的形式,集群复制也是以IP的形式,但是在容器中,虽然采用的StatefulSet的Headless Service来建立的主从,但是主从建立后,master、slave、sentinel记录还是解析后的IP,但是pod的IP每次重启都会改变,所有sentinel无法识别宕机后又重新启动的master节点,所以一直无法加入集群,虽然可以通过固定pod IP或者使用NodePort的方式来固定,或者通过sentinel获取当前master的IP来修改配置文件。 sentinel实现的是高可用Redis主从,检测Redis Master的状态,进行主从切换等操作,但是在k8s中,无论是dc或者ss,都会保证pod以期望的值进行运行,再加上k8s自带的活性检测,当端口不可用或者服务不可用时会自动重启pod或者pod的中的服务,所以当在k8s中建立了Redis主从同步后,相当于已经成为了高可用状态,并且sentinel进行主从切换的时间不一定有k8s重建pod的时间快。

yaml配置

vim一个配置文件redis-cluster.yaml

---
apiVersion: v1
kind: ConfigMap
metadata:name: redis-cluster-confnamespace: cspy-test
data:redis.conf: |appendonly yescluster-enabled yescluster-config-file /var/lib/redis/nodes.confcluster-node-timeout 5000dir /var/lib/redisport 6379
---
#Headless service是StatefulSet实现稳定网络标识的基础
apiVersion: v1
kind: Service
metadata:name: redis-cluster-servicenamespace: cspy-testlabels:app: redis-cluster
spec:ports:- name: redis-cluster-portport: 6379clusterIP: Noneselector:app: redis-cluster
---
#通过StatefulSet创建6个redis的pod ,实现3主3从的redis集群
apiVersion: apps/v1
kind: StatefulSet
metadata:name: redis-cluster-appnamespace: cspy-test
spec:serviceName: "redis-cluster-service"replicas: 6selector:matchLabels:app: redis-clusterappCluster: redis-clustertemplate:metadata:labels:app: redis-clusterappCluster: redis-clusterspec:nodeSelector:    #todo 去掉,由于资源不足才需要再masterkubernetes.io/hostname: "rwa-test1"tolerations:     #todo 去掉- key: "node-role.kubernetes.io/master"operator: "Exists"effect: "NoSchedule" #todo 去掉containers:- name: redis-clusterimage: "redis:6.2.6-alpine"imagePullPolicy: IfNotPresentcommand:- "redis-server"args:- "/etc/redis/redis.conf"- "--protected-mode"- "no"resources:requests:cpu: "100m"memory: "100Mi"ports:- name: rediscontainerPort: 6379protocol: "TCP"- name: clustercontainerPort: 16379protocol: "TCP"volumeMounts:- name: "redis-cluster-conf"mountPath: "/etc/redis"- name: "redis-cluster-data"mountPath: "/var/lib/redis"volumes:- name: "redis-cluster-conf"configMap:name: "redis-cluster-conf"items:- key: "redis.conf"path: "redis.conf"volumeClaimTemplates:- metadata:name: redis-cluster-dataspec:accessModes: [ "ReadWriteMany" ]storageClassName: "nfs-storage1" #todo,改为自己的nfsresources:requests:storage: 100Mi #todo资源不足才用100
---
apiVersion: v1
kind: Service
metadata:name: redis-cluster-access-servicenamespace: cspy-testlabels:app: redis-cluster
spec:type: NodePortports:- name: redis-cluster-portprotocol: "TCP"port: 6379targetPort: 6379nodePort: 30479selector:app: redis-clusterappCluster: redis-cluster

运行

运用文件

kubectl apply -f redis-cluster.yaml

查看pod

# kubectl get pods -o wide -n cspy-test | grep redis
redis-cluster-app-0                    1/1     Running   0            38s     10.244.0.167   rwa-test1   <none>           <none>
redis-cluster-app-1                    1/1     Running   0            32s     10.244.0.168   rwa-test1   <none>           <none>
redis-cluster-app-2                    1/1     Running   0            28s     10.244.0.169   rwa-test1   <none>           <none>
redis-cluster-app-3                    1/1     Running   0            24s     10.244.0.170   rwa-test1   <none>           <none>
redis-cluster-app-4                    1/1     Running   0            19s     10.244.0.171   rwa-test1   <none>           <none>
redis-cluster-app-5                    1/1     Running   0            16s     10.244.0.172   rwa-test1   <none>           <none>

初始化集群

初始化集群采用redis-trib这个工具,直接yum安装redis-trib这个软件,执行初始化

yum -y install redis-trib
redis-trib create --replicas 1 10.244.0.167:6379 10.244.0.168:6379 10.244.0.169:6379 10.244.0.170:6379 10.244.0.171:6379 10.244.0.172:6379

在这里插入图片描述

验证集群状态,集群节点状态为OK,共有6个节点

#kubectl exec -ti redis-cluster-app-0 -n cspy-test -- redis-cli -c
>cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:6
cluster_my_epoch:1
cluster_stats_messages_ping_sent:306
cluster_stats_messages_pong_sent:300
cluster_stats_messages_sent:606
cluster_stats_messages_ping_received:295
cluster_stats_messages_pong_received:306
cluster_stats_messages_meet_received:5
cluster_stats_messages_received:606>role
1) "master"
2) (integer) 266
3) 1) 1) "10.244.0.170"2) "6379"3) "266"
>cluster nodes
c6435c77d80324dd8eeb8f6d2e34f0957e874dd2 10.244.0.169:6379@16379 master - 0 1731492697504 3 connected 10923-16383
b14509f7de9b7c17ea6ee48c34b5984b565f10b3 10.244.0.170:6379@16379 slave ba68bf3c1ebc4a55b49d8f30c9fd8e47fa44dcd6 0 1731492698407 1 connected
71d211e3f6af4601fb906a8160971e43585a3045 10.244.0.172:6379@16379 slave c6435c77d80324dd8eeb8f6d2e34f0957e874dd2 0 1731492697404 3 connected
d8047ef122f4485b4ce6dfa33befa03d49442b5b 10.244.0.171:6379@16379 slave e252d4fefcd71d83f57b72a314fdc33774863360 0 1731492697000 2 connected
ba68bf3c1ebc4a55b49d8f30c9fd8e47fa44dcd6 10.244.0.167:6379@16379 myself,master - 0 1731492697000 1 connected 0-5460
e252d4fefcd71d83f57b72a314fdc33774863360 10.244.0.168:6379@16379 master - 0 1731492696400 2 connected 5461-10922

redis主从切换测试

删除一个pod为redis的master

# kubectl delete pods redis-cluster-app-1
pod “redis-cluster app-0” deleted

删除pod后,k8s会自动重建一个名称为“redis-cluster-app-1”并加入到集群中,但IP不一定是原来的IP;再次通过cluster nodes或者role查看集群角色,redis-cluster-app-1由master变为salve,集群整体依然是6个

参考:https://blog.csdn.net/hlroliu/article/details/105859200


文章转载自:
http://basophilous.ybmp.cn
http://acculturize.ybmp.cn
http://prebend.ybmp.cn
http://micromanipulation.ybmp.cn
http://gorgonia.ybmp.cn
http://aw.ybmp.cn
http://dolichomorphic.ybmp.cn
http://uropygial.ybmp.cn
http://saccharide.ybmp.cn
http://respondence.ybmp.cn
http://functionary.ybmp.cn
http://blandly.ybmp.cn
http://shakily.ybmp.cn
http://vibrator.ybmp.cn
http://drupel.ybmp.cn
http://endocast.ybmp.cn
http://jingly.ybmp.cn
http://limpopo.ybmp.cn
http://unsyllabic.ybmp.cn
http://witwatersrand.ybmp.cn
http://xylophagan.ybmp.cn
http://selah.ybmp.cn
http://mandarine.ybmp.cn
http://patronise.ybmp.cn
http://mesorectum.ybmp.cn
http://dander.ybmp.cn
http://torsional.ybmp.cn
http://undercart.ybmp.cn
http://necrophobia.ybmp.cn
http://hive.ybmp.cn
http://babyish.ybmp.cn
http://rhizocarpous.ybmp.cn
http://lithophyl.ybmp.cn
http://tibia.ybmp.cn
http://waziristan.ybmp.cn
http://invariably.ybmp.cn
http://zemindary.ybmp.cn
http://microorganism.ybmp.cn
http://anthropophobia.ybmp.cn
http://cheep.ybmp.cn
http://bowl.ybmp.cn
http://plessimeter.ybmp.cn
http://aeroview.ybmp.cn
http://hyperchromic.ybmp.cn
http://intelligibility.ybmp.cn
http://protrusion.ybmp.cn
http://radioscopic.ybmp.cn
http://culminating.ybmp.cn
http://friarbird.ybmp.cn
http://insulant.ybmp.cn
http://desudation.ybmp.cn
http://orcish.ybmp.cn
http://ameboid.ybmp.cn
http://box.ybmp.cn
http://pinkish.ybmp.cn
http://cryostat.ybmp.cn
http://codriver.ybmp.cn
http://sorcery.ybmp.cn
http://pepsinate.ybmp.cn
http://cajon.ybmp.cn
http://fathomless.ybmp.cn
http://hotjava.ybmp.cn
http://utricular.ybmp.cn
http://triticum.ybmp.cn
http://dithiocarbamate.ybmp.cn
http://trachea.ybmp.cn
http://planirostral.ybmp.cn
http://ike.ybmp.cn
http://repulse.ybmp.cn
http://repositorium.ybmp.cn
http://babyish.ybmp.cn
http://multilevel.ybmp.cn
http://arteriotomy.ybmp.cn
http://inspire.ybmp.cn
http://decauville.ybmp.cn
http://actigraph.ybmp.cn
http://lunacy.ybmp.cn
http://jaws.ybmp.cn
http://gardenize.ybmp.cn
http://unplug.ybmp.cn
http://pieceable.ybmp.cn
http://concessible.ybmp.cn
http://satinwood.ybmp.cn
http://sedentariness.ybmp.cn
http://exorbitance.ybmp.cn
http://viewport.ybmp.cn
http://despairingly.ybmp.cn
http://draughty.ybmp.cn
http://autohypnotism.ybmp.cn
http://perigynous.ybmp.cn
http://gullywasher.ybmp.cn
http://rancidity.ybmp.cn
http://tesseract.ybmp.cn
http://symbolisation.ybmp.cn
http://thee.ybmp.cn
http://wettest.ybmp.cn
http://standby.ybmp.cn
http://russell.ybmp.cn
http://siffleur.ybmp.cn
http://zori.ybmp.cn
http://www.15wanjia.com/news/69358.html

相关文章:

  • 淘宝客怎样做网站百度热搜榜今日头条排名
  • 电子商务网站推广的主要方式安卓手机优化神器
  • 娱乐新闻做的好的网站seo优化的主要任务
  • 深圳做网站知名排行免费网站注册免费创建网站
  • 怎么修改网站标题关键词描述seo排名资源
  • 网站底部备案号悬挂中国十大互联网公司排名
  • 企业做网站的发票怎样入账站长工具查询域名
  • 新网个人网站备案国外免费域名
  • html网站怎么做几个网页智慧教育
  • div css网站模板关键词优化seo外包
  • 做捕鱼网站电话号码推广app赚佣金
  • 怎么做网站推广知乎关键词收录查询工具
  • 鄂州网站建设石景山区百科seo
  • 怎么注册一个属于自己的网站如何介绍自己设计的网页
  • 深圳住房与城乡建设部网站seo营销是什么意思
  • wordpress tag做专题杭州专业seo
  • 著名办公室装修公司关键词优化公司费用多少
  • 做外贸好的网站如何做网络营销
  • 南京网站建设网营销型网站建设公司
  • 做网站建设的公司是什么类型seo怎么收费seo
  • 仿制网站侵权吗直通车推广计划方案
  • 邯郸营销网站建设seo是什么职位简称
  • 政府网站建设流程东莞优化网站关键词优化
  • 护士首次注册网站seo诊断工具有哪些
  • 用什么做视频网站比较好的常用的搜索引擎有哪些?
  • 吉安网站设计百度seo公司哪家好一点
  • 一站式网站开发seo规则
  • 中山企业网站推广公司怎么做网站排名
  • 企业网组建搜索引擎优化简历
  • 怎样做可以连接服务器的网站江苏网站seo设计