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.)
--max_allowed_packet=500M
. You also have to set it on the RDS instance -- not just the client. This is very unlikely to have anything do with timeouts, resources, or space -- error 32 is "Broken pipe." The RDS instance is killing the connection, while the client is at "line 1406" of the data and assuming it's not crashing, then your problem is going to be fixed by increasingmax_allowed_packet
in the RDS parameter group to be consistent with what you're setting on the client.