研发工程师玩转Kubernetes——使用Deployment进行多副本维护

news2024/11/23 7:55:49

多副本维护是指,对一组在任何时候都处于运行状态的 Pod 副本的稳定集合进行维护。说的直白点,就是保证某种的Pod数量会被自动维持——增加了该类Pod会自动删除多余的,减少了该类Pod会自动新增以弥补,以保证Pod数量不变。
Kubernetes是一个一直在迭代更新的系统,其多副本维护方案也经历了几个版本大的改动。本文将采用最新的Deployment方案,而不是老版本的ReplicaSet和ReplicationController。

编写清单文件

在《研发工程师玩转Kubernetes——通过文件创建Service》一文中,我们通过两个不同的pod清单文件创建了两个Pod。
在这里插入图片描述
可以看到,它们只是name不同。
如果我们对name没有特别的要求,这样做起来就比较繁琐。比如我们要创建1000个Pod,难道要创建1000个清单文件才可以吗?而且它们的区别只有很小。

Deployment则帮我们解决了这个问题。如下面内容

apiVersion: apps/v1
kind: Deployment
metadata:
  name: simple-http-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: simple_http
  template:
    metadata:
      labels:
        app: simple_http
    spec:
      containers:
      - name: simple-http-container
        image: localhost:32000/simple_http:v1
        ports:
        - containerPort: 8888

kind: Deployment表示该清单文件是用来描述Deployment组件的。它和Pod之间的关系如下图,即Deployment通过ReplicaSet来管理Pods。
metadata.name: simple-http-deployment用于描述该Deployment组件名。它还有一个重要作用,就是Pod的名字也是基于它生成的。
在这里插入图片描述
spec.replicas: 2表示我们将维持两个Pod的副本。
spec.selector.matchLabels.app: simple_http用于描述维持的Pod副本的匹配规则,即该Pod的app是simple_http。
template字段则是描述Pod的清单内容。它和《研发工程师玩转Kubernetes——通过文件创建Pod》的区别在于,前者不提供template.metadata.name字段。因为动态创建的Pod的名称如果需要指定,则需要在清单文件中写明。而在需要多副本维护的情况下,准确的Pod名没有太多意义。
template.metadata.labels.app和spec.selector.matchLabels.app相呼应,即Deployment维持的副本模板要强匹配app这个label。当然这个app不是必须的,我们可以改成其他的字段,因为它只是一个label。

提交部署

将上述yaml文件保存为simple_http_deployment.yaml ,并执行

kubectl apply -f simple_http_deployment.yaml 

deployment.apps/simple-http-deployment created

查看Pod

kubectl describe pods
Name:             simple-http-deployment-5995f574dc-jrm8z
Namespace:        default
Priority:         0
Service Account:  default
Node:             fangliang-virtual-machine/172.30.45.36
Start Time:       Mon, 22 May 2023 17:07:36 +0800
Labels:           app=simple_http
                  pod-template-hash=5995f574dc
Annotations:      cni.projectcalico.org/containerID: 89f704ef7c1e19ee9e18e3d80c60fbf00e7c66690ea4bcd3f8bb18f7faa495bb
                  cni.projectcalico.org/podIP: 10.1.62.161/32
                  cni.projectcalico.org/podIPs: 10.1.62.161/32
