apecloud / kubeblocks-addons

KubeBlocks add-ons.
Apache License 2.0
34 stars 36 forks source link

[BUG] mogdb cluster backup restore cluster role is null #365

Closed JashBook closed 7 months ago

JashBook commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. create cluster
    apiVersion: apps.kubeblocks.io/v1alpha1
    kind: Cluster
    metadata:
    name: mogdb-cluster
    namespace: default
    spec:
    clusterDefinitionRef: mogdb
    clusterVersionRef: mogdb-5.0.5
    terminationPolicy: WipeOut
    componentSpecs:
    - name: mogdb
      componentDefRef: mogdb
      replicas: 2
      resources:
        requests:
          cpu: 500m
          memory: 1Gi
        limits:
          cpu: 500m
          memory: 1Gi
      volumeClaimTemplates:
        - name: data
          spec:
            storageClassName:
            accessModes:
              - ReadWriteOnce
            resources:
              requests:
                storage: 5Gi
    kubectl get cluster 
    NAME            CLUSTER-DEFINITION   VERSION       TERMINATION-POLICY   STATUS    AGE
    mogdb-cluster   mogdb                mogdb-5.0.5   WipeOut              Running   3m11s
  2. backup cluster
    
    kbcli cluster backup mogdb-cluster --method volume-snapshot 

kbcli cluster backup mogdb-cluster --method mogdb-basebackup

kubectl get backup NAME POLICY METHOD REPO STATUS TOTAL-SIZE DURATION CREATION-TIME COMPLETION-TIME EXPIRATION-TIME backup-default-mogdb-cluster-20240311183330 mogdb-cluster-mogdb-backup-policy volume-snapshot Completed 5Gi 33s 2024-03-11T10:33:33Z 2024-03-11T10:34:05Z
backup-default-mogdb-cluster-20240311183333 mogdb-cluster-mogdb-backup-policy mogdb-basebackup backuprepo-kbcli-test Completed 46601761 2m6s 2024-03-11T10:33:45Z 2024-03-11T10:35:51Z

3. restore

kbcli cluster restore mogdb-snapshot --backup backup-default-mogdb-cluster-20240311183330 kbcli cluster restore mogdb-basebk --backup backup-default-mogdb-cluster-20240311183333

4. See error

kubectl get cluster NAME CLUSTER-DEFINITION VERSION TERMINATION-POLICY STATUS AGE mogdb-basebk mogdb mogdb-5.0.5 WipeOut Creating 3m59s mogdb-snapshot mogdb mogdb-5.0.5 WipeOut Creating 4m1s

kubectl get pod NAME READY STATUS RESTARTS AGE mogdb-basebk-mogdb-0 5/5 Running 0 3m56s mogdb-basebk-mogdb-1 5/5 Running 0 3m19s mogdb-snapshot-mogdb-0 5/5 Running 0 4m23s mogdb-snapshot-mogdb-1 5/5 Running 0 3m14s

kbcli cluster describe mogdb-basebk Name: mogdb-basebk Created Time: Mar 11,2024 18:36 UTC+0800 NAMESPACE CLUSTER-DEFINITION VERSION STATUS TERMINATION-POLICY
default mogdb mogdb-5.0.5 Creating WipeOut

Endpoints: COMPONENT MODE INTERNAL EXTERNAL
mogdb ReadWrite mogdb-basebk-mogdb.default.svc.cluster.local:5432

Topology: COMPONENT INSTANCE ROLE STATUS AZ NODE CREATED-TIME
mogdb mogdb-basebk-mogdb-0 Running us-central1-f gke-infracreate-gke-kbdata-e2-standar-25c8fd47-r1fp/10.10.0.3 Mar 11,2024 18:37 UTC+0800
mogdb mogdb-basebk-mogdb-1 Running us-central1-a gke-infracreate-gke-kbdata-e2-standar-765d90c7-do60/10.10.0.7 Mar 11,2024 18:37 UTC+0800

Resources Allocation: COMPONENT DEDICATED CPU(REQUEST/LIMIT) MEMORY(REQUEST/LIMIT) STORAGE-SIZE STORAGE-CLASS
mogdb false 500m / 500m 1Gi / 1Gi data:5Gi kb-default-sc

Images: COMPONENT TYPE IMAGE
mogdb mogdb swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5

Data Protection: BACKUP-REPO AUTO-BACKUP BACKUP-SCHEDULE BACKUP-METHOD BACKUP-RETENTION

Show cluster events: kbcli cluster list-events -n default mogdb-basebk

describe pod

