主頁 > 作業系統 > 附009.Kubernetes永久存盤之GlusterFS獨立部署

附009.Kubernetes永久存盤之GlusterFS獨立部署

2020-10-04 07:46:51 作業系統

一 前期準備

1.1 基礎知識

Heketi提供了一個RESTful管理界面,可以用來管理GlusterFS卷的生命周期,Heketi會動態在集群內選擇bricks構建所需的volumes,從而確保資料的副本會分散到集群不同的故障域內,同時Heketi還支持任意數量的ClusterFS集群, 提示:本實驗基于glusterfs和Kubernetes分開部署,heketi管理glusterfs,Kubernetes使用heketi提供的API,從而實作glusterfs的永久存盤,,而非Kubernetes部署glusterfs,

1.2 架構示意


clipboard 提示:本實驗Heketi僅管理單zone的glusterfs集群,

1.3 相關規劃

主機 IP 磁盤 備注
servera 172.24.8.41 sdb glusterfs節點
serverb 172.24.8.42 sdb glusterfs節點
serverc 172.24.8.43 sdb glusterfs節點
heketi 172.24.8.44 Heketi主機

servera serverb serverc
PV sdb1 sdb1 sdb1
VG vg0 vg0 vg0
LV datalv datalv datalv
bricks目錄 /bricks/data /bricks/data /bricks/data

1.4 其他準備

所有節點NTP配置; 所有節點添加相應主機名決議: 172.24.8.41 servera 172.24.8.42 serverb 172.24.8.43 serverc 172.24.8.44 heketi 注意:若非必要,建議關閉防火墻和SELinux,

二 規劃相應存盤卷

2.1 劃分LVM

  1 [root@servera ~]# fdisk /dev/sdb				#創建lvm的sdb1,程序略
  2 [root@servera ~]# pvcreate /dev/sdb1			#使用/dev/vdb1創建PV
  3 [root@servera ~]# vgcreate vg0 /dev/sdb1			#創建vg
  4 [root@servera ~]# lvcreate -L 15G -T vg0/thinpool		#創建支持thin的lv池
  5 [root@servera ~]# lvcreate -V 10G -T vg0/thinpool -n datalv	#創建相應brick的lv
  6 [root@servera ~]# vgdisplay					#驗證確認vg資訊
  7 [root@servera ~]# pvdisplay					#驗證確認pv資訊
  8 [root@servera ~]# lvdisplay					#驗證確認lv資訊
提示:serverb、serverc類似操作,根據規劃需求創建完所有基于LVM的brick,

三 安裝glusterfs

3.1 安裝相應RPM源

  1 [root@servera ~]# yum -y install centos-release-gluster
提示:serverb、serverc、client類似操作,安裝相應glusterfs源; 安裝相應源之后,會在/etc/yum.repos.d/目錄多出檔案CentOS-Storage-common.repo,內容如下:
  1 # CentOS-Storage.repo
  2 #
  3 # Please see http://wiki.centos.org/SpecialInterestGroup/Storage for more
  4 # information
  5 
  6 [centos-storage-debuginfo]
  7 name=CentOS-$releasever - Storage SIG - debuginfo
  8 baseurl=http://debuginfo.centos.org/$contentdir/$releasever/storage/$basearch/
  9 gpgcheck=1
 10 enabled=0
 11 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Storage

3.2 安裝glusterfs

  1 [root@servera ~]# yum -y install glusterfs-server
提示:serverb、serverc類似操作,安裝glusterfs服務端,

3.3 啟動glusterfs

  1 [root@servera ~]# systemctl start glusterd
  2 [root@servera ~]# systemctl enable glusterd
提示:serverb、serverc類似操作,所有節點啟動glusterfs服務端; 安裝完glusterfs之后建議exit退出終端重新登錄,從而可以補全glusterfs相關命令,

