mariadb pods replicas crashes [关闭]

qzlgjiam  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(41)

**已关闭。**此问题为not about programming or software development。目前不接受回答。

此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题相关,可以发表评论,说明在何处可以回答此问题。
上个月关门了。
Improve this question
在我的Kubernetes集群中,我尝试使用3个副本启动MariaDB的部署。30秒后,2/3副本崩溃,重新启动,再次崩溃。这与链接到Deployment的PVC有关。有一些迹象表明,Pod需要独占查看PV中的一些文件。其中一个Pod按预期工作。
类似的设置在influxDB和Grafana上都有效。但是MariaDB正在发生一些事情。
.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: mariadb
  labels:
    app: mariadb
spec: 
  replicas: 3
  selector:
    matchLabels:
      app: mariadb
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: mariadb
    spec:
      containers:
      - name: mariadb
        image: mariadb:latest
        ports:
        - containerPort: 3306 
        env:
            - name: MYSQL_ROOT_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: MYSQL_ROOT_PASSWORD
                  name: platform-secret
              [more variables]
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: mariadb-pv
      restartPolicy: Always
      volumes:
      - name: mariadb-pv
        persistentVolumeClaim:
          claimName: mariadb-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mariadb-pvc
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: mariadb
  name: mariadb
spec:
  selector:
    app: influxdb
  type: ClusterIP
  ports:
    - protocol: TCP
      port: 3306
      targetPort: 3306
status:
  loadBalancer: {}

字符串
我试着划分PVC和添加到卷为dropped,这工作正常:

volumeMounts:
- name: mariadb-aria-storage
  mountPath: /var/lib/mysql/aria
- name: mariadb-innodb-storage
  mountPath: /var/lib/mysql/innodb


因此,在Map/var/lib/mysql时,PVC出现了问题
一些错误指示器:

kubectl get pods

NAME                       READY   STATUS    RESTARTS      AGE
mariadb-78d7945894-gsjnq   1/1     Running   2 (28s ago)   103s
mariadb-78d7945894-qzfqd   1/1     Running   0             103s
mariadb-78d7945894-zmg7k   1/1     Running   2 (27s ago)   103s

x

kubectl get event

[...]
2m10s       Warning   FailedAttachVolume       pod/mariadb-78d7945894-zmg7k        AttachVolume.Attach failed for volume "pvc-c5b09340-5060-4b77-921a-9f889bc81e84" : rpc error: code = Internal desc = [ControllerPublishVolume] Attach Volume failed with error failed to attach e162b4b1-be0f-4b63-a8eb-6bf679c9719e volume to cfb3d471-5184-4a79-8474-dc62c4893c7d compute: Bad request with: [POST https://ops.elastx.cloud:8774/v2.1/servers/cfb3d471-5184-4a79-8474-dc62c4893c7d/os-volume_attachments], error message: {"badRequest": {"code": 400, "message": "Invalid input received: Invalid volume: Volume e162b4b1-be0f-4b63-a8eb-6bf679c9719e status must be available or downloading to reserve, but the current status is creating. (HTTP 400) (Request-ID: req-6f2d38f9-c0d4-43ab-81bf-da75d347e723)"}}
2m17s       Warning   FailedScheduling         pod/mariadb-78d7945894-zmg7k        running PreBind plugin "VolumeBinding": Operation cannot be fulfilled on persistentvolumeclaims "mariadb-pvc": the object has been modified; please apply your changes to the latest version and try again
1s          Warning   BackOff                  pod/mariadb-78d7945894-zmg7k        Back-off restarting failed container mariadb in pod mariadb-78d7945894-zmg7k_default(d0952758-94e9-4d9e-aeda-c8f851a891b6)
[...]
kubectl logs mariadb-78d7945894-zmg7k

2023-11-30 13:31:58+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server latest started.
2023-11-30 13:31:58+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2023-11-30 13:31:58+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server latest started.
2023-11-30 13:31:58+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2023-11-30 13:31:58 0 [Note] Starting MariaDB 11.2.2-MariaDB-1:11.2.2+maria~ubu2204 source revision 929532a9426d085111c24c63de9c23cc54382259 as process 1
2023-11-30 13:31:58 0 [ERROR] mariadbd: Can't lock aria control file '/var/lib/mysql/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
2023-11-30 13:32:28 0 [ERROR] mariadbd: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2023-11-30 13:32:28 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-11-30 13:32:28 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2023-11-30 13:32:28 0 [Note] InnoDB: Number of transaction pools: 1
2023-11-30 13:32:28 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2023-11-30 13:32:28 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
2023-11-30 13:32:28 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2023-11-30 13:32:28 0 [Note] InnoDB: Completed initialization of buffer pool
2023-11-30 13:32:28 0 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
2023-11-30 13:32:28 0 [Note] InnoDB: Check that you do not already have another mariadbd process using the same InnoDB data or log files.
2023-11-30 13:32:28 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2023-11-30 13:32:28 0 [Note] InnoDB: Starting shutdown...
2023-11-30 13:32:28 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2023-11-30 13:32:28 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-11-30 13:32:28 0 [Note] Plugin 'wsrep-provider' is disabled.
2023-11-30 13:32:28 0 [ERROR] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some plugins may be not loaded
2023-11-30 13:32:28 0 [ERROR] Failed to initialize plugins.
2023-11-30 13:32:28 0 [ERROR] Aborting

的一种或多种
如果你有任何想法,我将非常感谢。如果需要更多的信息,请问我!

nwsw7zdq

nwsw7zdq1#

您不能创建MariaDB Pod的多个副本。MariaDB需要独占访问存储目录;使用您的配置,您试图在MariaDB的三个示例之间共享存储目录。这就是为什么事情会崩溃。
如果您想要多个MariaDB示例,则需要使用StatefulSet,为每个示例提供自己的存储卷,然后配置galera cluster以启用示例之间的复制。

相关问题