Status:           Pending
IP:               
IPs:              <none>
Controlled By:    ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   
    Image:          localhost:32000/simple_http:v1
    Image ID:       
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-l4f4q (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-l4f4q:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  2s    default-scheduler  Successfully assigned default/simple-http-deployment-5995f574dc-jrm8z to fangliang-virtual-machine
  Normal  Pulled     1s    kubelet            Container image "localhost:32000/simple_http:v1" already present on machine
  Normal  Created    1s    kubelet            Created container simple-http-container
  Normal  Started    0s    kubelet            Started container simple-http-container


Name:             simple-http-deployment-5995f574dc-zmczp
Namespace:        default
Priority:         0
Service Account:  default
Node:             fangliang-virtual-machine/172.30.45.36
Start Time:       Mon, 22 May 2023 17:07:36 +0800
Labels:           app=simple_http
                  pod-template-hash=5995f574dc
Annotations:      cni.projectcalico.org/containerID: 37d38e3883308d283e1f21bbd2d66cecdc0b1b52342b0fc31d833c692f2c5a85
                  cni.projectcalico.org/podIP: 10.1.62.153/32
                  cni.projectcalico.org/podIPs: 10.1.62.153/32
Status:           Pending
IP:               
IPs:              <none>
Controlled By:    ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   
    Image:          localhost:32000/simple_http:v1
    Image ID:       
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ContainerCreating
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-82c7h (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-82c7h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  2s    default-scheduler  Successfully assigned default/simple-http-deployment-5995f574dc-zmczp to fangliang-virtual-machine
  Normal  Pulled     1s    kubelet            Container image "localhost:32000/simple_http:v1" already present on machine
  Normal  Created    1s    kubelet            Created container simple-http-container
  Normal  Started    0s    kubelet            Started container simple-http-container

我们观察Name字段,可以看到Deployment生成了名字叫simple-http-deployment-5995f574dc-jrm8z和simple-http-deployment-5995f574dc-zmczp的Pod。他们都是基于Deployment的name:simple-http-deployment自动生成的。

维护实验

手动删除Pod,Deployment自动增加

我们删除simple-http-deployment-5995f574dc-jrm8z

kubectl delete pod simple-http-deployment-5995f574dc-jrm8z

pod “simple-http-deployment-5995f574dc-jrm8z” deleted

然后查看Pod的状态

kubectl describe pods
Name:             simple-http-deployment-5995f574dc-zmczp
Namespace:        default
Priority:         0
Service Account:  default
Node:             fangliang-virtual-machine/172.30.45.36
Start Time:       Mon, 22 May 2023 17:07:36 +0800
Labels:           app=simple_http
                  pod-template-hash=5995f574dc
Annotations:      cni.projectcalico.org/containerID: 37d38e3883308d283e1f21bbd2d66cecdc0b1b52342b0fc31d833c692f2c5a85
                  cni.projectcalico.org/podIP: 10.1.62.153/32
                  cni.projectcalico.org/podIPs: 10.1.62.153/32
Status:           Running
IP:               10.1.62.153
IPs:
  IP:           10.1.62.153
Controlled By:  ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   containerd://9e4b29af865933cf876b8af1c9cc10a86b5ccbcc4fca2c184a56317b6a7ea097
    Image:          localhost:32000/simple_http:v1
    Image ID:       localhost:32000/simple_http@sha256:cbee584f83426593efb95a9e2213bb40143a1c86c3d217e65d30430033f846d4
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 22 May 2023 17:07:38 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-82c7h (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-82c7h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  100s  default-scheduler  Successfully assigned default/simple-http-deployment-5995f574dc-zmczp to fangliang-virtual-machine
  Normal  Pulled     100s  kubelet            Container image "localhost:32000/simple_http:v1" already present on machine
  Normal  Created    100s  kubelet            Created container simple-http-container
  Normal  Started    99s   kubelet            Started container simple-http-container

Name:             simple-http-deployment-5995f574dc-46kk5
Namespace:        default
Priority:         0
Service Account:  default
Node:             fangliang-virtual-machine/172.30.45.36
Start Time:       Mon, 22 May 2023 17:08:57 +0800
Labels:           app=simple_http
                  pod-template-hash=5995f574dc
Annotations:      cni.projectcalico.org/containerID: b755b01f8ead112314377158b6a9520bec9a02f4be97edfdf906f715b6fd4a94
                  cni.projectcalico.org/podIP: 10.1.62.157/32
                  cni.projectcalico.org/podIPs: 10.1.62.157/32
Status:           Running
IP:               10.1.62.157
IPs:
  IP:           10.1.62.157
Controlled By:  ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   containerd://c0354e53cf916d8d826f5e8a2bf0a475c038b47bddb947b0fb7233be612f139f
    Image:          localhost:32000/simple_http:v1
    Image ID:       localhost:32000/simple_http@sha256:cbee584f83426593efb95a9e2213bb40143a1c86c3d217e65d30430033f846d4
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 22 May 2023 17:08:57 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-wvsx8 (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-wvsx8:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  20s   default-scheduler  Successfully assigned default/simple-http-deployment-5995f574dc-46kk5 to fangliang-virtual-machine
  Normal  Pulled     20s   kubelet            Container image "localhost:32000/simple_http:v1" already present on machine
  Normal  Created    20s   kubelet            Created container simple-http-container
  Normal  Started    20s   kubelet            Started container simple-http-container

可以看到simple-http-deployment-5995f574dc-zmczp没有变动,simple-http-deployment-5995f574dc-jrm8z被删除了(可能会处在Terminating中间状态),simple-http-deployment-5995f574dc-46kk5被新建出来。

手动调整副本

我们可以通过kubectl scale指令调整的大小,比如下面指令将副本数调整为1。

kubectl scale deployment simple-http-deployment --replicas=1

deployment.apps/simple-http-deployment scaled

查看现存的Pod

 kubectl describe pod
Name:             simple-http-deployment-5995f574dc-zmczp
Namespace:        default
Priority:         0
Service Account:  default
Node:             fangliang-virtual-machine/172.30.45.36
Start Time:       Mon, 22 May 2023 17:07:36 +0800
Labels:           app=simple_http
                  pod-template-hash=5995f574dc
Annotations:      cni.projectcalico.org/containerID: 37d38e3883308d283e1f21bbd2d66cecdc0b1b52342b0fc31d833c692f2c5a85
                  cni.projectcalico.org/podIP: 10.1.62.153/32
                  cni.projectcalico.org/podIPs: 10.1.62.153/32
Status:           Running
IP:               10.1.62.153
IPs:
  IP:           10.1.62.153
Controlled By:  ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   containerd://9e4b29af865933cf876b8af1c9cc10a86b5ccbcc4fca2c184a56317b6a7ea097
    Image:          localhost:32000/simple_http:v1
    Image ID:       localhost:32000/simple_http@sha256:cbee584f83426593efb95a9e2213bb40143a1c86c3d217e65d30430033f846d4
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 22 May 2023 17:07:38 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-82c7h (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-82c7h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:                      <none>

可以看到只有simple-http-deployment-5995f574dc-zmczp存在了。

查看Deployment

kubectl describe deployments.apps simple-http-deployment 
Name:                   simple-http-deployment
Namespace:              default
CreationTimestamp:      Mon, 22 May 2023 17:07:36 +0800
Labels:                 <none>
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               app=simple_http
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  25% max unavailable, 25% max surge
Pod Template:
  Labels:  app=simple_http
  Containers:
   simple-http-container:
    Image:        localhost:32000/simple_http:v1
    Port:         8888/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Progressing    True    NewReplicaSetAvailable
  Available      True    MinimumReplicasAvailable
OldReplicaSets:  <none>
NewReplicaSet:   simple-http-deployment-5995f574dc (1/1 replicas created)
Events:          <none>

我们看到Deployment下有个字段NewReplicaSet,它是其管理的ReplicaSet的名字。

查看ReplicaSet

Deployment底层是通过ReplicaSet来实现的,我们可以通过下面指令看下rc

kubectl describe replicasets.apps
Name:           simple-http-deployment-5995f574dc
Namespace:      default
Selector:       app=simple_http,pod-template-hash=5995f574dc
Labels:         app=simple_http
                pod-template-hash=5995f574dc
Annotations:    deployment.kubernetes.io/desired-replicas: 1
                deployment.kubernetes.io/max-replicas: 2
                deployment.kubernetes.io/revision: 1
Controlled By:  Deployment/simple-http-deployment
Replicas:       1 current / 1 desired
Pods Status:    1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app=simple_http
           pod-template-hash=5995f574dc
  Containers:
   simple-http-container:
    Image:        localhost:32000/simple_http:v1
    Port:         8888/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Events:           <none>

可以看到这个RC的Name是simple-http-deployment-5995f574dc,而之前通过Deployment创建的Pod的名字是simple-http-deployment-5995f574dc-zmczp、simple-http-deployment-5995f574dc-jrm8z和simple-http-deployment-5995f574dc-46kk5——它们的名气都是RC的名字拼接上几个字符。即:

  • ReplicaSet Name = Deployment Name + “-” +“some hash”
  • Pod Name = ReplicaSet Name+ “-” +“some hash”

而且新创建的Pod都会带上label: pod-template-hash=5995f574dc。RC通过Selector中的指定pod-template-hash=5995f574dc来聚合这些Pod。

手动新增Pod,Deployment自动删除

我们已经洞悉上述Deployment使用RC simple-http-deployment-5995f574dc来维护副本,而RC使用了app=simple_http,pod-template-hash=5995f574dc来筛选Pod。如果我们手工创建一个符合这些label的Pod,看看什么效果。

apiVersion: v1
kind: Pod
metadata:
  name: simple-http-c
  labels:
    name: simple-http-c
    app: simple_http
    pod-template-hash: 5995f574dc
spec:
  containers:
  - name: simple-http-container
    image: localhost:32000/simple_http:v1
    ports:
      - containerPort: 8888

保存为simple_http_c.yaml,然后执行

kubectl create -f simple_http_c.yaml 

pod/simple-http-c created

我们再查看rc

kubectl describe replicasets.apps
Name:           simple-http-deployment-5995f574dc
Namespace:      default
Selector:       app=simple_http,pod-template-hash=5995f574dc
Labels:         app=simple_http
                pod-template-hash=5995f574dc
Annotations:    deployment.kubernetes.io/desired-replicas: 1
                deployment.kubernetes.io/max-replicas: 2
                deployment.kubernetes.io/revision: 1
Controlled By:  Deployment/simple-http-deployment
Replicas:       1 current / 1 desired
Pods Status:    2 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
  Labels:  app=simple_http
           pod-template-hash=5995f574dc
  Containers:
   simple-http-container:
    Image:        localhost:32000/simple_http:v1
    Port:         8888/TCP
    Host Port:    0/TCP
    Environment:  <none>
    Mounts:       <none>
  Volumes:        <none>
Events:
  Type    Reason            Age   From                   Message
  ----    ------            ----  ----                   -------
  Normal  SuccessfulDelete  19s   replicaset-controller  Deleted pod: simple-http-c

可以看到刚刚创建的Pod被删除了。此时simple-http-c处于Terminating状态。
该RC还是维持着动态调整后的副本数。

删除

kubectl delete deployments.apps simple-http-deployment

deployment.apps “simple-http-deployment” deleted

此时我们看到这个Deployment创建的Pod也会被删除

kubectl describe pod
Name:                      simple-http-deployment-5995f574dc-zmczp
Namespace:                 default
Priority:                  0
Service Account:           default
Node:                      fangliang-virtual-machine/172.30.45.36
Start Time:                Mon, 22 May 2023 17:07:36 +0800
Labels:                    app=simple_http
                           pod-template-hash=5995f574dc
Annotations:               cni.projectcalico.org/containerID: 37d38e3883308d283e1f21bbd2d66cecdc0b1b52342b0fc31d833c692f2c5a85
                           cni.projectcalico.org/podIP: 10.1.62.153/32
                           cni.projectcalico.org/podIPs: 10.1.62.153/32
Status:                    Terminating (lasts <invalid>)
Termination Grace Period:  30s
IP:                        10.1.62.153
IPs:
  IP:           10.1.62.153
Controlled By:  ReplicaSet/simple-http-deployment-5995f574dc
Containers:
  simple-http-container:
    Container ID:   containerd://9e4b29af865933cf876b8af1c9cc10a86b5ccbcc4fca2c184a56317b6a7ea097
    Image:          localhost:32000/simple_http:v1
    Image ID:       localhost:32000/simple_http@sha256:cbee584f83426593efb95a9e2213bb40143a1c86c3d217e65d30430033f846d4
    Port:           8888/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Mon, 22 May 2023 17:07:38 +0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-82c7h (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             True 
  ContainersReady   True 
  PodScheduled      True 
Volumes:
  kube-api-access-82c7h:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type    Reason   Age   From     Message
  ----    ------   ----  ----     -------
  Normal  Killing  27s   kubelet  Stopping container simple-http-container

参考资料

  • https://kubernetes.io/zh-cn/docs/concepts/workloads/controllers/deployment/
  • https://kubernetes.io/zh-cn/docs/concepts/workloads/controllers/replicaset/
  • https://kubernetes.io/zh-cn/docs/concepts/workloads/controllers/replicationcontroller/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/555840.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

day37_Tomcat_Maven

今日内容 一、Maven 二、Tomcat 一、Maven 1.1 引言 项目管理问题 项目中jar包资源越来越多&#xff0c;jar包的管理越来越沉重。 繁琐 要为每个项目手动导入所需的jar&#xff0c;需要搜集全部jar 复杂 项目中的jar如果需要版本升级&#xff0c;就需要再重新搜集jar 冗余 相…

基于Spring-动态调整线程池阻塞队列长度

最近在做一个动态线程池的组件&#xff0c;遇到了关于阻塞队列长度刷新的问题,所以记录下来&#xff0c;很有意思 我们都知道常用线程池分为二类&#xff0c;Spring-ThreadPoolTaskExecutor和JDK-ThreadPoolExecutor的&#xff0c;当然了Spring也是基于JDK做一步封装&#xff0…

​数据库原理及应用上机(实验四 SQL连接查询)

✨作者&#xff1a;命运之光 ✨专栏&#xff1a;数据库原理及应用上机实验 目录 ✨一、实验目的和要求 ✨二、实验内容及步骤 ✨三&#xff0e;实验结果 ✨四、实验总结 &#x1f353;&#x1f353;前言&#xff1a; 数据库原理及应用上机实验报告的一个简单整理后期还会不…

Zerto 10.0 发布 - 勒索软件防护、灾难恢复和多云移动性的统一解决方案

Zerto 10.0 发布 - 勒索软件防护、灾难恢复和多云移动性的统一解决方案 请访问原文链接&#xff1a;https://sysin.org/blog/zerto-10/&#xff0c;查看最新版。原创作品&#xff0c;转载请保留出处。 作者主页&#xff1a;sysin.org 携手 ZERTO 提升勒索软件保护与灾难恢复水…

Python异常处理

1. 异常概述 在程序运行过程中&#xff0c;经常会遇到各种错误&#xff0c;这些错误称为“异常”。这些异常有的是由于开发者一时疏忽将关键字敲错导致的&#xff0c;这类错误多数产生的是SyntaxError:invalid syntax&#xff08;无效的语法&#xff09;&#xff0c;这将直接导…

JVM笔记

Java中对象一定分配在堆空间上吗&#xff1f;判断一个对象是否还活着GCgc频繁 Java中对象一定分配在堆空间上吗&#xff1f; 逃逸分析&#xff1a;分析对象动态作用域&#xff0c;当一个对象在方法中被定义后&#xff0c;它可能被外部方法所引用&#xff0c;例如作为调用参数传…

Redis6.2.5安装布隆过滤器BloomFilter

最近学习需要用到布隆过滤器&#xff0c;所以去RedisLabsModules下载RedisBloom插件&#xff0c;简单介绍一下安装的过程&#xff0c;首先需要先安装好Redis&#xff0c;建议使用Redis6以上版本&#xff0c;Redis安装教程查看https://smilenicky.blog.csdn.net/article/details…

什么是客户自助服务门户及其搭建方法

随着信息技术的快速发展&#xff0c;越来越多的企业开始转向以客户为中心的服务模式&#xff0c;而客户自助服务门户&#xff08;Customer Self-Service Portal&#xff09;则成为了重要的服务方式。它可以让客户在不需要人工干预的情况下&#xff0c;自行解决问题&#xff0c;…

chatgpt赋能Python-python_ai建模

用Python构建AI模型&#xff1a;一步步解析 随着人工智能技术的发展和普及&#xff0c;越来越多的企业开始寻找高效可靠的AI建模技术来提高业务水平和竞争力。Python作为一种强大的编程语言和开发工具&#xff0c;在AI建模领域也扮演着重要的角色。本文将介绍Python AI建模的基…

chatgpt赋能Python-python_ai下载

Python AI 下载&#xff1a;实现自动化数据处理的利器 介绍 Python作为一种脚本语言&#xff0c;凭借其简洁灵活的语法、强大的库支持和生态系统&#xff0c;成为了今天最流行的编程语言之一。在人工智能领域&#xff0c;Python也是最常用的语言之一&#xff0c;因为它的开发…

18-04 数据库分布式架构

分布式ID UUID 优点&#xff1a; 使用简单无需引入额外组件 缺点 无序&#xff0c;无法实现范围查询插入操作比自增ID性能差不少&#xff08;大概四倍&#xff09;建议用自增ID&#xff08;表的主键&#xff09; UUID&#xff08;唯一标识&#xff09; Redis Incr指令优点…

Hudi系列23:常见问题

文章目录 一. 存储一直看不到数据二. 数据有重复三. NoSuchMethodError3.1 问题描述3.2 解决方案3.2.1 查看源码3.2.2 avro版本问题3.2.3 hudi-flink1.14-bundle jar包的问题 四. Merge On Read 写只有 log 文件4.1 问题描述4.2 解决方案1(测试未通过)4.2 解决方案2(测试通过:)…

[LitCTF 2023]Flag点击就送!(cookie伪造)

随便输一个名字 尝试admin 但是我们在cookie里找到了一些东西 session&#xff1a;"eyJuYW1lIjoiYWRtaW4ifQ.ZGs1vw.7ikpuOhUtXxyB2UV-FH7UGIZkaE" 想到session伪造 先说一下session的作用&#xff1a; 由于http协议是一个无状态的协议&#xff0c;也就是说同一个用…

chatgpt赋能Python-pythonseries访问元素

Python Series: 访问元素 在Python中&#xff0c;我们可以使用列表&#xff08;List&#xff09;、元组&#xff08;Tuple&#xff09;和字典&#xff08;Dictionary&#xff09;等可迭代对象存储和处理数据。在处理这些可迭代对象时&#xff0c;我们经常需要对它们的元素进行…

【WSN覆盖】基于麻雀搜索算法的二维混合无线传感器网络覆盖优化 WSN覆盖空洞修复【Matlab代码#24】

文章目录 【可更换其他算法&#xff0c;获取资源请见文章第6节&#xff1a;资源获取】1. SSA算法2. WSN节点感知模型3. 混合WSN覆盖优化4. 部分代码展示5. 仿真结果展示6. 资源获取 【可更换其他算法&#xff0c;获取资源请见文章第6节&#xff1a;资源获取】 1. SSA算法 网上…

数字逻辑(计科专业)

半加器 用与非门实现 全加器 编码器 编码就是将信息装换成独特的代码或信号输出的电路 普通编码器&#xff1a;任何时候只允许输入一个有效编码信号&#xff0c;否则输出就会发生混乱。 优先编码器&#xff1a;允许同时输入两个以上的有效编码信号。当同时输入几个有效编码信…

【算法学习系列】05 - 对数器的说明与使用

文章目录 对数器说明对数器使用创建随机样本生成器实现 isSorted(int[] arr) 函数验证排序正确性实现选择排序算法进行大样本随机测试验证算法正确性 总结 对数器说明 在算法领域中&#xff0c;对数器指的是一个用于测试算法正确性的工具。对于一个需要被测试的算法A&#xff0…

Redis分片集群搭建及其原理

Redis分片集群搭建及其原理 1.Redis分片集群1.1.搭建分片集群1.2.准备实例和配置1.3.启动1.4.创建集群1.5.测试 2.散列插槽原理2.1.插槽原理2.2.小结 3.集群伸缩3.1.需求分析3.2.创建新的redis实例3.3.添加新节点到redis3.4.转移插槽 4.故障转移4.1.自动故障转移4.2.手动故障转…

十三、进程信号

文章目录 一、什么是信号二、信号列表&#xff08;一&#xff09;查看系统定义的信号列表 三、信号处理四、信号产生&#xff08;一&#xff09;通过终端按键产生信号1.什么是核心转储&#xff1f;2.核心转储功能有什么用&#xff1f;3.core dump标志 &#xff08;二&#xff0…

计算机论文写作入门

什么是顶会 顶级会议一般是,在业界(本领域本方向)受到广泛的承认,影响力较大的会议。一方面一般顶级专家、学者都倾向于将paper投到这些 会议;另一方面这些会议的论文代表了该领域的目前很优秀、有重大意义的进展。"顶级会议"的投稿竞争压力一般都很大,属于在经典 p…