3.4 添加信任池

  1 [root@servera ~]# gluster peer probe serverb
  2 peer probe: success.
  3 [root@servera ~]# gluster peer probe serverc
  4 peer probe: success.
  5 [root@servera ~]# gluster peer status		#查看信任池狀態
  6 [root@servera ~]# gluster pool list			#查看信任池串列
clipboard 提示:加信任池的操作,只需要在servera、serverb、serverc所有集群節點主機中的任意一臺上面執行添加其他三個節點的操作即可, 提示:若未關閉防火墻,在添加信任池之前必須放通防火墻相應規則,操作如下:
  1 [root@servera ~]# firewall-cmd --permanent --add-service=glusterfs
  2 [root@servera ~]# firewall-cmd --permanent --add-service=nfs
  3 [root@servera ~]# firewall-cmd --permanent --add-service=rpc-bind
  4 [root@servera ~]# firewall-cmd --permanent --add-service=mountd
  5 [root@servera ~]# firewall-cmd --permanent --add-port=5666/tcp
  6 [root@servera ~]# firewall-cmd --reload

四 部署Heketi

4.1 安裝heketi服務

  1 [root@heketi ~]# yum -y install centos-release-gluster
  2 [root@heketi ~]# yum -y install heketi heketi-client

4.2 配置heketi

  1 [root@heketi ~]# vi /etc/heketi/heketi.json
  2 {
  3   "_port_comment": "Heketi Server Port Number",
  4   "port": "8080",					#默認埠
  5 
  6   "_use_auth": "Enable JWT authorization. Please enable for deployment",
  7   "use_auth": true,					#基于安全考慮開啟認證
  8 
  9   "_jwt": "Private keys for access",
 10   "jwt": {
 11     "_admin": "Admin has access to all APIs",
 12     "admin": {
 13       "key": "admin123"					#管理員密碼
 14     },
 15     "_user": "User only has access to /volumes endpoint",
 16     "user": {
 17       "key": "xianghy"					#普通用戶
 18     }
 19   },
 20 
 21   "_glusterfs_comment": "GlusterFS Configuration",
 22   "glusterfs": {
 23     "_executor_comment": [
 24       "Execute plugin. Possible choices: mock, ssh",
 25       "mock: This setting is used for testing and development.",	#用于測驗
 26       "      It will not send commands to any node.",
 27       "ssh:  This setting will notify Heketi to ssh to the nodes.",	#ssh方式
 28       "      It will need the values in sshexec to be configured.",
 29       "kubernetes: Communicate with GlusterFS containers over",		#在GlusterFS由kubernetes創建時采用
 30       "            Kubernetes exec api."
 31     ],
 32     "executor": "ssh",
 33 
 34     "_sshexec_comment": "SSH username and private key file information",
 35     "sshexec": {
 36       "keyfile": "/etc/heketi/heketi_key",
 37       "user": "root",
 38       "port": "22",
 39       "fstab": "/etc/fstab"
 40     },
 41 ……
 42 ……
 43     "loglevel" : "warning"
 44   }
 45 }

4.3 配置免秘鑰

  1 [root@heketi ~]# ssh-keygen -t rsa -q -f /etc/heketi/heketi_key -N ""
  2 [root@heketi ~]# chown heketi:heketi /etc/heketi/heketi_key
  3 [root@heketi ~]# ssh-copy-id -i /etc/heketi/heketi_key.pub root@servera
  4 [root@heketi ~]# ssh-copy-id -i /etc/heketi/heketi_key.pub root@serverb
  5 [root@heketi ~]# ssh-copy-id -i /etc/heketi/heketi_key.pub root@serverc

4.4 啟動heketi

  1 [root@heketi ~]# systemctl enable heketi.service
  2 [root@heketi ~]# systemctl start heketi.service
  3 [root@heketi ~]# systemctl status heketi.service
  4 [root@heketi ~]# curl http://localhost:8080/hello		#測驗訪問
  5 Hello from Heketi