kubectl describe pod mogdb-basebk-mogdb-0 Name: mogdb-basebk-mogdb-0 Namespace: default Priority: 0 Node: gke-infracreate-gke-kbdata-e2-standar-25c8fd47-r1fp/10.10.0.3 Start Time: Mon, 11 Mar 2024 18:37:07 +0800 Labels: app.kubernetes.io/component=mogdb app.kubernetes.io/instance=mogdb-basebk app.kubernetes.io/managed-by=kubeblocks app.kubernetes.io/name=mogdb app.kubernetes.io/version= apps.kubeblocks.io/cluster-uid=2b3ff4ac-2fab-4084-8f61-92f97157e0a0 apps.kubeblocks.io/component-name=mogdb clusterdefinition.kubeblocks.io/name=mogdb clusterversion.kubeblocks.io/name=mogdb-5.0.5 controller-revision-hash=mogdb-basebk-mogdb-99dfbdc9b statefulset.kubernetes.io/pod-name=mogdb-basebk-mogdb-0 Annotations: apps.kubeblocks.io/component-replicas: 2 Status: Running IP: 10.128.2.85 IPs: IP: 10.128.2.85 Controlled By: StatefulSet/mogdb-basebk-mogdb Init Containers: init-lorry: Container ID: containerd://2dca6763b7d63e88ff41787e2127977cf398ad49c0927e76c122b48e7babc4c3 Image: docker.io/apecloud/kubeblocks-tools:0.9.0-alpha.5 Image ID: docker.io/apecloud/kubeblocks-tools@sha256:5af8bca4472efc8c9d2ca5d81116f91d2cfb67dade3dce49f0c9c44e227e21a1 Port: Host Port: Command: cp -r /bin/lorry /config /kubeblocks/ State: Terminated Reason: Completed Exit Code: 0 Started: Mon, 11 Mar 2024 18:37:11 +0800 Finished: Mon, 11 Mar 2024 18:37:11 +0800 Ready: True Restart Count: 0 Limits: cpu: 0 memory: 0 Requests: cpu: 0 memory: 0 Environment Variables from: mogdb-basebk-mogdb-env ConfigMap Optional: false Environment: KB_POD_NAME: mogdb-basebk-mogdb-0 (v1:metadata.name) KB_POD_UID: (v1:metadata.uid) KB_NAMESPACE: default (v1:metadata.namespace) KB_SA_NAME: (v1:spec.serviceAccountName) KB_NODENAME: (v1:spec.nodeName) KB_HOST_IP: (v1:status.hostIP) KB_POD_IP: (v1:status.podIP) KB_POD_IPS: (v1:status.podIPs) KB_HOSTIP: (v1:status.hostIP) KB_PODIP: (v1:status.podIP) KB_PODIPS: (v1:status.podIPs) KB_POD_FQDN: $(KB_POD_NAME).mogdb-basebk-mogdb-headless.$(KB_NAMESPACE).svc Mounts: /kubeblocks from kubeblocks (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro) role-agent-installer: Container ID: containerd://4b801b90e462ae0ab2bac622888911077db065d6964a4cb9ee9328eedc56b64f Image: msoap/shell2http:1.16.0 Image ID: docker.io/msoap/shell2http@sha256:a20bdde2f679de2cba6bf3d9f470489c7836d4d0d28232a2b295450809cd43ef Port: Host Port: Command: cp /app/shell2http /role-probe/agent State: Terminated Reason: Completed Exit Code: 0 Started: Mon, 11 Mar 2024 18:37:12 +0800 Finished: Mon, 11 Mar 2024 18:37:12 +0800 Ready: True Restart Count: 0 Environment: Mounts: /role-probe from role-agent (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro) Containers: mogdb: Container ID: containerd://98e7a6d5ce74d91f32645415c50b1306cba7eff91f537c108cdc9466ca97c535 Image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5 Image ID: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb@sha256:186e611dbd144e281d4d997a26f3e008b06c60bdacaaeda53ab05a62350b126c Port: 26000/TCP Host Port: 0/TCP Command: bash -c set -ex MogDB_Role= REPL_CONN_INFO=

  cat >>/home/omm/.profile <<-EOF
  export OG_SUBNET="0.0.0.0/0"
  export PGHOST="/var/lib/mogdb/tmp"
  export PGPORT="$PGPORT"
  EOF
  [[ -d "$PGHOST" ]] || (mkdir -p $PGHOST && chown omm $PGHOST)

  hostname=`hostname`
  [[ "$hostname" =~ -([0-9]+)$ ]] || exit 1
  ordinal=${BASH_REMATCH[1]}
  if [[ $ordinal -eq 0 ]];then
    MogDB_Role="primary"
  else
    MogDB_Role="standby"

    if [ -n "$PGPORT" ];then
      ha_port=$(expr $PGPORT + 1)
      ha_service_port=$(expr $PGPORT + 2)
    else
      ha_port=$(expr 5432 + 1)
      ha_service_port=$(expr 5432 + 2)
    fi

    cat >/tmp/replconninfo.conf
    for ((i=0; i<$ordinal; i++)); do
      echo "$hostname $PodIP" |ncat --send-only ${KB_CLUSTER_COMP_NAME}-${i}.${KB_CLUSTER_COMP_NAME}-headless 6543
      remote_ip=`ping ${KB_CLUSTER_COMP_NAME}-${i}.${KB_CLUSTER_COMP_NAME}-headless -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`

      echo "replconninfo$((i+1)) = 'localhost=$PodIP localport=${ha_port} localservice=${ha_service_port} remotehost=$remote_ip remoteport=${ha_port} remoteservice=${ha_service_port}'" >> /tmp/replconninfo.conf
    done

    #echo "$hostname $PodIP" |ncat --send-only ${KB_CLUSTER_COMP_NAME}-0.${KB_CLUSTER_COMP_NAME}-headless 6543
    #remote_ip=`ping ${KB_CLUSTER_COMP_NAME}-0.${KB_CLUSTER_COMP_NAME}-headless -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`

    # REPL_CONN_INFO="replconninfo${ordinal} = 'localhost=$PodIP localport=${ha_port} localservice=${ha_service_port} remotehost=$remote_ip remoteport=${ha_port} remoteservice=${ha_service_port}'"
  fi

  [[ -n "$REPL_CONN_INFO" ]] && export REPL_CONN_INFO
  source /home/omm/.profile

  cp /home/omm/conf/* /tmp/
  chmod 777 /tmp/postgresql.conf /tmp/pg_hba.conf
  exec bash /kb-scripts/setup.sh -M "$MogDB_Role"

State:          Running
  Started:      Mon, 11 Mar 2024 18:37:13 +0800
Ready:          True
Restart Count:  0
Limits:
  cpu:     500m
  memory:  1Gi
Requests:
  cpu:      500m
  memory:   1Gi
Liveness:   exec [sh -c su -l omm -c "gsql -dpostgres -c 'select 1'"] delay=120s timeout=5s period=10s #success=1 #failure=12
Readiness:  exec [sh -c su -l omm -c "gsql -dpostgres -c 'select 1'"] delay=30s timeout=5s period=3s #success=1 #failure=3
Environment Variables from:
  mogdb-basebk-mogdb-env      ConfigMap  Optional: false
  mogdb-basebk-mogdb-rsm-env  ConfigMap  Optional: false
Environment:
  KB_POD_NAME:      mogdb-basebk-mogdb-0 (v1:metadata.name)
  KB_POD_UID:        (v1:metadata.uid)
  KB_NAMESPACE:     default (v1:metadata.namespace)
  KB_SA_NAME:        (v1:spec.serviceAccountName)
  KB_NODENAME:       (v1:spec.nodeName)
  KB_HOST_IP:        (v1:status.hostIP)
  KB_POD_IP:         (v1:status.podIP)
  KB_POD_IPS:        (v1:status.podIPs)
  KB_HOSTIP:         (v1:status.hostIP)
  KB_PODIP:          (v1:status.podIP)
  KB_PODIPS:         (v1:status.podIPs)
  KB_POD_FQDN:      $(KB_POD_NAME).mogdb-basebk-mogdb-headless.$(KB_NAMESPACE).svc
  GS_USERNAME:      <set to the key 'username' in secret 'mogdb-basebk-conn-credential'>  Optional: false
  GS_PASSWORD:      <set to the key 'password' in secret 'mogdb-basebk-conn-credential'>  Optional: false
  GS_DB:            mogdb
  PGPORT:           26000
  PATH:             /usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  GAUSSHOME:        /usr/local/mogdb
  LD_LIBRARY_PATH:  /usr/local/mogdb/lib
  PGDATA:           /var/lib/mogdb/data
  PGHOST:           /var/lib/mogdb/tmp
  PodIP:             (v1:status.podIP)
  MOGDB_USER:       <set to the key 'username' in secret 'mogdb-basebk-conn-credential'>  Optional: false
  MOGDB_PASSWORD:   <set to the key 'password' in secret 'mogdb-basebk-conn-credential'>  Optional: false
Mounts:
  /home/omm/conf from mogdb-config (rw)
  /kb-scripts from scripts (rw)
  /var/lib/mogdb from data (rw,path="mogdb")
  /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro)

helper: Container ID: containerd://d61e1aeca20b9dbaac873141372e4f348b8ea113a680d3db8711f53aec7dba99 Image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5 Image ID: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb@sha256:186e611dbd144e281d4d997a26f3e008b06c60bdacaaeda53ab05a62350b126c Port: 6543/TCP Host Port: 0/TCP Command: bash /kb-scripts/helper.sh State: Running Started: Mon, 11 Mar 2024 18:37:13 +0800 Ready: True Restart Count: 0 Requests: cpu: 500m memory: 64Mi Environment Variables from: mogdb-basebk-mogdb-env ConfigMap Optional: false mogdb-basebk-mogdb-rsm-env ConfigMap Optional: false Environment: KB_POD_NAME: mogdb-basebk-mogdb-0 (v1:metadata.name) KB_POD_UID: (v1:metadata.uid) KB_NAMESPACE: default (v1:metadata.namespace) KB_SA_NAME: (v1:spec.serviceAccountName) KB_NODENAME: (v1:spec.nodeName) KB_HOST_IP: (v1:status.hostIP) KB_POD_IP: (v1:status.podIP) KB_POD_IPS: (v1:status.podIPs) KB_HOSTIP: (v1:status.hostIP) KB_PODIP: (v1:status.podIP) KB_PODIPS: (v1:status.podIPs) KB_POD_FQDN: $(KB_POD_NAME).mogdb-basebk-mogdb-headless.$(KB_NAMESPACE).svc PodIP: (v1:status.podIP) PGDATA: /var/lib/mogdb/data PGHOST: /var/lib/mogdb/tmp PGPORT: 26000 Mounts: /kb-scripts from scripts (rw) /var/lib/mogdb from data (rw,path="mogdb") /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro) exporter: Container ID: containerd://27a4d54100fd6939ec45a01891e2f8f2bf895c0bd543a16040696ddaf8ef6a0e Image: swr.cn-north-4.myhuaweicloud.com/mogdb-cloud/mogdb-exporter:3.1.0 Image ID: swr.cn-north-4.myhuaweicloud.com/mogdb-cloud/mogdb-exporter@sha256:35203553ae0720c3a026b43ef076042caa6b1102a0a9991f96576468e671afc8 Port: 9187/TCP Host Port: 0/TCP State: Running Started: Mon, 11 Mar 2024 18:37:13 +0800 Ready: True Restart Count: 0 Limits: cpu: 100m memory: 100Mi Requests: cpu: 100m memory: 100Mi Environment Variables from: mogdb-basebk-mogdb-env ConfigMap Optional: false mogdb-basebk-mogdb-rsm-env ConfigMap Optional: false Environment: KB_POD_NAME: mogdb-basebk-mogdb-0 (v1:metadata.name) KB_POD_UID: (v1:metadata.uid) KB_NAMESPACE: default (v1:metadata.namespace) KB_SA_NAME: (v1:spec.serviceAccountName) KB_NODENAME: (v1:spec.nodeName) KB_HOST_IP: (v1:status.hostIP) KB_POD_IP: (v1:status.podIP) KB_POD_IPS: (v1:status.podIPs) KB_HOSTIP: (v1:status.hostIP) KB_PODIP: (v1:status.podIP) KB_PODIPS: (v1:status.podIPs) KB_POD_FQDN: $(KB_POD_NAME).mogdb-basebk-mogdb-headless.$(KB_NAMESPACE).svc DATA_SOURCE_NAME: host=/var/lib/mogdb/tmp port=26000 user=omm dbname=postgres PGHOST: /var/lib/mogdb/tmp PGPORT: 26000 PGDATA: /var/lib/mogdb/data Mounts: /var/lib/mogdb from data (rw,path="mogdb") /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro) lorry: Container ID: containerd://bb1492e9fab48a35ab0f0fe246480da8cbcb9d6d5f907819bfc51f9fea7279c9 Image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5 Image ID: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb@sha256:186e611dbd144e281d4d997a26f3e008b06c60bdacaaeda53ab05a62350b126c Ports: 3501/TCP, 50001/TCP Host Ports: 0/TCP, 0/TCP Command: /kubeblocks/lorry --port 3501 --grpcport 50001 --config-path /kubeblocks/config/lorry/components/ State: Running Started: Mon, 11 Mar 2024 18:37:14 +0800 Ready: True Restart Count: 0 Limits: cpu: 0 memory: 0 Requests: cpu: 0 memory: 0 Readiness: http-get http://:3501/v1.0/checkrole delay=0s timeout=1s period=10s #success=1 #failure=3 Startup: tcp-socket :3501 delay=0s timeout=1s period=10s #success=1 #failure=3 Environment Variables from: mogdb-basebk-mogdb-env ConfigMap Optional: false mogdb-basebk-mogdb-rsm-env ConfigMap Optional: false Environment: KB_POD_NAME: mogdb-basebk-mogdb-0 (v1:metadata.name) KB_POD_UID: (v1:metadata.uid) KB_NAMESPACE: default (v1:metadata.namespace) KB_SA_NAME: (v1:spec.serviceAccountName) KB_NODENAME: (v1:spec.nodeName) KB_HOST_IP: (v1:status.hostIP) KB_POD_IP: (v1:status.podIP) KB_POD_IPS: (v1:status.podIPs) KB_HOSTIP: (v1:status.hostIP) KB_PODIP: (v1:status.podIP) KB_PODIPS: (v1:status.podIPs) KB_POD_FQDN: $(KB_POD_NAME).mogdb-basebk-mogdb-headless.$(KB_NAMESPACE).svc KB_BUILTIN_HANDLER: custom KB_SERVICE_USER: <set to the key 'username' in secret 'mogdb-basebk-conn-credential'> Optional: false KB_SERVICE_PASSWORD: <set to the key 'password' in secret 'mogdb-basebk-conn-credential'> Optional: false KB_SERVICE_PORT: 26000 KB_DATA_PATH: /var/lib/mogdb KB_ACTION_COMMANDS: {"roleProbe":["/bin/bash","-c","role=$(gsql -h 127.0.0.1 -p 26000 -U ${MOGDB_USER} -W \"${MOGDB_PASSWORD}\" -dpostgres -t -c \"select local_role from pg_stat_get_stream_replications() limit 1\" | xargs echo -n)\nif [ \"$role\"x == \"Normal\"x ]; then\n echo -n \"Primary\"\nelse\n echo -n $role\nfi\n"]} GS_USERNAME: <set to the key 'username' in secret 'mogdb-basebk-conn-credential'> Optional: false GS_PASSWORD: <set to the key 'password' in secret 'mogdb-basebk-conn-credential'> Optional: false GS_DB: mogdb PGPORT: 26000 PATH: /usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin GAUSSHOME: /usr/local/mogdb LD_LIBRARY_PATH: /usr/local/mogdb/lib PGDATA: /var/lib/mogdb/data PGHOST: /var/lib/mogdb/tmp PodIP: (v1:status.podIP) MOGDB_USER: <set to the key 'username' in secret 'mogdb-basebk-conn-credential'> Optional: false MOGDB_PASSWORD: <set to the key 'password' in secret 'mogdb-basebk-conn-credential'> Optional: false KB_RSM_ACTION_SVC_LIST: [36501] KB_RSM_ROLE_UPDATE_MECHANISM: DirectAPIServerEventUpdate KB_RSM_ROLE_PROBE_TIMEOUT: 1 KB_CLUSTER_NAME: (v1:metadata.labels['app.kubernetes.io/instance']) KB_COMP_NAME: (v1:metadata.labels['apps.kubeblocks.io/component-name']) KB_SERVICE_CHARACTER_TYPE: custom Mounts: /kubeblocks from kubeblocks (rw) /var/lib/mogdb from data (rw,path="mogdb") /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro) action-0: Container ID: containerd://84e880769c5ff53a2503eba37e5c6311a2d5a3dca3a9918d754a0cc0992b9cfe Image: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5 Image ID: swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb@sha256:186e611dbd144e281d4d997a26f3e008b06c60bdacaaeda53ab05a62350b126c Port: Host Port: Command: /role-probe/agent -port 36501 -export-all-vars -form /role /bin/bash -c role=$(gsql -h 127.0.0.1 -p 26000 -U ${MOGDB_USER} -W "${MOGDB_PASSWORD}" -dpostgres -t -c "select local_role from pg_stat_get_stream_replications() limit 1" | xargs echo -n) if [ "$role"x == "Normal"x ]; then echo -n "Primary" else echo -n $role fi

State:          Running
  Started:      Mon, 11 Mar 2024 18:37:14 +0800
Ready:          True
Restart Count:  0
Environment:
  KB_RSM_USERNAME:  <set to the key 'username' in secret 'mogdb-basebk-conn-credential'>  Optional: false
  KB_RSM_PASSWORD:  <set to the key 'password' in secret 'mogdb-basebk-conn-credential'>  Optional: false
Mounts:
  /role-probe from role-agent (rw)
  /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-dchwh (ro)

Conditions: Type Status Initialized True Ready True ContainersReady True PodScheduled True Volumes: data: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: data-mogdb-basebk-mogdb-0 ReadOnly: false dshm: Type: EmptyDir (a temporary directory that shares a pod's lifetime) Medium: Memory SizeLimit: 1Gi agamotto-configuration: Type: ConfigMap (a volume populated by a ConfigMap) Name: mogdb-basebk-mogdb-agamotto-configuration Optional: false mogdb-config: Type: ConfigMap (a volume populated by a ConfigMap) Name: mogdb-basebk-mogdb-mogdb-configuration Optional: false mogdb-custom-metrics: Type: ConfigMap (a volume populated by a ConfigMap) Name: mogdb-basebk-mogdb-mogdb-custom-metrics Optional: false scripts: Type: ConfigMap (a volume populated by a ConfigMap) Name: mogdb-basebk-mogdb-mogdb-scripts Optional: false kubeblocks: Type: EmptyDir (a temporary directory that shares a pod's lifetime) Medium:
SizeLimit: role-agent: Type: EmptyDir (a temporary directory that shares a pod's lifetime) Medium:
SizeLimit: kube-api-access-dchwh: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: DownwardAPI: true QoS Class: Burstable Node-Selectors: Tolerations: kb-data=true:NoSchedule 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 4m48s default-scheduler Successfully assigned default/mogdb-basebk-mogdb-0 to gke-infracreate-gke-kbdata-e2-standar-25c8fd47-r1fp Normal Pulled 4m44s kubelet Container image "docker.io/apecloud/kubeblocks-tools:0.9.0-alpha.5" already present on machine Normal Created 4m44s kubelet Created container init-lorry Normal Started 4m44s kubelet Started container init-lorry Normal Pulled 4m43s kubelet Container image "msoap/shell2http:1.16.0" already present on machine Normal Created 4m43s kubelet Created container role-agent-installer Normal Started 4m43s kubelet Started container role-agent-installer Normal Created 4m42s kubelet Created container helper Normal Created 4m42s kubelet Created container mogdb Normal Started 4m42s kubelet Started container mogdb Normal Pulled 4m42s kubelet Container image "swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5" already present on machine Normal Pulled 4m42s kubelet Container image "swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5" already present on machine Normal Started 4m42s kubelet Started container helper Normal Pulled 4m42s kubelet Container image "swr.cn-north-4.myhuaweicloud.com/mogdb-cloud/mogdb-exporter:3.1.0" already present on machine Normal Created 4m42s kubelet Created container exporter Normal Started 4m42s kubelet Started container exporter Normal Pulled 4m42s kubelet Container image "swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5" already present on machine Normal Created 4m42s kubelet Created container lorry Normal Started 4m41s kubelet Started container lorry Normal Pulled 4m41s kubelet Container image "swr.cn-north-4.myhuaweicloud.com/mogdb/mogdb:5.0.5" already present on machine Normal Created 4m41s kubelet Created container action-0 Normal Started 4m41s kubelet Started container action-0


log pod lorry

kubectl logs mogdb-basebk-mogdb-0 lorry 2024-03-11T10:37:14Z INFO Initialize DB manager 2024-03-11T10:37:14Z INFO KB_WORKLOAD_TYPE ENV not set 2024-03-11T10:37:14Z INFO Volume-Protection succeed to init volume protection {"pod": "mogdb-basebk-mogdb-0", "spec": {"highWatermark":"0","volumes":[]}} 2024-03-11T10:37:14Z INFO HTTPServer Starting HTTP Server


log pod mogdb
```kubectl logs mogdb-basebk-mogdb-0 mogdb
+ MogDB_Role=
+ REPL_CONN_INFO=
+ cat
+ [[ -d /var/lib/mogdb/tmp ]]
+ mkdir -p /var/lib/mogdb/tmp
+ chown omm /var/lib/mogdb/tmp
++ hostname
+ hostname=mogdb-basebk-mogdb-0
+ [[ mogdb-basebk-mogdb-0 =~ -([0-9]+)$ ]]
+ ordinal=0
+ [[ 0 -eq 0 ]]
+ MogDB_Role=primary
+ [[ -n '' ]]
+ source /home/omm/.profile
++ '[' -n '5.0.17(1)-release' ']'
++ '[' -f /root/.bashrc ']'
++ . /root/.bashrc
+++ '[' -z '' ']'
+++ return
++ '[' -d /root/bin ']'
++ '[' -d /root/.local/bin ']'
++ export GAUSSHOME=/usr/local/mogdb
++ GAUSSHOME=/usr/local/mogdb
++ export PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib
++ LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib
++ export GAUSSLOG=/home/omm/pg_log
++ GAUSSLOG=/home/omm/pg_log
++ export PGDATA=/var/lib/mogdb/data
++ PGDATA=/var/lib/mogdb/data
++ export OG_SUBNET=0.0.0.0/0
++ OG_SUBNET=0.0.0.0/0
++ export PGHOST=/var/lib/mogdb/tmp
++ PGHOST=/var/lib/mogdb/tmp
++ export PGPORT=26000
++ PGPORT=26000
+ cp /home/omm/conf/pg_hba.conf /home/omm/conf/postgresql.conf /tmp/
+ chmod 777 /tmp/postgresql.conf /tmp/pg_hba.conf
+ exec bash /kb-scripts/setup.sh -M primary
+ export GAUSSHOME=/usr/local/mogdb
+ GAUSSHOME=/usr/local/mogdb
+ export PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ export LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib
+ LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib
+ export LANG=en_US.UTF-8
+ LANG=en_US.UTF-8
+ _is_sourced
+ '[' 2 -ge 2 ']'
+ '[' _is_sourced = _is_sourced ']'
+ '[' main = source ']'
+ _main -M primary
+ '[' - = - ']'
+ set -- mogdb -M primary
+ '[' mogdb = mogdb ']'
+ _mogdb_want_help mogdb -M primary
+ local arg
+ count=1
+ for arg in "$@"
+ case "$arg" in
+ '[' mogdb == -M ']'
+ count=2
+ for arg in "$@"
+ case "$arg" in
+ '[' -M == -M ']'
+ SERVER_MODE=primary
+ echo 'mogdb DB SERVER_MODE = primary'
+ shift
+ count=3
+ for arg in "$@"
mogdb DB SERVER_MODE = primary
+ case "$arg" in
+ '[' primary == -M ']'
+ count=4
+ return 1
+ docker_setup_env
+ export GS_USER=omm
+ GS_USER=omm
+ file_env POSTGRES_INITDB_ARGS
+ local var=POSTGRES_INITDB_ARGS
+ local fileVar=POSTGRES_INITDB_ARGS_FILE
+ local def=
+ '[' '' ']'
+ local val=
+ '[' '' ']'
+ '[' '' ']'
+ export POSTGRES_INITDB_ARGS=
+ POSTGRES_INITDB_ARGS=
+ unset POSTGRES_INITDB_ARGS_FILE
+ : md5
+ declare -g DATABASE_ALREADY_EXISTS
+ '[' -s /var/lib/mogdb/data/PG_VERSION ']'
+ DATABASE_ALREADY_EXISTS=true
+ declare -g REPUSER_PASSWORD
+ '[' -z '' ']'
+ REPUSER_PASSWORD=RepUser@2020
+ docker_create_db_directories
+ local user
++ id -u
+ user=0
+ mkdir -p /var/lib/mogdb/data
+ chmod 700 /var/lib/mogdb/data
+ mkdir -p /var/run/mogdb
+ chmod 775 /var/run/mogdb
+ '[' -n '' ']'
+ '[' 0 = 0 ']'
+ find /var/lib/mogdb/data '!' -user omm -exec chown omm '{}' +
+ find /var/run/mogdb '!' -user omm -exec chown omm '{}' +
++ id -u
+ '[' 0 = 0 ']'
+ exec gosu omm /kb-scripts/setup.sh mogdb -M primary
+ export GAUSSHOME=/usr/local/mogdb
+ GAUSSHOME=/usr/local/mogdb
+ export PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ PATH=/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/mogdb/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ export LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib
+ LD_LIBRARY_PATH=/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib:/usr/local/mogdb/lib
+ export LANG=en_US.UTF-8
+ LANG=en_US.UTF-8
+ _is_sourced
+ '[' 2 -ge 2 ']'
+ '[' _is_sourced = _is_sourced ']'
+ '[' main = source ']'
+ _main mogdb -M primary
+ '[' m = - ']'
+ '[' mogdb = mogdb ']'
+ _mogdb_want_help mogdb -M primary
+ local arg
+ count=1
+ for arg in "$@"
+ case "$arg" in
+ '[' mogdb == -M ']'
+ count=2
+ for arg in "$@"
+ case "$arg" in
+ '[' -M == -M ']'
+ SERVER_MODE=primary
+ echo 'mogdb DB SERVER_MODE = primary'
+ shift
+ count=3
+ for arg in "$@"
+ case "$arg" in
+ '[' primary == -M ']'
+ count=4
+ return 1
+ docker_setup_env
+ export GS_USER=omm
+ GS_USER=omm
+ file_env POSTGRES_INITDB_ARGS
+ local var=POSTGRES_INITDB_ARGS
+ local fileVar=POSTGRES_INITDB_ARGS_FILE
+ local def=
+ '[' '' ']'
+ local val=
+ '[' '' ']'
+ '[' '' ']'
+ export POSTGRES_INITDB_ARGS=
+ POSTGRES_INITDB_ARGS=
+ unset POSTGRES_INITDB_ARGS_FILE
+ : md5
+ declare -g DATABASE_ALREADY_EXISTS
+ '[' -s /var/lib/mogdb/data/PG_VERSION ']'
+ DATABASE_ALREADY_EXISTS=true
+ declare -g REPUSER_PASSWORD
+ '[' -z '' ']'
+ REPUSER_PASSWORD=RepUser@2020
+ docker_create_db_directories
+ local user
mogdb DB SERVER_MODE = primary
++ id -u
+ user=70
+ mkdir -p /var/lib/mogdb/data
+ chmod 700 /var/lib/mogdb/data
+ mkdir -p /var/run/mogdb
+ chmod 775 /var/run/mogdb
+ '[' -n '' ']'
+ '[' 70 = 0 ']'
++ id -u
+ '[' 70 = 0 ']'
+ '[' -z true ']'
+ '[' -n '' ']'
+ '[' -e /tmp/replconninfo.conf ']'

mogdb Database directory appears to contain a database; Skipping initialization

+ echo
+ echo 'mogdb Database directory appears to contain a database; Skipping initialization'
+ echo
+ exec mogdb -M primary
0 LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

0 LOG:  [Alarm Module]Host Name: mogdb-basebk-mogdb-0 

0 LOG:  [Alarm Module]Host IP: mogdb-basebk-mogdb-0. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>

0 LOG:  [Alarm Module]Get ENV GS_CLUSTER_NAME failed!

0 WARNING:  failed to open feature control file, please check whether it exists: FileName=gaussdb.version, Errno=2, Errmessage=No such file or directory.
0 WARNING:  failed to parse feature control file: gaussdb.version.
0 WARNING:  Failed to load the product control file, so gaussdb cannot distinguish product version.
The core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/
2024-03-11 10:37:13.970 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  when starting as multi_standby mode, we couldn't support data replicaton.
gaussdb.state does not exist, and skipt setting since it is optional.2024-03-11 10:37:13.977 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]can not read GAUSS_WARNING_TYPE env.

2024-03-11 10:37:13.977 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host Name: mogdb-basebk-mogdb-0 

2024-03-11 10:37:13.977 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Host IP: mogdb-basebk-mogdb-0. Copy hostname directly in case of taking 10s to use 'gethostbyname' when /etc/hosts does not contain <HOST IP>

2024-03-11 10:37:13.977 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  [Alarm Module]Get ENV GS_CLUSTER_NAME failed!

2024-03-11 10:37:13.987 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  loaded library "security_plugin"
2024-03-11 10:37:13.990 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] WARNING:  could not create any HA TCP/IP sockets
2024-03-11 10:37:13.994 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  InitNuma numaNodeNum: 1 numa_distribute_mode: none inheritThreadPool: 0.
2024-03-11 10:37:13.995 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for backend threads is: 220 MB
2024-03-11 10:37:13.995 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  reserved memory for WAL buffers is: 128 MB
2024-03-11 10:37:13.995 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  Set max backend reserve memory is: 348 MB, max dynamic memory is: 11070 MB
2024-03-11 10:37:13.995 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  shared memory 357 Mbytes, memory context 11418 Mbytes, max process memory 12288 Mbytes
2024-03-11 10:37:14.066 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [CACHE] LOG:  set data cache  size(402653184)
2024-03-11 10:37:14.185 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [SEGMENT_PAGE] LOG:  Segment-page constants: DF_MAP_SIZE: 8156, DF_MAP_BIT_CNT: 65248, DF_MAP_GROUP_EXTENTS: 4175872, IPBLOCK_SIZE: 8168, EXTENTS_PER_IPBLOCK: 1021, IPBLOCK_GROUP_SIZE: 4090, BMT_HEADER_LEVEL0_TOTAL_PAGES: 8323072, BktMapEntryNumberPerBlock: 2038, BktMapBlockNumber: 49, BktBitMaxMapCnt: 512
2024-03-11 10:37:14.283 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  mogdb: fsync file "/var/lib/mogdb/data/gaussdb.state.temp" success
2024-03-11 10:37:14.283 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  create gaussdb state file success: db state(STARTING_STATE), server mode(Primary), connection index(1)
2024-03-11 10:37:14.307 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  max_safe_fds = 979, usable_fds = 1000, already_open = 11
The core dump path from /proc/sys/kernel/core_pattern is an invalid directory:/
2024-03-11 10:37:14.314 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  the configure file /usr/local/mogdb/etc/gscgroup_omm.cfg doesn't exist or the size of configure file has changed. Please create it by root user!
2024-03-11 10:37:14.314 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [BACKEND] LOG:  Failed to parse cgroup config file.
2024-03-11 10:37:14.474 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [EXECUTOR] WARNING:  Failed to obtain environment value $GAUSSLOG!
2024-03-11 10:37:14.474 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [EXECUTOR] DETAIL:  N/A
2024-03-11 10:37:14.474 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [EXECUTOR] CAUSE:  Incorrect environment value.
2024-03-11 10:37:14.474 [unknown] [unknown] localhost 139730649011200 0[0:0#0]  0 [EXECUTOR] ACTION:  Please refer to backend log for more details.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

JashBook commented 7 months ago

has been fixed