Today I’m going to walk you through how I went about replacing MySQL with Percona. The load on one of my servers reached the point where replacing MySQL with Percona just made sense. The approach used here may seem redundant to some but this is the way I got things to work. We’ll need to upgrade MySQL to 5.5 so the database connector used by Plesk is updated as well, otherwise things might not work. If you haven’t heard about Percona I suggest you head on over to percona.com.
A little bit about Percona from their website
A free open source solution, Percona Server is a MySQL alternative which offers breakthrough performance, scalability, features, and instrumentation. Self-tuning algorithms and support for extremely high-performance hardware make it the clear choice for organizations that demand excellent performance and reliability from their MySQL database server. Features: - Queries will run faster and more consistently - You can consolidate servers on powerful hardware - Sharding is delayed or avoided entirely - You can save money on hosting fees and power - You can spend less time tuning and administering - You can achieve higher uptime - Troubleshooting does not require guesswork URL: www.percona.com
wget -q -O - http://www.atomicorp.com/installers/atomic |sh
Next step is to update MySQL, this will in turn upgrade PHP as well. The server I am upgrading was running PHP 5.3 so an upgrade is welcome.
yum upgrade mysql
Next step is to upgrade all the database for MySQL 5.5
mysql_upgrade -uadmin -p`< /etc/psa/.psa.shadow `
It’s now time you log into Plesk and make sure it’s working properly, to verify this add a new customer. If all goes well you should see a message similar to the one below. Note: test is the name of the customer for the sake of this example. Here starts the fun part, start by dumping all of the MySQL databases.
mysqldump -uadmin -p`< /etc/psa/.psa.shadow ` --all-databases | gzip > /root/mysql.all.dump.sql.gz
Below we’re going to remove MySQL.
service mysqld stop rpm -e --nodeps `rpm -q --whatprovides mysql-server` yum remove mysql mysql-server plesk-mysql
This makes sure you only remove MySQL and none of it’s dependencies.
Issue the following to add the Percona repo to your server.
yum install http://www.percona.com/downloads/percona-release/percona-release-0.0-1.x86_64.rpm
Issuing the following at shell should tell you what’s available through Percona.
yum list percona-server*
To get Percona up and running you need three things
Issue the following at shell to install the client server and shared library.
yum install Percona-Server-client-56 Percona-Server-server-56 Percona-Server-shared-56
Start the Percona server.
service mysql start
Now check and see whether Plesk is playing nice with it. Again, create a new customer to see whether things run smoothly, if the customer is created then all is good.