4.5 配置Heketi拓撲

       拓撲資訊用于讓Heketi確認可以使用的存盤節點、磁盤和集群,必須自行確定節點的故障域,故障域是賦予一組節點的整數值,這組節點共享相同的交換機、電源或其他任何會導致它們同時失效的組件,必須確認哪些節點構成一個集群,Heketi使用這些資訊來確保跨故障域中創建副本,從而提供資料冗余能力,Heketi支持多個Gluster存盤集群, 配置Heketi拓撲注意以下幾點:
  • 可以通過topology.json檔案定義組建的GlusterFS集群;
  • topology指定了層級關系:clusters --> nodes --> node/devices --> hostnames/zone;
  • node/hostnames欄位的manage建議填寫主機ip,指管理通道,注意當heketi服務器不能通過hostname訪問GlusterFS節點時不能填寫hostname;
  • node/hostnames欄位的storage建議填寫主機ip,指存盤資料通道,與manage可以不一樣,生產環境管理網路和存盤網路建議分離;
  • node/zone欄位指定了node所處的故障域,heketi通過跨故障域創建副本,提高資料高可用性質,如可以通過rack的不同區分zone值,創建跨機架的故障域;
  • devices欄位指定GlusterFS各節點的盤符(可以是多塊盤),必須是未創建檔案系統的裸設備,
  1 [root@heketi ~]# vi /etc/heketi/topology.json
  2 {
  3     "clusters": [
  4         {
  5             "nodes": [
  6                 {
  7                     "node": {
  8                         "hostnames": {
  9                             "manage": [
 10                                 "172.24.8.41"
 11                             ],
 12                             "storage": [
 13                                 "172.24.8.41"
 14                             ]
 15                         },
 16                         "zone": 1
 17                     },
 18                     "devices": [
 19                         "/dev/mapper/vg0-datalv"
 20                     ]
 21                 },
 22                 {
 23                     "node": {
 24                         "hostnames": {
 25                             "manage": [
 26                                 "172.24.8.42"
 27                             ],
 28                             "storage": [
 29                                 "172.24.8.42"
 30                             ]
 31                         },
 32                         "zone": 1
 33                     },
 34                     "devices": [
 35                         "/dev/mapper/vg0-datalv"
 36                     ]
 37                 },
 38                 {
 39                     "node": {
 40                         "hostnames": {
 41                             "manage": [
 42                                 "172.24.8.43"
 43                             ],
 44                             "storage": [
 45                                 "172.24.8.43"
 46                             ]
 47                         },
 48                         "zone": 1
 49                     },
 50                     "devices": [
 51                         "/dev/mapper/vg0-datalv"
 52                     ]
 53                 }
 54             ]
 55         }
 56     ]
 57 }
 58 
 59 [root@heketi ~]# echo "export HEKETI_CLI_SERVER=http://heketi:8080" >> /etc/profile.d/heketi.sh
 60 [root@heketi ~]# echo "alias heketi-cli='heketi-cli --user admin --secret admin123'" >> .bashrc
 61 [root@heketi ~]# source /etc/profile.d/heketi.sh
 62 [root@heketi ~]# source .bashrc
 63 [root@heketi ~]# echo $HEKETI_CLI_SERVER
 64 http://heketi:8080
 65 [root@heketi ~]# heketi-cli --server $HEKETI_CLI_SERVER --user admin --secret admin123 topology load --json=/etc/heketi/topology.json
clipboard

4.6 集群管理

  1 [root@heketi ~]# heketi-cli cluster list					#集群串列
  2 [root@heketi ~]# heketi-cli cluster info aa83b0045fafa362bfc7a8bfee0c24ad	#集群詳細資訊
  3 Cluster id: aa83b0045fafa362bfc7a8bfee0c24ad
  4 Nodes:
  5 189ee41572ebf0bf1e297de2302cfb39
  6 46429de5666fc4c6cc570da4b100465d
  7 be0209387384299db34aaf8377c3964c
  8 Volumes:
  9 
 10 Block: true
 11 
 12 File: true
 13 [root@heketi ~]# heketi-cli topology info aa83b0045fafa362bfc7a8bfee0c24ad	#查看拓撲資訊
