I have a problem copying a MySQL 5.7 server from one Docker container to another. So the dbs are large about 100 Gig. So dumping and then importing takes way too long. I cannot allow any downtime on the source server so no shutting down the mysql server to copy it.
<code>1) I use the same exact docker run command on a different server with the same OS.
2) I then stop this Target server
3) then I get the files from the Source server by zipping up the /var/lib/mysql folder
4) I unzip the folder overriding the files in the Target server files.
5) I then restart the Target server and get in with no problem. I can see the DBS, and I can query the tables.
6) SET GLOBAL general_log=1; then I tail the log file to see the queries coming in.
<code>1) I use the same exact docker run command on a different server with the same OS.
2) I then stop this Target server
3) then I get the files from the Source server by zipping up the /var/lib/mysql folder
4) I unzip the folder overriding the files in the Target server files.
5) I then restart the Target server and get in with no problem. I can see the DBS, and I can query the tables.
6) SET GLOBAL general_log=1; then I tail the log file to see the queries coming in.
</code>
1) I use the same exact docker run command on a different server with the same OS.
2) I then stop this Target server
3) then I get the files from the Source server by zipping up the /var/lib/mysql folder
4) I unzip the folder overriding the files in the Target server files.
5) I then restart the Target server and get in with no problem. I can see the DBS, and I can query the tables.
6) SET GLOBAL general_log=1; then I tail the log file to see the queries coming in.
The problem comes when I try any aggregate query. literally “select * from mydb.mytable” vs “select count(*) from mydb.mytable”. The moment the count function is run I get
<code>"SELECT count(*) FROM mydb.mytable LIMIT 0, 100 Error Code: 2013. Lost connection to MySQL server during query 0.985 sec"
<code>"SELECT count(*) FROM mydb.mytable LIMIT 0, 100 Error Code: 2013. Lost connection to MySQL server during query 0.985 sec"
</code>
"SELECT count(*) FROM mydb.mytable LIMIT 0, 100 Error Code: 2013. Lost connection to MySQL server during query 0.985 sec"
Not only do I get disconnected from the server but “general_log” gets turned back off after I explicitly turned it on (I find this really weird).
I played around with all these settings according to what I have found online but to no avail.
<code>SHOW VARIABLES LIKE "%wait_timeout%";
SHOW VARIABLES LIKE "%net_read_timeout%";
SHOW VARIABLES LIKE "%max_execution_time%";
SHOW VARIABLES LIKE "%net_buffer_length%";
SHOW VARIABLES LIKE "%max_allowed_packet%";
SHOW VARIABLES LIKE "%connect_timeout%";
SHOW STATUS LIKE '%aborted%'
<code>SHOW VARIABLES LIKE "%wait_timeout%";
SHOW VARIABLES LIKE "%net_read_timeout%";
SHOW VARIABLES LIKE "%max_execution_time%";
SHOW VARIABLES LIKE "%net_buffer_length%";
SHOW VARIABLES LIKE "%max_allowed_packet%";
SHOW VARIABLES LIKE "%connect_timeout%";
SHOW STATUS LIKE '%aborted%'
</code>
SHOW VARIABLES LIKE "%wait_timeout%";
SHOW VARIABLES LIKE "%net_read_timeout%";
SHOW VARIABLES LIKE "%max_execution_time%";
SHOW VARIABLES LIKE "%net_buffer_length%";
SHOW VARIABLES LIKE "%max_allowed_packet%";
SHOW VARIABLES LIKE "%connect_timeout%";
SHOW STATUS LIKE '%aborted%'
I should add here that I can recreate it over and over, every time starting from scratch.