This tutorial is for you that is trying to import your current database into a Google Cloud SQL instance, replica, that will be setup for replication purposes.
According to the documentation, you will need to run:
mysqldump \ -h [MASTER_IP] -P [MASTER_PORT] -u [USERNAME] -p \ --databases [DBS] \ --hex-blob --skip-triggers --master-data=1 \ --order-by-primary --compact --no-autocommit \ --default-character-set=utf8 --ignore-table [VIEW] \ --single-transaction --set-gtid-purged=on | gzip | \ gsutil cp - gs://[BUCKET]/[PATH_TO_DUMP]
The mysqldump parameters are:
-hthe hostname or IPV4 address of theprimaryshould replace[MASTER_IP]-Pthe port or theprimaryserver, usually[MASTER_PORT]value will be3306-utakes the username passed on[USERNAME]-pinforms that a password will be given--databasesa comma separated list of the databases to be imported. Keep in mind[DBS]should not include thesys,performance_schema,information_schema, andmysqlschemas--hex-blobnecessary for dumping binary columns which types could beBINARY,BLOBand others--skip-triggersrecommended for the initial load, you can import the triggers at a later moment--master-dataaccording to the documentation: “It causes the dump output to include aCHANGE MASTER TOstatement that indicates the binary log coordinates (file name and position) of the dumped server”--order-by-primaryit dumps the data in the primary key order--compactproduces a more compact output, enabling several flags for the dump--no-autocommitencloses the table between aSET autocommit=0andCOMMITstatements--default-character-setinforms the default character set--ignore-tablemust list theVIEWto 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-transactionaSTART TRANSACTIONis sent to the database so the dump will contain the data up to that point in time--set-gtid-purgedwrites the the state of the GTID information into the dump file and disables binary logging when the dump is loaded into thereplica
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.

Hi Gabi,
Is it possible to the dump, without switching all tables into ReadOlny?
the case that We have is that database 1,5TB large and as You can assume dump will take ages so the business does not agree to stop production for that long time.
We are trying to find some tools that could help us to achieve migration with minimal downtime.