clipboard
  1 [root@heketi ~]# heketi-cli node list						#卷資訊
  2 Id:189ee41572ebf0bf1e297de2302cfb39     Cluster:aa83b0045fafa362bfc7a8bfee0c24ad
  3 Id:46429de5666fc4c6cc570da4b100465d     Cluster:aa83b0045fafa362bfc7a8bfee0c24ad
  4 Id:be0209387384299db34aaf8377c3964c     Cluster:aa83b0045fafa362bfc7a8bfee0c24ad
  5 [root@heketi ~]# heketi-cli node info 189ee41572ebf0bf1e297de2302cfb39		#節點資訊
  6 [root@heketi ~]# heketi-cli volume create --size=2 --replica=2			#默認為3副本的replica模式
clipboard
  1 [root@heketi ~]# heketi-cli volume list						#卷資訊
  2 [root@heketi ~]# heketi-cli volume info 7da55685ebeeaaca60708cd797a5e391
  3 [root@servera ~]# gluster volume info						#通過glusterfs節點查看

4.7 測驗驗證

  1 [root@heketi ~]# yum -y install centos-release-gluster
  2 [root@heketi ~]# yum -y install glusterfs-fuse					#安裝glusterfs-fuse
  3 [root@heketi ~]# mount -t glusterfs 172.24.8.41:vol_7da55685ebeeaaca60708cd797a5e391 /mnt
clipboard
  1 [root@heketi ~]# umount /mnt
  2 [root@heketi ~]# heketi-cli volume delete 7da55685ebeeaaca60708cd797a5e391	#驗證完畢洗掉
參考:https://www.jianshu.com/p/1069ddaaea78 https://www.cnblogs.com/panwenbin-logs/p/10231859.html

五 Kubernetes動態掛載glusterfs

5.1 StorageClass動態存盤

kubernetes共享存盤provider模式: 靜態模式(Static):集群管理員手工創建PV,在定義PV時設定后端存盤的特性; 動態模式(Dynamic):集群管理員不需要手工創建PV,而是通過StorageClass的設定對后端存盤進行描述,標記為某種"型別(Class)";此時要求PVC對存盤的型別進行說明,系統將自動完成PV的創建及與PVC的系結;PVC可以宣告Class為"",說明PVC禁止使用動態模式, 基于StorageClass的動態存盤供應整體程序如下圖所示: clipboard
  1. 集群管理員預先創建存盤類(StorageClass);
  2. 用戶創建使用存盤類的持久化存盤宣告(PVC:PersistentVolumeClaim);
  3. 存盤持久化宣告通知系統,它需要一個持久化存盤(PV: PersistentVolume);
  4. 系統讀取存盤類的資訊;
  5. 系統基于存儲類的資訊,在后臺自動創建PVC需要的PV;
  6. 用戶創建一個使用PVC的Pod;
  7. Pod中的應用通過PVC進行資料的持久化;
  8. 而PVC使用PV進行資料的最終持久化處理,
提示:關于Kubernetes的部署參考《附003.Kubeadm部署Kubernetes》,

5.2 定義StorageClass

關鍵字說明:
  • provisioner:表示存盤分配器,需要根據后端存盤的不同而變更;
  • reclaimPolicy: 默認即”Delete”,洗掉pvc后,相應的pv及后端的volume,brick(lvm)等一起洗掉;設定為”Retain”時則保留資料,若需洗掉則需要手工處理;
  • resturl:heketi API服務提供的url;
  • restauthenabled:可選引數,默認值為”false”,heketi服務開啟認證時必須設定為”true”;
  • restuser:可選引數,開啟認證時設定相應用戶名;
  • secretNamespace:可選引數,開啟認證時可以設定為使用持久化存盤的namespace;
  • secretName:可選引數,開啟認證時,需要將heketi服務的認證密碼保存在secret資源中;
  • clusterid:可選引數,指定集群id,也可以是1個clusterid串列,格式為”id1,id2”;
  • volumetype:可選引數,設定卷型別及其引數,如果未分配卷型別,則有分配器決定卷型別;如”volumetype: replicate:3”表示3副本的replicate卷,”volumetype: disperse:4:2”表示disperse卷,其中‘4’是資料,’2’是冗余校驗,”volumetype: none”表示distribute卷
