Bug #112809 How to backup MySQL to minio
Submitted: 24 Oct 2023 7:13 Modified: 24 Oct 2023 10:12
Reporter: Bing Ma (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Operator Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[24 Oct 2023 7:13] Bing Ma
Description:
I see the crd.yaml support s3, I guess the config is a secret name, what the conteng of this secret?

s3:
                                type: object
                                required: ["bucketName", "config"]
                                properties:
                                  bucketName:
                                    type: string
                                    description: "Name of the S3 bucket where the dump is stored"
                                  prefix:
                                    type: string
                                    description: "Path in the bucket where the dump files are stored"
                                  config:
                                    type: string
                                    description: "Name of a Secret with S3 configuration and credentials"
                                  profile:
                                    type: string
                                    default: ""
                                    description: "Profile being used in configuration files"
                                  endpoint:
                                    type: string
                                    description: "Override endpoint URL"

How to repeat:
I wrote one file myself, it failed:
apiVersion: mysql.oracle.com/v2
kind: MySQLBackup
metadata:
  name: a-cool-one-off-backup
spec:
  clusterName: ic1
#  backupProfileName: dump-instance-profile-pvc
#  backupProfileName: dump-instance-local-pvc
  backupProfile:
    name: s3-backup-profile
    dumpInstance:
      dumpOptions:
        excludeSchemas: [ "excludeme" ]
      storage:
        s3:
          bucketName: mysql
          prefix: backup
          config: s3-secret1
          endpoint: http://172.30.47.0:32418/

---
the s3-secret1:
apiVersion: v1
kind: Secret
metadata:
  name: s3-secret1
  namespace: oracle-mysql
  uid: f8045bc4-3869-4ddc-8bef-fa9088df8657
  resourceVersion: '102110811'
  creationTimestamp: '2023-10-24T06:46:58Z'
  labels:
    k8slens-edit-resource-version: v1
  managedFields:
    - manager: kubectl-create
      operation: Update
      apiVersion: v1
      time: '2023-10-24T06:46:58Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:data: {}
        f:type: {}
    - manager: node-fetch
      operation: Update
      apiVersion: v1
      time: '2023-10-24T06:54:55Z'
      fieldsType: FieldsV1
      fieldsV1:
        f:data:
          f:AWS_ACCESS_KEY_ID: {}
          f:AWS_SECRET_ACCESS_KEY: {}
        f:metadata:
          f:labels:
            .: {}
            f:k8slens-edit-resource-version: {}
  selfLink: /api/v1/namespaces/oracle-mysql/secrets/s3-secret1
data:
  AWS_ACCESS_KEY_ID: bWluaW8=
  AWS_SECRET_ACCESS_KEY: eDhyXkBEWSU=
type: Opaque

---
the pod logs:
ls: cannot access '/.oci': No such file or directory
2023-10-24T06:55:07 - [INFO] [backup] backupdir=/mnt/storage
2023-10-24T06:55:07 - [INFO] [backup] Loading up MySQLBackup object oracle-mysql/a-cool-one-off-backup
2023-10-24T06:55:07 - [INFO] [backup] Starting backup of oracle-mysql/ic1  profile=  backupdir=/mnt/storage
2023-10-24T06:55:07 - [INFO] [backup] Cluster status from ic1-0 is OK, member_status={"address": "ic1-0.ic1-instances.oracle-mysql.svc.cluster.local:3306", "applierWorkerThreads": 4, "fenceSysVars": ["read_only", "super_read_only"], "memberId": "257895ff-714d-11ee-ae24-b22f42916f95", "memberRole": "SECONDARY", "memberState": "ONLINE", "mode": "R/O", "readReplicas": {}, "replicationLag": "applier_queue_applied", "role": "HA", "status": "ONLINE", "version": "8.1.0"} applier_queue_size=0
2023-10-24T06:55:07 - [INFO] [backup] dump_instance starting: output=backup/a-cool-one-off-backup-20231024-065504  options={'excludeSchemas': ['excludeme'], 'threads': 8, 's3BucketName': 'mysql', 's3Profile': '', 's3EndpointOverride': 'http://172.30.47.0:32418/'}  source=mysqladmin@ic1-0.ic1-instances.oracle-mysql.svc.cluster.local:3306
Traceback (most recent call last):
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/backup_main.py", line 291, in command_do_create_backup
    info = do_backup(backup, job_name, start, backup_dir, logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/backup_main.py", line 207, in do_backup
    return execute_dump_instance(backup_source, profile.dumpInstance, backupdir, job_name, logger)
  File "/usr/lib/mysqlsh/python-packages/mysqloperator/backup_main.py", line 92, in execute_dump_instance
    util.dump_instance(output, options)
RuntimeError: Util.dump_instance: Argument #2: The AWS access and secret keys were not found in: environment variables

2023-10-24T06:55:07 - [ERROR] [backup] Backup failed with an exception: Util.dump_instance: Argument #2: The AWS access and secret keys were not found in: environment variables

2023-10-24T06:55:07 - [INFO] [backup] Command execute-backup finished with code False
[24 Oct 2023 9:47] MySQL Verification Team
Hi Mr. Ma,

Thank you for your bug report.

Let us inform you that this is a forum dedicated only to MySQL products. Hence, we will gladly provide info on how to backup to some of our own products. 

Can you amend your report in that manner.

Many thanks in advance.
[24 Oct 2023 9:52] Bing Ma
the meaning of 'some of our own products' is  Oracle Cloud Infrastructure (OCI)??
[24 Oct 2023 10:10] MySQL Verification Team
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

For details on getting support for MySQL products see http://www.mysql.com/support/
You can also check our forums (free) at http://forums.mysql.com/

Thank you for your interest in MySQL.
[24 Oct 2023 10:12] Bing Ma
ok