Kubernetes Dump mysql and restore Mysql

10/20/2021

I need a mechanism where i can dump the mysql which is running as a pod in the EKS cluster. By main use case is the the dump i can share to my development team so that they can restore the dump in their local(normal mysql running as service). I have seen Velero, Portworx but they only restore/dump within cluster(k8) not useful for me if a developer wants to restore in local. Also i worked using normal mysqldump/mysql with kind schedulerjob/cronjob but in my db their are UUID using where when it is getting converted to "null" value . Any help would be highly appreciated as it is pulling my head from last week.

-- Jithin Kumar S
dump
kubernetes
mysql
mysql-workbench
velero

1 Answer

10/20/2021

You can try out the

mysqldump --user=root --port=3306 --password=topsecret --hex-blob some_database

--hex-blob : Dump binary columns using hexadecimal notation

Doc : https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html#option_mysqldump_hex-blob

Just to add, you can also run UI of Adminer to export the data instead of using command to container.

OR

Copying the entire data folder

If you are copying the entire database, all of the databases and the contents of the database, you can just zip up your entire MySQL data directory, and copy it to the new server Pod's data directory.

This is way to copy InnoDB files from one instance to another. This will work fine if you're moving between servers running the same OS family and the same version of MySQL

https://dev.mysql.com/doc/refman/8.0/en/server-options.html#option_mysqld_datadir

-- Harsh Manvar
Source: StackOverflow