提示:關于glusterfs各種不同型別的卷見《004.RHGS-創建volume》,
  1 [root@k8smaster01 ~]# kubectl create ns heketi		#創建命名空間
  2 [root@k8smaster01 ~]# echo -n "admin123" | base64		#將密碼轉換為64位編碼
  3 YWRtaW4xMjM=
  4 [root@k8smaster01 ~]# mkdir -p heketi
  5 [root@k8smaster01 ~]# cd heketi/
  6 [root@k8smaster01 ~]# vi heketi-secret.yaml			#創建用于保存密碼的secret
  7 apiVersion: v1
  8 kind: Secret
  9 metadata:
 10   name: heketi-secret
 11   namespace: heketi
 12 data:
 13   # base64 encoded password. E.g.: echo -n "mypassword" | base64
 14   key: YWRtaW4xMjM=
 15 type: kubernetes.io/glusterfs
 16 [root@k8smaster01 heketi]# kubectl create -f heketi-secret.yaml	#創建heketi
 17 [root@k8smaster01 heketi]# kubectl get secrets -n heketi
 18 NAME                  TYPE                                  DATA   AGE
 19 default-token-5sn5d   kubernetes.io/service-account-token   3      43s
 20 heketi-secret         kubernetes.io/glusterfs               1      5s
 21 [root@kubenode1 heketi]# vim gluster-heketi-storageclass.yaml	#正式創建StorageClass
 22 apiVersion: storage.k8s.io/v1
 23 kind: StorageClass
 24 metadata:
 25   name: gluster-heketi-storageclass
 26 parameters:
 27   resturl: "http://172.24.8.44:8080"
 28   clusterid: "aa83b0045fafa362bfc7a8bfee0c24ad"
 29   restauthenabled: "true"					#若heketi開啟認證此處也必須開啟auth認證
 30   restuser: "admin"
 31   secretName: "heketi-secret"				#name/namespace與secret資源中定義一致
 32   secretNamespace: "heketi"
 33   volumetype: "replicate:3"
 34 provisioner: kubernetes.io/glusterfs
 35 reclaimPolicy: Delete
 36 [root@k8smaster01 heketi]# kubectl create -f gluster-heketi-storageclass.yaml
注意:storageclass資源創建后不可變更,如修改只能洗掉后重建,
  1 [root@k8smaster01 heketi]# kubectl get storageclasses		#查看確認
  2 NAME                          PROVISIONER               AGE
  3 gluster-heketi-storageclass   kubernetes.io/glusterfs   85s
  4 [root@k8smaster01 heketi]# kubectl describe storageclasses gluster-heketi-storageclass
clipboard

5.3 定義PVC

  1 [root@k8smaster01 heketi]# cat gluster-heketi-pvc.yaml
  2 apiVersion: v1
  3 metadata:
  4   name: gluster-heketi-pvc
  5   annotations:
  6     volume.beta.kubernetes.io/storage-class: gluster-heketi-storageclass
  7 spec:
  8   accessModes:
  9   - ReadWriteOnce
 10   resources:
 11     requests:
 12       storage: 1Gi
