GoogleCloudPlatform / mysql-docker

GNU General Public License v2.0
24 stars 22 forks source link

Mysql container crash when deploying on GKE #59

Open idkw opened 4 years ago

idkw commented 4 years ago

Hi,

I'm trying to deploy this image with the following kubernetes files :

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: mysql-data
  annotations:
    volume.alpha.kubernetes.io/storage-class: ssd
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 50Gi
apiVersion: v1
kind: Pod
metadata:
  name: mysql
  labels:
    name: mysql
spec:
  hostname: mysql
  containers:
    - image: launcher.gcr.io/google/mysql8
      name: mysql
      env:
        - name: MYSQL_ROOT_PASSWORD
          value: test
        - name: MYSQL_DATABASE
          value: test
        - name: MYSQL_USER
          value: test
        - name: MYSQL_PASSWORD
          value: test

      volumeMounts:
        - name: mysql-data
          mountPath: /var/lib/mysql
  volumes:
    - name: mysql-data
      persistentVolumeClaim:
        claimName: mysql-data

When the container is deployed, the mysql server starts and then crash immediately. The logs are :

Initializing database
2019-11-28T16:39:29.865253Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2019-11-28T16:39:29.865292Z 0 [Warning] [MY-011068] [Server] The syntax 'expire-logs-days' is deprecated and will be removed in a future release. Please use binlog_expire_logs_seconds instead.
2019-11-28T16:39:29.865519Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.18) initializing of server in progress as process 34
2019-11-28T16:39:29.867317Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-11-28T16:39:29.867329Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2019-11-28T16:39:29.867455Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-11-28T16:39:29.869476Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.18)  MySQL Community Server - GPL.

I see that it crashes with :

2019-11-28T16:39:29.867329Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.

I haven't found any relevant solution to this issue. When launching the container locally on my machine I don't get that issue. Is there some kind of file permission issue on GCP persistent volumes claims ?

basil1120 commented 2 years ago

FACING SAME CHALLENGE RUNNING MYSQL on GKE on GCP

2022-06-06T09:53:55.734421713Z mysqld(_Z16buf_page_get_genRK9page_id_tRK11page_size_tmP11buf_block_tmPKcmP5mtr_tb+0x409)[0x55ec5cbe3669] Error 2022-06-06T09:53:55.735100412Z mysqld(_Z31trx_rseg_get_n_undo_tablespacesPm+0x13e)[0x55ec5cb7fc8e] Error 2022-06-06T09:53:55.735780064Z mysqld(+0x113b9f7)[0x55ec5cb509f7] Error 2022-06-06T09:53:55.736463033Z mysqld(_Z34innobase_start_or_create_for_mysqlv+0x2f7f)[0x55ec5cb545cf] Error 2022-06-06T09:53:55.737143266Z mysqld(+0x1011b20)[0x55ec5ca26b20] Error 2022-06-06T09:53:55.737641644Z mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x55)[0x55ec5c166185] Error 2022-06-06T09:53:55.738291938Z mysqld(+0xbf9706)[0x55ec5c60e706] Error 2022-06-06T09:53:55.738920601Z mysqld(_Z40plugin_register_builtin_and_init_core_sePiPPc+0x1dc)[0x55ec5c6105dc] Error 2022-06-06T09:53:55.739387319Z mysqld(+0x6f9c9e)[0x55ec5c10ec9e] Error 2022-06-06T09:53:55.739856363Z mysqld(_Z11mysqld_mainiPPc+0x768)[0x55ec5c110118] Error 2022-06-06T09:53:55.739870782Z /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb)[0x7f74e42d609b] Error 2022-06-06T09:53:55.740459095Z mysqld(_start+0x2a)[0x55ec5c10514a]