diff --git a/README.md b/README.md index d260498..097f12b 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ docker-compose up -d Create the database: ```bash -docker exec my-container sh -c 'echo "create database aWordpressDatabase;" | exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD"' +docker-compose exec backup-slave sh -c 'echo "create database aWordpressDatabase;" | exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD"' ``` ### Freeze the master @@ -109,7 +109,7 @@ The classic way is preferred when you have a big database because it locks the d Now, we need to import the backup from the master, so as we started the slave as readwrite, we can now do this on the slave: ```bash -docker exec my-container sh -c 'mysqldump -C --lock-tables=false --quick -u repluser -h master.host --password="aRandomPassword" aWordpressDatabase | mysql -u root -p"$MYSQL_ROOT_PASSWORD" aWordpressDatabase' +docker-compose exec backup-slave sh -c 'mysqldump -C --lock-tables=false --quick -u repluser -h master.host --password="aRandomPassword" aWordpressDatabase | mysql -u root -p"$MYSQL_ROOT_PASSWORD" aWordpressDatabase' ``` Replace **my-container**, **repluser**, **master.host**, **aRandomPassword**, **aWordpressDatabase** with the correct values. @@ -141,10 +141,10 @@ On the slave, copy the dump file in the running container, like this: docker cp thedump.sql.gz my-container:/thedump.sql.gz ``` -Then we import it: +Then we import it: ```bash -docker exec my-container sh -c 'zcat /thedump.sql.gz | mysql -u root -p"$MYSQL_ROOT_PASSWORD" aWordpressDatabase' +docker-compose exec backup-slave sh -c 'zcat /thedump.sql.gz | mysql -u root -p"$MYSQL_ROOT_PASSWORD" aWordpressDatabase' docker exec my-container sh -c 'rm /thedump.sql.gz' ```