📜 ⬆️ ⬇️

Seamless migration of MySQL 5.0 -> Percona Server 5.5 with repartitioning storage

Hello.

I want to share the experience of migrating a combat database from MySQL 5.0 to Percona Server 5.5 under load almost on the job.

I will describe briefly the evolution of our base to the current state


Our base is old, has experienced several MySQL upgrades. We started with MySQL 3.x. With the increase in load, already on MySQL 5.0 , we configured replication and connected another server for reading. Then we did it using standard MySQL tools, without involving xtrabackup - completely blocking the server at the time of the creation of the master dump and hung out on the sites stubs.
')
Then the next problem arose - a place with data began to run out on the data volume. Plus InnoDB storage has historically been located in a single file. It was considered a lot of solutions. Starting from placing a base on an iSCSI volume and ending with popping up more capacious disks into the raid, expanding the volume group / logical volume with the subsequent expansion of the file system.

As a temporary option, we decided to connect with an iSCSI virtual machine for VMWare vCloud ( no ads, honestly! ). vCloud stands by our side.

We started with an experiment on the slave . The experiment was successful, and for some time the second read-only MySQL kept the storage on the iSCSI volume.

Began to think seriously about moving the base completely to the cloud


As an experiment, we connected the server to vCloud with the second read slave. Transferred to it the entire load from the first slave. By performance, the virtual server won by a good margin. Affected by more powerful hardware from vCloud hosts. Switched the load back. Began to think.

At this moment a strange mystical event happened. A few hours after the experiment was completed with the load on the virtual server, a tricky accident occurred in the data center, as a result of which several servers were de-energized, including a physical slave. The relay log , located on the iSCSI volume of the physical slave, has garbage. Replication stopped.

The most logical action in this situation was switching to the cloud slave, which we did.

Thus, we were already one read-only foot in vCloud . You had to drag master .

They decided to move to Percona 5.5 , also on two servers, but with a private partitioning of the InnoDB storage.

The main restriction when moving was the inability to stop the base for any long time.
Since we are talking about splitting InnoDB storages into tables, it’s impossible to do without copying data. It is necessary to inject a new base from the dump.

To get a master dump, you need to lock a 125 gig base for more than an hour. This is unacceptable on a combat base. We decided to backup the master with xtrabackup , raise the server on the resulting cast, and remove the master dump from it.

So the ingredients



To partition the InnoDB storage in tables on new servers, you must set the option " innodb_file_per_table = 1 ".

Since this is a cloud, we playfully raise three missing servers in five minutes.

As part of the program to reduce downtime to a minimum, we decided not to reconfigure applications to work with the new master, but simply to raise the ip of the old master on the new server. For this, it is necessary that the ip of the old server is visible on the new wizard for all clients. In our case, all five servers are on the same subnet, so there are no problems with this.

And now - a sequence of actions.



In total, we get four servers: two old, but so far combat MySQL 5.0 , and two new Percona 5.5 already with actual data.


The fun begins. Switch master . Here is the point of no return. Starting from this moment, we note the downtime of the master database.


Everything


In our case, the downtime was about one and a half minutes. Most of this time was 5.0-master . In principle, idle time could be reduced even more by dropping InnoDB caches before stopping the bases.

vCloud showed a good side. Performance when moving significantly increased due to a more powerful hardware and much more nimble disk subsystem, since the virtual disk is “smeared” by a large number of physical media.

Source: https://habr.com/ru/post/154451/


All Articles