注意:accessModes可有如下簡寫:
  • ReadWriteOnce:簡寫RWO,讀寫權限,且只能被單個node掛載;
  • ReadOnlyMany:簡寫ROX,只讀權限,允許被多個node掛載;
  • ReadWriteMany:簡寫RWX,讀寫權限,允許被多個node掛載,
  1 [root@k8smaster01 heketi]# kubectl create -f gluster-heketi-pvc.yaml
  2 [root@k8smaster01 heketi]# kubectl get pvc
  3 [root@k8smaster01 heketi]# kubectl describe pvc gluster-heketi-pvc
  4 [root@k8smaster01 heketi]# kubectl get pv
  5 [root@k8smaster01 heketi]# kubectl describe pv pvc-5f7420ef-082d-11ea-badf-000c29fa7a79
clipboard
  1 [root@k8smaster01 heketi]# kubectl describe endpoints glusterfs-dynamic-5f7420ef-082d-11ea-badf-000c29fa7a79
clipboard 提示:由上可知:PVC狀態為Bound,Capacity為1G,查看PV詳細資訊,除容量,參考storageclass資訊,狀態,回收策略等外,同時可知GlusterFS的Endpoint與path,EndpointsName為固定格式:glusterfs-dynamic-PV_NAME,且endpoints資源中指定了掛載存盤時的具體地址,

5.4 確認查看

通過5.3所創建的資訊:
  • volume與brick已經創建;
  • 主掛載點(通信)在172.24.8.41節點,其余兩個節點備選;
  • 三副本的情況下,所有節點都會創建brick,
  1 [root@heketi ~]# heketi-cli topology info			#heketi主機查看
  2 [root@serverb ~]# lsblk						#glusterfs節點查看
  3 [root@serverb ~]# df -hT					#glusterfs節點查看
  4 [root@servera ~]# gluster volume list				#glusterfs節點查看
  5 [root@servera ~]# gluster volume info vol_e4c948687239df9833748d081ddb6fd5
clipboard

5.5 Pod掛載測驗

  1 [root@xxx ~]# yum -y install centos-release-gluster
  2 [root@xxx ~]# yum -y install glusterfs-fuse					#安裝glusterfs-fuse
提示:所有需要使用glusterfs volume的Kubernetes節點都必須安裝glusterfs-fuse以便于正常掛載,同時版本需要和glusterfs節點一致,
  1 [root@k8smaster01 heketi]# vi gluster-heketi-pod.yaml
  2 kind: Pod
  3 apiVersion: v1
  4 metadata:
  5   name: gluster-heketi-pod
  6 spec:
  7   containers:
  8   - name: gluster-heketi-container
  9     image: busybox
 10     command:
 11     - sleep
 12     - "3600"
 13     volumeMounts:
 14     - name: gluster-heketi-volume			#必須和volumes中name一致
 15       mountPath: "/pv-data"
 16       readOnly: false
 17   volumes:
 18   - name: gluster-heketi-volume
 19     persistentVolumeClaim:
 20       claimName: gluster-heketi-pvc			#必須和5.3創建的PVC中的name一致
 21 [root@k8smaster01 heketi]# kubectl create -f gluster-heketi-pod.yaml -n heketi		#創建Pod

5.6 確認驗證

  1 [root@k8smaster01 heketi]# kubectl get pod -n heketi | grep gluster
  2 gluster-heketi-pod          1/1     Running   0          2m43s
  3 [root@k8smaster01 heketi]# kubectl exec -it gluster-heketi-pod /bin/sh		#進入Pod寫入測驗檔案
  4 / # cd /pv-data/
  5 /pv-data # echo "This is a file!" >> a.txt
  6 /pv-data # echo "This is b file!" >> b.txt
  7 /pv-data # ls
  8 a.txt  b.txt
  9 [root@servera ~]# df -hT					#在glusterfs節點查看Kubernetes節點的測驗檔案
 10 [root@servera ~]# cd /var/lib/heketi/mounts/vg_47c90d90e03de79696f90bd94cfccdde/brick_721243c3e0cf8a2372f05d5085a4338c/brick/
 11 [root@servera brick]# ls
 12 [root@servera brick]# cat a.txt
 13 [root@servera brick]# cat b.txt
