Difference between revisions of "Troubleshoot MySQL"

From FOG Project
Jump to: navigation, search
m (Added example for importing and exporting the DB on the FOG server.)
Line 64: Line 64:
  
 
-----------------------------------------------------------------------------
 
-----------------------------------------------------------------------------
 +
'''Ubuntu 13.04 14.04 15.04 and higher with FOG 1.2.0'''
  
  
 +
Ubuntu has issues with mysql. Particularly anything 12 and greater seems to be hugely a problem from my experience.
 +
 +
When this happens, fog will run normally after the server boots for 10 or 15 minutes and then mysql crashes, which forces a "Update the Database Schema" message when trying to use fog, and the schema updater does not fix the problem.
 +
 +
To test if this is the issue, simply try to restart MySQL (please note this is only temporary) and see if the problem goes away:
 +
 +
<pre>sudo service mysql restart</pre>
 +
 +
A fix has been reported with this issue.
 +
Here are the instructions to fix it:
 +
 +
Open this file:
 +
 +
<pre>sudo vi /var/www/fog/lib/fog/Config.class.php</pre>
 +
 +
Notate both the host, username & password and then close the above file.
 +
Open this file:
 +
 +
<pre>sudo vi /opt/fog/.fogsettings</pre>
 +
 +
Fill in the following portions:
 +
 +
*snmysqluser="{root}"
 +
 +
*snmysqlpass="{PasswordIfYouHaveOne}"
 +
 +
*snmysqlhost="{localhost}"
 +
 +
Reset the mySQL database password to be what is in the config files.
 +
 +
Then run this:
  
Ubuntu has issues with mysql. Particularly anything 12 and greater seems to be hugely a problem from my experience.
+
<pre>sudo dpkg-reconfigure mysql-server-5.5</pre>
  
The quickest way to see if things are running would be:
+
Enter in the new password when prompted.
sudo service mysql status
 
  
If it’s dead, you’ll restart it with:
 
sudo service mysql restart
 
  
Also, if it’s dead, you’ll need to restart the fog services (after mysql is restarted):
+
If you still have issues re-run the installer.
  
sudo service FOGMulticastManager restart
 
sudo service FOGScheduler restart
 
sudo service FOGImageReplicator restart
 
If you’re on SVN you’ll also probably need to add:
 
sudo service FOGSnapinReplicator restart
 
  
To help prevent this in the future, follow these steps as needed/particularly the rc.local steps.
 
https://github.com/fogproject/fogproject/issues/1
 
  
  

Revision as of 02:28, 5 August 2015

Page is currently under construction.


Below, you may find notes and gibberish that I'm collecting to help make an article.


Manually export / import Fog database.

Export:

mysqldump -u USERNAME -p PASSWORD -h HOSTNAME fog > fogDB.sql

Import:

mysql -u USERNAME -p PASSWORD -h HOSTNAME fog < fogDB.sql


Example using root and 13375p3@k as the password on the local host.

#Exporting my DB locally on my FOG server...
mysql -u root -p 13375p3@k fog > fog_backup.sql
#
#Here is an import example...
mysql -u root -p 13375p3@k fog < fog_backup.sql
#
#Here is an example of exporting a remote DB to your current directory, where x.x.x.x would be replaced by the IP of the remote system...
mysql -u root -p 13375p3@k -h x.x.x.x fog > fog_backup.sql



enable remote mysql access to a linux user account:

mysql
GRANT ALL PRIVILEGES ON *.* TO 'LocalLinuxUserNameHere'@'%' IDENTIFIED BY 'UserPasswordHere' WITH GRANT OPTION;

Some systems have a bind address set. You can disable that in the my.cnf file.

Search for that file with this:

find / | grep my.cnf

Comment out these lines with a hash tag #

#skip-networking
#bind-address = 127.0.0.1




If you're imaging 50 to 200 computers simultaneously, you'll find the below settings helpful.

mysql
SET GLOBAL max_connections = 200;
flush hosts;


and in:

/etc/my.cnf

max_connections = 200

then restart mysql


Ubuntu 13.04 14.04 15.04 and higher with FOG 1.2.0


Ubuntu has issues with mysql. Particularly anything 12 and greater seems to be hugely a problem from my experience.

When this happens, fog will run normally after the server boots for 10 or 15 minutes and then mysql crashes, which forces a "Update the Database Schema" message when trying to use fog, and the schema updater does not fix the problem.

To test if this is the issue, simply try to restart MySQL (please note this is only temporary) and see if the problem goes away:

sudo service mysql restart

A fix has been reported with this issue. Here are the instructions to fix it:

Open this file:

sudo vi /var/www/fog/lib/fog/Config.class.php

Notate both the host, username & password and then close the above file. Open this file:

sudo vi /opt/fog/.fogsettings

Fill in the following portions:

  • snmysqluser="{root}"
  • snmysqlpass="{PasswordIfYouHaveOne}"
  • snmysqlhost="{localhost}"

Reset the mySQL database password to be what is in the config files.

Then run this:

sudo dpkg-reconfigure mysql-server-5.5

Enter in the new password when prompted.


If you still have issues re-run the installer.





For issues with Multicast, the DB tables associated with that could be dirty. You'll know this is the case if clients just sit at the partclone screen doing nothing.


TRUNCATE TABLE multicastSessions; 
TRUNCATE TABLE multicastSessionsAssoc; 
DELETE FROM tasks WHERE taskTypeId=8;

Via MySQL cli or phpmyadmin (easy to install)