Use dbdeployer to easily test multiple versions of MySQL.

Kikai from the Service Reliability Group (SRG) of the Technology Division@fat47)is.
#SRGThe Service Reliability Group primarily provides comprehensive support for the infrastructure surrounding our media services, focusing on improving existing services, launching new ones, and contributing to open-source software (OSS).
This article is located within SRG.DBWGThe DB Working Group is releasing database-related materials that it provides to the entire company.
I hope this is of some help.
 

What is dbdeployer?


The MySQL sandbox tool is written in Perl.MySQL SandboxIt was well-known, but its use was discouraged in 2018.
Recommended as an alternative.dbdeployerIt is a sandbox tool written in Go and released in 2018.
It allows you to easily run multiple versions of MySQL simultaneously, which is extremely useful for checking and verifying differences between versions.
Almost all the features available in MySQL Sandbox are included, and it has evolved to be even easier to use.
 

How to install dbdeployer


In a CentOS 7 environment, additional packages are required, so we'll install them first.
 
The rest is just the procedure outlined in the official documentation.
1.72.0
 
As mentioned in the official documentation, it is also possible to install it by running a script via curl.
 

How to use dbdeployer


Preparing the MySQL package

The first time you run it, execute `init`. This will download the latest version of MySQL.
 
The downloaded package is located in the following directory:
 
downloads list
 
If the version you want to use is listed above, you can retrieve it using the following command.
 
Check the list of available MySQL instances.
You can see that the latest version, 8.0.32, and the newly added 5.7.34 are both available.
 
If you want to use a version that is not on the list mentioned earlier, you can download the tar file directly from the official MySQL website.
For example, version 5.7.41, the latest version of 5.7, wasn't in the list, so I downloaded and extracted it from the official MySQL website.
 
This makes version 5.7.41, which was not previously listed, available as well.
 

Let's try starting the MySQL sandbox with dbdeployer.

Let's start MySQL 8.0.32. This time, we'll start it on a single node.
 
There are three types of deploy: single, multiple, and replication.
  • single
    • Start a single MySQL instance.
  • multiple
    • This command starts multiple instances of the same MySQL version without replication. Default number of instances: 3
  • replication
    • The system starts up with a replication configuration consisting of one master and two slaves, for a total of three machines.
    • Options allow for increasing the number of nodes, multi-master configurations, and group replication.
 
You can check which sandboxes are running using the following command. Version 8.0.32 has started successfully.
 
Connect to the launched sandbox using the following command.
This confirms that the connection was successful and that the version check query was executed.
 

Sandbox removal

Unnecessary sandboxes can be deleted as follows:
First, check the list of currently running sandboxes.
 
Select the unnecessary sandbox and delete it. That's it.
 

Useful features of dbdeployer


Establishing asynchronous replication between sandboxes

As mentioned in the previous explanation of deploy, by specifying `deploy replication`, it is possible to start sandboxes with replication already configured.
 
You can connect to each sandbox as follows:
 

Execute queries simultaneously against the asynchronous replication sandbox that you have built.

Instead of connecting to each sandbox and executing queries every time, there's a way to execute them all at once.
For 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 database.
         
        • Execute SQL queries only on the slave DB.
           
           

          In conclusion


          SRG is looking for new team members. If you are interested, please contact us here.