kubernetes运行应用1之Deployment
run 或create deployment 部署一个应用
kubernetes 部署 nginx ,使用 kubectl get deployment 时出现 No resources found in default namespace
结果验证:
kubectl run mcw01_nginx --image=nginx #能get pod,但不能get deployment ,不能get replicaset
kubectl create deployment mcw01dep-nginx --image=nginx #既能get pod ,又能get deployment,又能get replicaset
kubectl run nginx-deployment --image=nginx:1.7.9 --replicas=2 #它不能 创建副本了,
kubectl create deployment mcw01dep-nginx --image=nginx #那么这个命令是否可以支持创建多个副本
首先我确保了master和nodes节点的正常运行,还有各个组件处于健康状态
使用 kubectl 命令创建监听 80 端口的 Nginx Pod(Kubernetes 运行容器的最小单元)
kubectl run mcw01_nginx --image=nginx --port=80
运行结果:
[machangwei@mcw7 ~]$ kubectl run nginx-deployment --image=nginx:1.7.9 --replicas=2
Error: unknown flag: --replicas
See 'kubectl run --help' for usage.
[machangwei@mcw7 ~]$ kubectl run mcw01_nginx --image=nginx --port=80 #不能使用下划线命名,但是可以用短横线
The Pod "mcw01_nginx" is invalid:
* metadata.name: Invalid value: "mcw01_nginx": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
* spec.containers[0].name: Invalid value: "mcw01_nginx": a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')
[machangwei@mcw7 ~]$
[machangwei@mcw7 ~]$ kubectl run mcw01-nginx --image=nginx --port=80
pod/mcw01-nginx created
可以看到,这里提示只是成功创建了一个pod 叫mcw01_nginx,在以往的版本中似乎会顺便创建一个deployment,显然这里没有
使用 kubectl get deployment命令查看deployment
[machangwei@mcw7 ~]$ kubectl get deployment
No resources found in default namespace.
问题就出现了,的确没有,那我们就需要手动创建
使用 kubectl create deployment mcw01dep-nginx --image=nginx
[machangwei@mcw7 ~]$ kubectl create deployment mcw01dep-nginx --image=nginx
deployment.apps/mcw01dep-nginx created
再次使用kubectl get deployment查看,可以看到已经有了一个mcw01dep-nginx 的 deployment
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw01dep-nginx 1/1 1 1 48s
再次使用kubectl get replicaset看副本,有mcw01dep-nginx命名的副本
[machangwei@mcw7 ~]$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
mcw01dep-nginx-5dd785954d 1 1 1 6m26s
使用kubectl get pod也能看到mcw01dep-nginx命名的Pod。
[machangwei@mcw7 ~]$ kubectl get pod
NAME READY STATUS RESTARTS AGE
httpd-app 1/1 Running 0 3h12m
mcw01-nginx 1/1 Running 0 3m55s
mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 94s
mcw1httpd-app 1/1 Running 0 162m
nginx-deployment 1/1 Running 0 12m
查看刚刚部署的应用
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw01dep-nginx 1/1 1 1 9m37s
[machangwei@mcw7 ~]$ kubectl describe deployment mcw01dep-nginx
Name: mcw01dep-nginx
Namespace: default
CreationTimestamp: Tue, 04 Jan 2022 09:49:28 +0800
Labels: app=mcw01dep-nginx
Annotations: deployment.kubernetes.io/revision: 1
Selector: app=mcw01dep-nginx
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=mcw01dep-nginx
Containers:
nginx:
Image: nginx
Port: <none>
Host Port: <none>
Environment: <none>
Mounts: <none>
Volumes: <none>
Conditions:
Type Status Reason
---- ------ ------
Available True MinimumReplicasAvailable
Progressing True NewReplicaSetAvailable
OldReplicaSets: <none>
NewReplicaSet: mcw01dep-nginx-5dd785954d (1/1 replicas created)
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ScalingReplicaSet 10m deployment-controller Scaled up replica set mcw01dep-nginx-5dd785954d to 1
查看刚刚部署的应用的副本
[machangwei@mcw7 ~]$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
mcw01dep-nginx-5dd785954d 1 1 1 15m
[machangwei@mcw7 ~]$ kubectl describe replicaset mcw01dep-nginx-5dd785954d
Name: mcw01dep-nginx-5dd785954d
Namespace: default
Selector: app=mcw01dep-nginx,pod-template-hash=5dd785954d
Labels: app=mcw01dep-nginx
pod-template-hash=5dd785954d
Annotations: deployment.kubernetes.io/desired-replicas: 1
deployment.kubernetes.io/max-replicas: 2
deployment.kubernetes.io/revision: 1
Controlled By: Deployment/mcw01dep-nginx
Replicas: 1 current / 1 desired
Pods Status: 1 Running / 0 Waiting / 0 Succeeded / 0 Failed
Pod Template:
Labels: app=mcw01dep-nginx
pod-template-hash=5dd785954d
Containers:
nginx:
Image: nginx
Port: <none>
Host Port: <none>
Environment: <none>
Mounts: <none>
Volumes: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 15m replicaset-controller Created pod: mcw01dep-nginx-5dd785954d-sb8ps
查看刚刚部署的应用的Pod信息
[machangwei@mcw7 ~]$ kubectl describe pod mcw01dep-nginx-5dd785954d-sb8ps
Name: mcw01dep-nginx-5dd785954d-sb8ps
Namespace: default
Priority: 0
Node: mcw9/10.0.0.139
Start Time: Tue, 04 Jan 2022 09:49:27 +0800
Labels: app=mcw01dep-nginx
pod-template-hash=5dd785954d
Annotations: <none>
Status: Running
IP: 10.244.0.4
IPs:
IP: 10.244.0.4
Controlled By: ReplicaSet/mcw01dep-nginx-5dd785954d
Containers:
nginx:
Container ID: docker://374ff9c1a60e9562f7e05ec4eaa5150e3380b836a26f3b0fe565e6f9dea52cef
Image: nginx
Image ID: docker-pullable://nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Port: <none>
Host Port: <none>
State: Running
Started: Tue, 04 Jan 2022 09:49:30 +0800
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-h56zh (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-h56zh:
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 18m default-scheduler Successfully assigned default/mcw01dep-nginx-5dd785954d-sb8ps to mcw9
Normal Pulling 18m kubelet Pulling image "nginx"
Normal Pulled 18m kubelet Successfully pulled image "nginx" in 1.193138975s
Normal Created 18m kubelet Created container nginx
Normal Started 18m kubelet Started container nginx
指定命名空间的查询Pod详情,应该是一样的
[machangwei@mcw7 ~]$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default httpd-app 1/1 Running 0 3h31m
default mcw01-nginx 1/1 Running 0 22m
default mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 20m
default mcw1httpd-app 1/1 Running 0 3h1m
default nginx-deployment 1/1 Running 0 31m
kube-system coredns-6d8c4cb4d-2296m 1/1 Running 1 (9h ago) 13h
kube-system coredns-6d8c4cb4d-lphb2 1/1 Running 1 (9h ago) 13h
kube-system etcd-mcw7 1/1 Running 3 13h
kube-system kube-apiserver-mcw7 1/1 Running 2 13h
kube-system kube-controller-manager-mcw7 1/1 Running 4 (9h ago) 13h
kube-system kube-flannel-ds-5pxmj 0/1 Error 102 (5m12s ago) 8h
kube-system kube-flannel-ds-8gzfq 1/1 Running 0 9h
kube-system kube-flannel-ds-s4qmj 0/1 CrashLoopBackOff 95 (62s ago) 7h46m
kube-system kube-proxy-4lmsx 1/1 Running 0 8h
kube-system kube-proxy-c5zmm 1/1 Running 0 13h
kube-system kube-proxy-npmtv 1/1 Running 0 7h46m
kube-system kube-scheduler-mcw7 1/1 Running 3 (9h ago) 13h
[machangwei@mcw7 ~]$ kubectl describe pod mcw01dep-nginx-5dd785954d-sb8ps --namespace=default
Name: mcw01dep-nginx-5dd785954d-sb8ps
Namespace: default
Priority: 0
Node: mcw9/10.0.0.139
Start Time: Tue, 04 Jan 2022 09:49:27 +0800
Labels: app=mcw01dep-nginx
pod-template-hash=5dd785954d
Annotations: <none>
Status: Running
IP: 10.244.0.4
IPs:
IP: 10.244.0.4
Controlled By: ReplicaSet/mcw01dep-nginx-5dd785954d
Containers:
nginx:
Container ID: docker://374ff9c1a60e9562f7e05ec4eaa5150e3380b836a26f3b0fe565e6f9dea52cef
Image: nginx
Image ID: docker-pullable://nginx@sha256:0d17b565c37bcbd895e9d92315a05c1c3c9a29f762b011a10c54a66cd53c9b31
Port: <none>
Host Port: <none>
State: Running
Started: Tue, 04 Jan 2022 09:49:30 +0800
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-h56zh (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-h56zh:
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 21m default-scheduler Successfully assigned default/mcw01dep-nginx-5dd785954d-sb8ps to mcw9
Normal Pulling 21m kubelet Pulling image "nginx"
Normal Pulled 21m kubelet Successfully pulled image "nginx" in 1.193138975s
Normal Created 21m kubelet Created container nginx
Normal Started 21m kubelet Started container nginx
[machangwei@mcw7 ~]$
对刚刚部署的应用做几种资源的查询
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw01dep-nginx 1/1 1 1 23m
[machangwei@mcw7 ~]$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
mcw01dep-nginx-5dd785954d 1 1 1 23m
[machangwei@mcw7 ~]$ kubectl get pod |grep mcw01dep-nginx
mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 23m
[machangwei@mcw7 ~]$ kubectl get pod -o wide |grep mcw01dep-nginx
mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 23m 10.244.0.4 mcw9 <none> <none>
[machangwei@mcw7 ~]$ kubectl get pod --all-namespaces |grep mcw01dep-nginx
default mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 24m
创建同名的deployment是不可以的
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw01dep-nginx 1/1 1 1 31m
[machangwei@mcw7 ~]$ kubectl create deployment mcw01dep-nginx --image=nginx
error: failed to create deployment: deployments.apps "mcw01dep-nginx" already exists
使用负载均衡模式发布服务,让外网访问我的Nginx服务(docker)
kubectl expose deployment mcw01dep-nginx --port=80 --type=LoadBalancer
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw01dep-nginx 1/1 1 1 33m
[machangwei@mcw7 ~]$ kubectl expose deployment mcw01dep-nginx --port=80 --type=LoadBalancer
service/mcw01dep-nginx exposed
查看服务详情
kubectl describe service mcw01dep-nginx
输出如下:
[machangwei@mcw7 ~]$ kubectl get service #获取服务信息
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 13h
mcw01dep-nginx LoadBalancer 10.96.184.54 <pending> 80:30102/TCP 74s
[machangwei@mcw7 ~]$ kubectl describe service mcw01dep-nginx
Name: mcw01dep-nginx
Namespace: default
Labels: app=mcw01dep-nginx
Annotations: <none>
Selector: app=mcw01dep-nginx
Type: LoadBalancer
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.96.184.54
IPs: 10.96.184.54
Port: <unset> 80/TCP
TargetPort: 80/TCP
NodePort: <unset> 30102/TCP
Endpoints: 10.244.0.4:80
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
这里我就可以利用 节点的ip+暴露出来的端口 检测服务是否访问成功
[machangwei@mcw7 ~]$ kubectl get pod -o wide |grep mcw01dep-nginx
mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 43m 10.244.0.4 mcw9 <none> <none>
[machangwei@mcw7 ~]$ kubectl describe pod mcw01dep-nginx-5dd785954d-sb8ps|grep Node:
Node: mcw9/10.0.0.139
由上找到服务所在的Node ip ,找到服务暴露出来的NodePort ,然后在外部就可以使用Node ip :NodePort来访问服务
比如这里的访问:
我在master节点访问node2节点上的服务,这个服务是node2ip,端口,映射到node2的应用docker上的80服务
[machangwei@mcw7 ~]$ curl 10.0.0.139:30102
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>
笔记本浏览器上访问:
进入服务所在的主机节点,查看容器的ip,与之前看的容器ip等信息一致
[root@mcw9 ~]$ docker ps|grep mcw01dep-nginx
374ff9c1a60e nginx "/docker-entrypoint.…" 49 minutes ago Up 49 minutes k8s_nginx_mcw01dep-nginx-5dd785954d-sb8ps_default_13d59a7a-c16f-44f1-b442-de7252ae4bac_0
388265797ee1 registry.aliyuncs.com/google_containers/pause:3.6 "/pause" 49 minutes ago Up 49 minutes k8s_POD_mcw01dep-nginx-5dd785954d-sb8ps_default_13d59a7a-c16f-44f1-b442-de7252ae4bac_0
[root@mcw9 ~]$ docker exec -it 374 hostname -i
10.244.0.4
[root@mcw9 ~]$ docker exec -it 388 hostname -i
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "hostname": executable file not found in $PATH: unknown
[root@mcw9 ~]$
在Nginx服务的主机上,是能直接通容器ip的
[root@mcw9 ~]$ docker exec -it 374 hostname -i
10.244.0.4
[root@mcw9 ~]$ docker exec -it 388 hostname -i
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "hostname": executable file not found in $PATH: unknown
[root@mcw9 ~]$
[root@mcw9 ~]$
[root@mcw9 ~]$
[root@mcw9 ~]$
[root@mcw9 ~]$ ping 10.244.0.4
PING 10.244.0.4 (10.244.0.4) 56(84) bytes of data.
64 bytes from 10.244.0.4: icmp_seq=1 ttl=64 time=0.256 ms
64 bytes from 10.244.0.4: icmp_seq=2 ttl=64 time=0.059 ms
^C
--- 10.244.0.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.059/0.157/0.256/0.099 ms
[root@mcw9 ~]$ curl 10.244.0.4:80
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>
[root@mcw9 ~]$
命令行部署多个副本的应用
部署多个Nginx,然后可以用上面那个例子,去做负载均衡了
[machangwei@mcw7 ~]$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
mcw-depcluster 3/3 3 3 92s
mcw01dep-nginx 1/1 1 1 61m
[machangwei@mcw7 ~]$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
mcw-depcluster-547cfdc745 3 3 3 101s
mcw01dep-nginx-5dd785954d 1 1 1 61m
[machangwei@mcw7 ~]$ kubectl get pod
NAME READY STATUS RESTARTS AGE
httpd-app 1/1 Running 0 4h12m
mcw-depcluster-547cfdc745-258sz 1/1 Running 0 118s
mcw-depcluster-547cfdc745-q2785 1/1 Running 0 118s
mcw-depcluster-547cfdc745-wrq74 1/1 Running 0 118s
mcw01-nginx 1/1 Running 0 63m
mcw01dep-nginx-5dd785954d-sb8ps 1/1 Running 0 61m
mcw1httpd-app 1/1 Running 0 3h42m
nginx-deployment 1/1 Running 0 71m
[machangwei@mcw7 ~]$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default httpd-app 1/1 Running 0 4h13m
default mcw-depcluster-547cfdc745-258sz 1/1 Running 0 2m49s
default mcw-depcluster-547cfdc745-q2785 1/1 Running 0 2m49s
default mcw-depcluster-547cfdc745-wrq74 1/1 Running 0 2m49s
kubernetes运行应用1之Deployment的更多相关文章
- kubernetes运行应用2之DaemonSet详解
kubernetes运行应用1之Deployment详解 查看daemonset 如下,k8s自身的 DaemonSet kube-flannel-ds和kube-proxy分别负责在每个结点上运 ...
- gearman kubernetes 运行
备注: 使用的是golang 版本的实现,同时官方也提供了一个k8s 的helm 部署charts,我 没有使用这个helm,而是通过kompose 这个工具直接转换的 docker-compose ...
- 在kubernetes运行一个容器案例
1. 检查kubernetes 组件是否正常运行. [root@c720120 ~]# kubectl get cs NAME STATUS MESSAGE ...
- (六)Kubernetes Pod控制器-ReplicaSet和Deployment和DaemonSet
Pod控制器相关知识 控制器的必要性 自主式Pod对象由调度器调度到目标工作节点后即由相应节点上的kubelet负责监控其容器的存活状态,容器主进程崩溃后,kubelet能够自动重启相应的容器.但对出 ...
- kubernetes发布tomcat服务,通过deployment,service布署
1.制作tomcat镜像 参考docker tomcat镜像制作 此处直接拉取 查看已有可镜像 先设置docker阿里源,即添加 "registry-mirrors": [&quo ...
- apache flink kubernetes 运行试用
类似docker-compose 运行模式,使用的是deploy 的模式 deploy yaml 文件 deploy-k8s-yaml apiVersion: extensions/v1beta1 k ...
- kubernetes发布tomcat服务,通过deployment,service布署(转)
1.制作tomcat镜像 参考docker tomcat镜像制作 此处直接拉取 查看已有可镜像 先设置docker阿里源,即添加 "registry-mirrors": [&quo ...
- Kubernetes 实战——升级应用(Deployment)
一.更新运行在 Pod 内的应用程序 1. 修改 Pod 模板 将导致应用程序在一定时间内不可用 2. 修改 Service 的 Pod 选择器 需要同时运行两倍的 Pod 3. 滚动升级 应用程序需 ...
- kubernetes学习之service、deployment、pod的关系
deployment根据Pod的标签关联到Pod,是为了管理pod的生命周期 service根据Pod的标签关联到pod,是为了让外部访问到pod,给pod做负载均衡 需要注意: deployment ...
随机推荐
- Output of C++ Program | Set 10
Predict the output of following C++ programs. Question 1 1 #include<iostream> 2 #include<st ...
- Linux shell实现每天定时备份mysql数据库
每天定时备份mysql数据库任务,删除指定天数前的数据,保留指定天的数据: 需求: 1,每天4点备份mysql数据: 2,为节省空间,删除超过3个月的所有备份数据: 3,删除超过7天的备份数据,保留3 ...
- 【Spring Framework】Spring入门教程(八)Spring的事务管理
事务是什么? 事务:指单个逻辑操作单元的集合. 在操作数据库时(增删改),如果同时操作多次数据,我们从业务希望,要么全部成功,要么全部失败.这种情况称为事务处理. 例如:A转账给B. 第一步,扣除A君 ...
- Maven的聚合工程(多模块工程)
在开发2个以上模块的时候,每个模块都是一个 Maven Project.比如搜索平台,学习平台,考试平台.开发的时候可以自己管自己独立编译,测试,运行.但如果想要将他们整合起来,我们就需要一个聚合工程 ...
- 回溯——51. N皇后
这一题在我刚开始拿到的时候,是一点思路都没有的,只能先分析题目的要求,即queen之间的规则: 不能同行 不能同列 不能同斜线 不能同左斜 不能同右斜 同时发现,在寻找所有可能结果的穷举过程中,传入的 ...
- Redis | 第12章 Sentinel 哨兵模式《Redis设计与实现》
目录 前言 1. 启动并初始化 Sentinel 2. Sentinel 与服务器间的默认通信 2.1 获取主服务器信息 2.2 获取从服务器信息 2.3 向主服务器和从服务器发送信息 3. 接受来自 ...
- 第45篇-查找native方法的本地实现函数native_function
在之前介绍为native方法设置解释执行的入口时讲到过Method实例的内存布局,如下: 对于第1个slot来说,如果是native方法,其对应的本地函数的实现会放到Method实例的native_f ...
- SpringBoot Redis 发布订阅模式 Pub/Sub
SpringBoot Redis 发布订阅模式 Pub/Sub 注意:redis的发布订阅模式不可以将消息进行持久化,订阅者发生网络断开.宕机等可能导致错过消息. Redis命令行下使用发布订阅 pu ...
- Excel数据导出功能
HTML代码: <a id="aExportData" hidden><span>Export</span></a> <div ...
- SQL:查询Mysql表结构
背景:有时需要做数据字典,其中最重要的就是表结构.经整理,编写SQL如下: 代码: 1 -- drop TABLE `cfg_data_dict` ; 2 CREATE TABLE `cfg_data ...