Monitor MySQL connection

Having problems with the panel? Have questions? Post here!
Post Reply
Hazz
Posts: 104
Joined: Fri Aug 29, 2008 1:53 pm
Contact:

Monitor MySQL connection

Post by Hazz »

At the moment I've currently got the monitor setup on Ubuntu as a service, meaning the monitor starts up as soon as the server starts up.

Unfortunately we had a power outage at the data centre we are hosted in and after the power came back on the server booted up. However none of the game servers came back online by themselves. After looking at the ugccmon.log, it seems the monitor couldn't connect to the MySQL database (meaning it didn't start):

Code: Select all

03/03/2014 14:31:37	UGCCMon Started (1.68) | Dbtype=mysql | Interval=30000ms
03/03/2014 14:31:40	OS:  Linux
03/03/2014 14:31:43	Using config file: ugccmon.cfg
03/03/2014 14:31:46	Running as user:  root
03/03/2014 14:33:13	Unable to connect to any of the specified MySQL hosts.
  at MySql.Data.MySqlClient.NativeDriver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Open () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection () [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver () [0x00000] in <filename unknown>:0
A few hours later when I noticed this, the monitor still didn't start up. I'm guessing it attempts to connect just once to the database, is it possible to make it keep retrying? The MySQL DB is on another host. Obviously a power outage is a rare occurrence but I do like to make all our systems automatic if there is a problem.
Masher
Site Admin
Posts: 3612
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

Re: Monitor MySQL connection

Post by Masher »

Yeah, I'll see what I can do.
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
patriot-games
Posts: 24
Joined: Wed Jun 13, 2012 3:54 pm

Re: Monitor MySQL connection

Post by patriot-games »

I too have mono setup as a service on Debian 7.3 and after an an accidental power-down of the physical server, have exactly the same error in ugccmon.log and the monitor can no longer connect to the mysql db.

PG
www.patriot-games.net
High Performance Game Servers
patriot-games
Posts: 24
Joined: Wed Jun 13, 2012 3:54 pm

Solved: Re: Monitor MySQL connection

Post by patriot-games »

In my case, I found that the iptables rule on my web server allowing a connection from my game server to the ugcc mysql db had to be recreated.

Code: Select all

iptables -A INPUT -m tcp -p tcp --src xxx.xxx.xx.xx --dport 3306 -j ACCEPT
Maybe Fail2ban overwrote the iptables accept rule on the web server when the game server unexpectedly powered down with an active tcp connection to the remote mysql db...I don't know. What I do know is that I did'nt change anything on the web server iptables or fail2ban rules and everything was working fine, until the game server accidentally powered down.

Don't know if this is helpful or not but thought it important to relay the solution for my particular case.

regards,

PG
www.patriot-games.net
High Performance Game Servers
Masher
Site Admin
Posts: 3612
Joined: Thu Apr 20, 2006 2:54 pm
Location: America's Heartland
Contact:

Re: Monitor MySQL connection

Post by Masher »

For the next update the monitor will keep trying to connect to the database until it is successful. Thanks for the suggestion.
Masher
-----------
Please do not PM me unless asked to! We are a small company. If you have an issue or question it would be best to post it in the forums where it can help others in the future.

NEW Join our Discord!
Post Reply