clipboard

5.7 洗掉資源

  1 [root@k8smaster01 heketi]# kubectl delete -f gluster-heketi-pod.yaml
  2 [root@k8smaster01 heketi]# kubectl delete -f gluster-heketi-pvc.yaml
  3 [root@k8smaster01 heketi]# kubectl get pvc
  4 [root@k8smaster01 heketi]# kubectl get pv
  5 [root@servera ~]# gluster volume list
  6 No volumes present in cluster
clipboard

轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/153741.html

標籤:Linux

上一篇:windows10安裝VMware12出現問題

下一篇:[Linux] shell中for回圈grep正則統計指定關鍵字

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • CA和證書

    1、在 CentOS7 中使用 gpg 創建 RSA 非對稱密鑰對 gpg --gen-key #Centos上生成公鑰/密鑰對(存放在家目錄.gnupg/) 2、將 CentOS7 匯出的公鑰,拷貝到 CentOS8 中,在 CentOS8 中使用 CentOS7 的公鑰加密一個檔案 gpg -a ......

    uj5u.com 2020-09-10 00:09:53 more
  • Kubernetes K8S之資源控制器Job和CronJob詳解

    Kubernetes的資源控制器Job和CronJob詳解與示例 ......

    uj5u.com 2020-09-10 00:10:45 more
  • VMware下安裝CentOS

    VMware下安裝CentOS 一、軟硬體準備 1 Centos鏡像準備 1.1 CentOS鏡像下載地址 下載地址 1.2 CentOS鏡像下載程序 點擊下載地址進入如下圖的網站,選擇需要下載的版本,這里選擇的是Centos8,點擊如圖所示。 決定選擇Centos8后,選擇想要的鏡像源進行下載,此 ......

    uj5u.com 2020-09-10 00:12:10 more
  • 如何使用Grep命令查找多個字串

    如何使用Grep 命令查找多個字串 大家好,我是良許! 今天向大家介紹一個非常有用的技巧,那就是使用 grep 命令查找多個字串。 簡單介紹一下,grep 命令可以理解為是一個功能強大的命令列工具,可以用它在一個或多個輸入檔案中搜索與正則運算式相匹配的文本,然后再將每個匹配的文本用標準輸出的格式 ......

    uj5u.com 2020-09-10 00:12:28 more
  • git配置http代理

    git配置http代理 經常遇到克隆 github 慢的問題,這里記錄一下幾種配置 git 代理的方法,解決 clone github 過慢。 目錄 git配置代理 git單獨配置github代理 git配置全域代理 配置終端環境變數 git配置代理 主要使用 git config 命令 git單獨 ......

    uj5u.com 2020-09-10 00:12:33 more
  • Linux npm install 裝包時提示Error EACCES permission denied解

    npm install 裝包時提示Error EACCES permission denied解決辦法 ......

    uj5u.com 2020-09-10 00:12:53 more
  • Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包

    Centos 7下安裝nginx,使用yum install nginx,提示沒有可用的軟體包。 18 (flaskApi) [root@67 flaskDemo]# yum -y install nginx 19 已加載插件:fastestmirror, langpacks 20 Loading ......

    uj5u.com 2020-09-10 00:13:13 more
  • Linux查看服務器暴力破解ssh IP

    在公網的服務器上經常遇到別人爆破你服務器的22埠,用來挖礦或者干其他嘿嘿嘿的事情~ 這種情況下正確的做法是: 修改默認ssh的22埠 使用設定密鑰登錄或者白名單ip登錄 建議服務器密碼為復雜密碼 創建普通用戶登錄服務器(root權限過大) 建立堡壘機,實作統一管理服務器 統計爆破IP [root ......

    uj5u.com 2020-09-10 00:13:17 more
  • CentOS 7系統常見快捷鍵操作方式

    Linux系統中一些常見的快捷方式,可有效提高操作效率,在某些時刻也能避免操作失誤帶來的問題。 ......

    uj5u.com 2020-09-10 00:13:31 more
  • CentOS 7作業系統目錄結構介紹

    作業系統存在著大量的資料檔案資訊,相應檔案資訊會存在于系統相應目錄中,為了更好的管理資料資訊,會將系統進行一些目錄規劃,不同目錄存放不同的資源。 ......

    uj5u.com 2020-09-10 00:13:35 more
最新发布
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:43:21 more
  • vim的常用命令

    Vim的6種基本模式 1. 普通模式在普通模式中,用的編輯器命令,比如移動游標,洗掉文本等等。這也是Vim啟動后的默認模式。這正好和許多新用戶期待的操作方式相反(大多數編輯器默認模式為插入模式)。 2. 插入模式在這個模式中,大多數按鍵都會向文本緩沖中插入文本。大多數新用戶希望文本編輯器編輯程序中一 ......

    uj5u.com 2023-04-20 08:42:36 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:26:53 more
  • 設定Windows主機的瀏覽器為wls2的默認瀏覽器

    這里以Chrome為例。 1. 準備作業 wsl是可以使用Windows主機上安裝的exe程式,出于安全考慮,默認情況下改功能是無法使用。要使用的話,終端需要以管理員權限啟動。 我這里以Windows Terminal為例,介紹如何默認使用管理員權限打開終端,具體操作如下圖所示: 2. 操作 wsl ......

    uj5u.com 2023-04-19 09:25:49 more
  • docker學習

    ###Docker概述 真實專案部署環境可能非常復雜,傳統發布專案一個只需要一個jar包,運行環境需要單獨部署。而通過Docker可將jar包和相關環境(如jdk,redis,Hadoop...)等打包到docker鏡像里,將鏡像發布到Docker倉庫,部署時下載發布的鏡像,直接運行發布的鏡像即可。 ......

    uj5u.com 2023-04-19 09:19:04 more
  • Linux學習筆記

    IP地址和主機名 IP地址 ifconfig可以用來查詢本機的IP地址,如果不能使用,可以通過install net-tools安裝。 Centos系統下ens33表示主網卡;inet后表示IP地址;lo表示本地回環網卡; 127.0.0.1表示代指本機;0.0.0.0可以用于代指本機,同時在放行設 ......

    uj5u.com 2023-04-18 06:52:01 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:50 more
  • 解決linux系統的kdump服務無法啟動的問題

    問題:專案麒麟系統服務器的kdump服務無法啟動,沒有相關日志無法定位問題。 1、查看服務狀態是關閉的,重啟系統也無法啟動 systemctl status kdump 2、修改grub引數,修改“crashkernel”為“512M(有的機器數值太大太小都會導致報錯,建議從128M開始試,或者加個 ......

    uj5u.com 2023-04-12 09:59:01 more
  • 你是不是暴露了?

    作者:袁首京 原創文章,轉載時請保留此宣告,并給出原文連接。 如果您是計算機相關從業人員,那么應該經歷不止一次網路安全專項檢查了,你肯定是收到過資訊系統技術檢測報告,要求你加強風險監測,確保你提供的系統服務堅實可靠了。 沒檢測到問題還好,檢測到問題的話,有些處理起來還是挺麻煩的,尤其是線上正在運行的 ......

    uj5u.com 2023-04-05 16:52:56 more
  • 細節拉滿,80 張圖帶你一步一步推演 slab 記憶體池的設計與實作

    1. 前文回顧 在之前的幾篇記憶體管理系列文章中,筆者帶大家從宏觀角度完整地梳理了一遍 Linux 記憶體分配的整個鏈路,本文的主題依然是記憶體分配,這一次我們會從微觀的角度來探秘一下 Linux 內核中用于零散小記憶體塊分配的記憶體池 —— slab 分配器。 在本小節中,筆者還是按照以往的風格先帶大家簡單 ......

    uj5u.com 2023-04-05 16:44:11 more