Saturday, March 2, 2013

Percona database won't start

I just finished a long hair pulling session trying to get Percona 5.5 installed on Ubuntu 12.10. What was happening is I would install from the percona repositories and everything would seem to go fine. I would attempt to move the data and log files away from the default location so that I could serve them from my ZFS pool and when I would put in the change into the my.cnf file the database would no longer come back up. It seemed like it was still starting, as I was seeing process running, but just one when I should have seen 12 or so.

This case was particularly frustrating because the my.cnf file I was using was generated by the Percona Configuration Wizard (https://tools.percona.com/wizard). The Configuration Wizard is a really great tool that takes some input from you about your server and intended use and outputs a config file for Percona. I assumed the configs generated from here would just work, but they don't.

What I figured out in the end is the /etc/init.d/mysql script uses the /etc/mysql/debian.cnf file settings to check if the mysqld server is up or not by pinging on the socket located at /var/run/mysqld/mysqld.sock the config file puts the socket by default into your data directory (on my zfs pool).

Two possible solutions, one verified, one should work in theory:

  1. Change the config generated from the wizzard to put the socket at the location that debian.cnf expects it. (/var/run/mysqld/mysqld.sock). This is what I ended up doing and it worked very well. 
  2. create a symbolic link between where you socket is, and where the startup script thinks it should be. e.g. sudo ln -s /path/to/your/actual/file/mysqld.sock /var/run/mysqld . This should work in theory and the reason I didn't do it this way is I'm not sure if there is special syntax for creating a symlink to a socket, or if there were any special considerations for reboot scenarios.