MySQL problems with NConf when upgrading OMD from 0.48 to 0.50
September 28, 2011 1 Comment
Recently I updated OMD to the new version 0.50 (Released 09/23/2011). While upgrading OMD was done smoothly within 5 minutes, I ran into problems on migrating NConf to the new OMD Version.
In my current configuration NConf runs in a subdirectory of the check_mk website within the OMD webserver instance. NConf stores it´s data in a local database, instead of using the MySQL server delivered with ODM. Actually, I never knew that ODM is shipped with a MySQL server – even though it makes sense, since NDO needs to have a database when used. When upgrading OMD from version 0.48 to 0.50 I did the following:
1) Made a backup of the NConf folder.
2) Installed the newest ODM.rpm.
3) Upgraded my site to version 0.50. (omd update <sitename>)
4) Copied the old NConf folder in the same directory as under OMD 0.48.
5) Restarted OMD.
After the upgrade NConf experienced problems connecting to the local database server. Because I wasn´t able to find a short time solution I decided to install NConf from scratch, meaning a lot of work with dumping the database etc. Finally I found out, that OMD 0.50 includes a bugfix, which is the reason why it wasn´t working.
The bugfix:
The bugfix is basically a different definition of a runtime variable (correct me if I’m wrong) in the file /omd/sites/SITENAME/etc/apache/php-wrapper. Here you can see the important part of the file:
exec /usr/bin/php-cgi \ -d session.save_path=/omd/sites/SITENAME/tmp/php/session \ -d upload_tmp_dir=/omd/sites/SITENAME/tmp/php/upload \ -d soap.wsdl_cache_dir=/omd/sites/SITENAME/tmp/php/wsdl-cache \ -d safe_mode='Off' \ -d mysql.default_socket=/var/lib/mysql/mysql.sock
The changed part is the last line, which is defining the default path of the MySQL socket for php/cgi access. In version 0.48 it was pointing to /var/lib/mysql/mysql.sock – this is the standard path on SuSe Linux Enterprise 11 when running a local MySQL server.
However, as mentioned before, there is an integrated MySQL server in OMD. This server uses a path within the OMD site structure for it´s socket (/omd/sites/SITENAME/tmp/run/mysqld/mysql.sock). So correctly the programmer changed the path to that direction in version 0.50.
Result of that change is that NConf – if it´s running under the OMD webserver instance – gets a different MySQL socket address and doesn´t work with the local installed database. Technically it´s looking for the socket of the OMD built-in server, and obviously can´t connect since it´s not started.
Sidenote: You can enable the OMD MySQL server with the following command: omd start <sitename> mysql or by editing the line CONFIG_MYSQL=’off’ in /omd/sites/SITENAME/etc/omd/site.conf to CONFIG_MYSQL=’on’.
When I was investigating the database problem I tried to get NConf working with the built-in database. My experience is that this doesn´t work out of the box. You definitely have to activate InnoDB support manually by editing the my.cnf in the siteuser directory. After that I was still experiencing problems with deleted hosts still appearing – probably there is a problem in deleting associated data. I stopped investigating this problem, because running NConf on an external database seems to bring a major advantage to me: I don´t have to take care of the database when updating OMD.