I'm attempting to migrate a MySQL database (10M+ records) from an EC2 instance into an RDS Instance using a script:
#!/bin/bash
mysqldump --databases my_db \
--compress \
--order-by-primary \
--single-transaction \
-u dba \
-ppassword | mysql \
--host=host.us-east-1.rds.amazonaws.com \
--port=3306 \
--max_allowed_packet=500M \
-u dba \
-ppassword
The script connects and begins to transfer data as expected, but then errors out after about 5 minutes with the following error:
ERROR 2006 (HY000) at line 1406: MySQL server has gone away
mysqldump: Got errno 32 on write
The script works fine for smaller databases, and for the larger database it transfers several million records before the error.
I'm not sure how to get past this issue. I'd love to get some suggestions (parameter adjustments on EC2 or RDS, how to get more detail on error etc.)