Hey guys,
I'm having a bit of trouble connecting to a mysql database. And I'd love a
little help with this problem!
I have my wiki site spread out amongst three t2 micros on the AWS free
tier. Free of fee is the way to go! ;)
The site is load balanced behind two varnish nodes which are themselves
load balanced behind two HA/Proxy nodes.
The mysql database was housed on one of the nodes that all three web nodes
could access. That worked absolutely fine!! But the db would have the
annoying tendency to crash every once in a while.
So I came up with the idea to make the database HA as well. So I fired up
some more free tier nodes. I gave two nodes to haproxy, two more nodes for
master/master mysql. I then imported my mediawiki database to both mysql
nodes.
Whenever I try to use one of the new databases I setup, the site goes down
with the message:
"Sorry! This site is experiencing technical difficulties.
Try waiting a few minutes and reloading.
(Cannot access the database)"
However I found out that I could access the database from each of the web
nodes on the mysql command line. I can access the both the database VIP
that's load balanced behind keepalived/HAproxy. Or either of the two
databases sitting behind the VIP individually.
For example from the 1st web host to the database VIP using the database
credentials I have in LocalSettings.php:
[root@ops:~] #mysql -uadmin -p -h
db.example.com -e "show databases"
Enter password:
+--------------------+
| Database |
+--------------------+
| certs |
| information_schema |
| jfwiki |
| mysql |
| performance_schema |
+--------------------+
Again from the first web host I can do the same to both database nodes
individually:
[root@ops:~] #mysql -uadmin -p -h
db1.example.com -e "show databases"
Enter password:
+--------------------+
| Database |
+--------------------+
| information_schema |
| jfwiki |
| mysql |
| performance_schema |
+--------------------+
[root@ops:~] #mysql -uadmin -p -h
db2.example.com -e "show databases"
Enter password:
+--------------------+
| Database |
+--------------------+
| certs |
| information_schema |
| jfwiki |
| mysql |
| performance_schema |
+--------------------+
I've also verified that I can use the wiki database with the account
information in LocalSettings.php.
So what I would like to know is, if I can contact and use the wiki database
from each host to each database using the command line, VIP and all, why
can't Mediawiki work with it? I would think that mediawiki could use any
database you can contact and use on the command line. I've also disabled
SELinux on all hosts just to be sure that wasn't causing an issue.
I'd be very glad to get any suggestions on how to fix this!!
Thanks,
TIm
How can I troubleshoot this?
--
GPG me!!
gpg --keyserver
pool.sks-keyservers.net --recv-keys F186197B