MySQL cookbook and custom innodb settings


#1

Hi,

I’m using the opscode database and MySQL cookbooks, but I’m running into a
problem when using custom settings for innodb “tunables” such as
:innodb_log_file_size. The mysql cookbook installs the mysql-server package
before generating my.cnf. This is reasonable as some package managers might not
react well to config files being in place before packages are installed.
Unfortunately, at least on Ubuntu 12.04, the mysql-server package starts the
mysql service as soon as it is installed. This causes binary log files to be
generated with the default configuration parameters. When chef generates my
desired my.cnf and tries to restart the mysql service, it fails because
/var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile1 already exist and are
incompatible with the new settings.

This is really only a problem for the first run, but I’d really like to find a
better solution. So far, I have been running chef until it fails, manually
removing the logfiles, restarting mysql, and starting another run. What’s a
better way? Is there an idiomatic way to do this with Chef? (I’m new to Chef,
but I have been using Puppet for about a year now).

Any advice would be appreciated.

Thanks!

-Mike

P.S. FWIW, I’m primarily using chef-solo for these projects, so there’s no chef
server available.


#2

On 12/26/2012 09:50 PM, mike.english@atomicobject.com wrote:

Hi,

I’m using the opscode database and MySQL cookbooks, but I’m running into a
problem when using custom settings for innodb “tunables” such as
:innodb_log_file_size. The mysql cookbook installs the mysql-server package
before generating my.cnf. This is reasonable as some package managers might not
react well to config files being in place before packages are installed.
Unfortunately, at least on Ubuntu 12.04, the mysql-server package starts the
mysql service as soon as it is installed. This causes binary log files to be
generated with the default configuration parameters. When chef generates my
desired my.cnf and tries to restart the mysql service, it fails because
/var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile1 already exist and are
incompatible with the new settings.

This is really only a problem for the first run, but I’d really like to find a
better solution. So far, I have been running chef until it fails, manually
removing the logfiles, restarting mysql, and starting another run. What’s a
better way? Is there an idiomatic way to do this with Chef? (I’m new to Chef,
but I have been using Puppet for about a year now).

Yup, it’s a pain :slight_smile:

http://tickets.opscode.com/browse/COOK-2100

I added a few suggestions for how to “fix” this issue on the ticket
above, but would welcome more suggestions!

One thing that might be possible (solution #2 in the ticket above) would
be to have the Chef recipe somehow check to see if the ib_logfileX files
are the exact size of a default/no-data-other-than-system-tables logs
and delete (or rename) them in that case, then restart the service after
the new my.cnf is written?

All the best,
-jay