-h the hostname or IPV4 address of the primary should replace [MASTER_IP]

-P the port or the primary server, usually [MASTER_PORT] value will be 3306

-u takes the username passed on [USERNAME]

-p informs that a password will be given

--databases a comma separated list of the databases to be imported. Keep in mind [DBS]should not include the sys, performance_schema, information_schema, and mysql schemas

--hex-blob necessary for dumping binary columns which types could be BINARY, BLOB and others

--skip-triggers recommended for the initial load, you can import the triggers at a later moment

--master-data according to the documentation: “It causes the dump output to include a CHANGE MASTER TO statement that indicates the binary log coordinates (file name and position) of the dumped server”

--no-autocommit encloses the table between a SET autocommit=0 and COMMIT statements

--default-character-set informs the default character set

--ignore-table must list the VIEW to be ignored on import, for multiple views, use this option multiple times. Views can be imported later on after promotion of the replica is done

--single-transaction a START TRANSACTION is sent to the database so the dump will contain the data up to that point in time

--set-gtid-purged writes the the state of the GTID information into the dump file and disables binary logging when the dump is loaded into the replica

After that the result is compressed in a GZIP file and uploaded to a bucket on Google Cloud Storage with gsutil cp - gs://[BUCKET]/[PATH_TO_DUMP] where [BUCKET] is the bucket you created on GCS and [PATH_TO_DUMP] will save the file in the desired path.

Be aware that no DDL operations should be performed in the database while the dump is being generated else you might find inconsistencies.

See something wrong in this tutorial? Please don’t hesitate to message me through the comments or the contact page.