Tuesday, May 17, 2011

Adding port to ports.conf crashes MYSQL

I want to run a VM as a staging server. I need to use non-standard web ports because the standard http port (80) is being used by another VM on the same pc as a full time server.

I am using deprec and capistrano to automate the entire deploy process. This was working fine as long as I did everything over my local 'intranet'. ie I would set the domain to '192.168.1.13' in my deploy.rb file.  I also set up the ssh port on this VM for 3060. This worked. I just had to set the :port option in deploy.rb and everything went fine. After install and deploy, I could point my browser at 192.168.1.13 and everything was working fine.  That's great, but I can't test my payment processing if the server cannot be accessed from the outside world. So, I setup port-forwarding on port 3050 on the router to the VM's internal IP address (192.168.1.13) and added the port to my /etc/apache2/ports.conf
Listen 80
Listen 3050
I would then restart the VM and after reloading the browse I get the rails error message.  I found this error in my rails production log:
Mysql2::Error (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)):
Some good tips here

http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html


helped me realize that the mysql server was not running.


I then ran:
sudo mysqld --verbose
which told me that there was an unknown option:
skip-bdb
that was causing the shutdown.  I looked in my.cnf and sure enough this option was set (it is something to do with berkly data base). I commented it out and then tried to restart mysql, which worked. 


Connecting back to 192.68.1.13 on the browser now gets a proper response.


I have no idea why adding the "Listen 3050" bit to '/etc/apache2/ports.conf' causes mysql to no longer recognize the 'skip-bdb' comment, but after 4 days of playing around with this, at least I have made some progress!


I think I will post this on server fault to see if I can get a better understanding of the root cause.


Another issue, which I'm still dealing with is that if I add the port to the apache-vhost file that deprec will copy to the server for me, it also prevents the mysql db install from going forward, thus wrecking the whole install. I guess the problem is related.


Edit:  I found this explanation and fix:
https://github.com/kjohnston/deprec/commit/113682ba08451ac9f09c9de8bb3c566723c480d3#commitcomment-388401

No comments:

Post a Comment