Use dbdeployer to easily test multiple versions of MySQL
#SRG(Service Reliability Group) is a group that mainly provides cross-sectional support for the infrastructure of our media services, improving existing services, launching new ones, and contributing to OSS.
This article is located in SRGDBWGWe will publish materials regarding the database provided by the DB Working Group for the entire company.
I hope this helps in some way.
What is dbdeployer?How to install dbdeployerHow to use dbdeployerPreparing the MySQL packageStart the MySQL sandbox with dbdeployerDeleting a SandboxUseful features of dbdeployerEstablish asynchronous replication between sandboxesConcurrently query the asynchronous replication sandbox you builtConclusion
What is dbdeployer?
It is recommended to use it insteaddbdeployeris a sandbox tool written in Go that was released in 2018.
It allows you to easily run multiple versions of MySQL simultaneously, which is extremely useful for checking and verifying between versions.
It covers almost all the features available in MySQL Sandbox and has evolved to be easier to use.
How to install dbdeployer
In the CentOS7 environment, additional packages were required, so I installed them first.
The rest is as per the steps in the official documentation.
1.72.0
As described in the official documentation, you can also install it by running a script via curl.
How to use dbdeployer
Preparing the MySQL package
The first time you run init, it will download the latest MySQL.
The downloaded package is located in the following directory:
downloads list
If the version you want to use is in the list above, you can get it using the command below.
Check the list of available MySQL servers.
You can see that the latest version, 8.0.32, and the 5.7.34 we just added are available.
If you want to use a version that is not in the list above, you can download the tarball directly from the official MySQL website.
For example, the latest version of 5.7, 5.7.41, was not on the list, so I downloaded it from the official MySQL website and extracted it.
Now 5.7.41, which was not listed, is also available.
Start the MySQL sandbox with dbdeployer
Let's start MySQL 8.0.32 right away. This time, we will start it on a single node.
There are three types of deploy: single, multiple, and replication.
- single
- Start a single MySQL instance.
- multiple
- Run multiple instances of the same version of MySQL without replication. Default number: 3
- replication
- It will start with a replication configuration of three machines: one master and two slaves.
- Options are available to increase the number of nodes, and enable multi-master and group replication.
You can check which sandboxes are running with the command below. 8.0.32 has been successfully launched.
Connect to the launched sandbox with the following command:
You can see that the connection was successful and the version confirmation query was also executed.
Deleting a Sandbox
Sandboxes that are no longer needed can be deleted as follows:
First, check the list of sandboxes that are running.
Select the unnecessary sandbox and delete it. That's it.
Useful features of dbdeployer
Establish asynchronous replication between sandboxes
By specifying deploy replication, which was introduced when explaining deploy earlier, it is possible to start sandboxes with replication already established.
You can connect to each sandbox as follows:
Concurrently query the asynchronous replication sandbox you built
Rather than connecting to each sandbox and running queries each time, there is a way to run them all at once.
To give an example, the following is possible:
- Check the replication status on all machines
- Execute the same SQL query on all machines
- Execute SQL queries only on the master DB
- Execute SQL queries only on the slave DB
Conclusion
SRG is looking for people to work with us.
If you're interested, please contact us here.