简体   繁体   中英

Unable to create a MySQL database backup in GCP storage

We deploy a laravel project in k8s(GCP) with mysql database. Now i want time to time backup of this database with the help of cronjob and I followed an articles but i'm unable to create a backup file. However, as per article we need to create the storage bucket and service account in GCP

It is working properly still there is no backup file in storage bucket.

cronjob.yaml file

apiVersion: batch/v1beta1 kind: CronJob metadata: name: backup-cronjob spec: schedule: "*/1 * * * *" jobTemplate: spec: template: spec: containers: - name: backup-container image: gcr.io/thereport/abcd env: - name: DB_NAME valueFrom: configMapKeyRef: name: backup-configmap key: db - name: GCS_BUCKET valueFrom: configMapKeyRef: name: backup-configmap key: gcs-bucket - name: DB_HOST valueFrom: secretKeyRef: name: backup key: db_host - name: DB_USER valueFrom: secretKeyRef: name: backup key: username - name: DB_PASS valueFrom: secretKeyRef: name: backup key: password - name: GCS_SA valueFrom: secretKeyRef: name: backup key: thereport-541be75e66dd.json args: - /bin/bash - -c - mysqldump --u root --p"root" homestead > trydata.sql; gcloud config set project thereport; gcloud auth activate-service-account --key-file backup; gsutil cp /trydata.sql gs://backup-buck

 restartPolicy: OnFailure

You don't copy the right file:

mysqldump --u root --p"root" homestead > trydata.sql ; gcloud config set project thereport; gcloud auth activate-service-account --key-file backup; gsutil cp /laravel.sql gs://backup-buck

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM