Initializing a container to run on MySQL using Kubernetes
P粉315680565
P粉315680565 2024-03-26 19:48:31
0
1
355

I am running mysql as an init container of a kubernetes deployment.

For various reasons, I need to start mysql/restore a backup of mysql in the init container -> save it into a pvc, then the main pod will be a mysql pod with the data attached.

This is because I need to take a snapshot of the disk, and I will have CI monitor the snapshot before the pod is ready/running.

�%

P粉315680565
P粉315680565

reply all(1)
P粉683665106

You can start mysql sleeping in the background before mysqld. Does this work for you?

start_mysql {
    sleep 30
    mysql -u root -ppassword < /data/backups/backup.sql
    mysql -u root -ppassword < /sql-files/sql-files.sql
}

start_mysql &
./entrypoint.sh
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!