originally I had /etc/hosts on both servers. Database server, and application server. Database server only has mysql, and nothing else. However, application server has mysql but I am not using it.
on app server /etc/hosts
Code:
127.0.0.1 localhost
157.166.225.26 appserver.example.com appserver
192.168.1.3 mysql.example.com mysql
192.168.1.172 appserver.example.com appserver
then on database server /etc/hosts
Code:
127.0.0.1 localhost
157.166.101.4 mysql.example.com mysql
192.168.1.3 mysql.example.com mysql
192.168.1.172 appserver.example.com appserver
then on database server /etc/mysql/my.cnf
Code:
bind-address = mysql
then, on mysql I had
Code:
user@mysql:~$ mysql -u root -p
mysql> SELECT User, Host, Password FROM mysql.user;
+------------------+-----------+-------------------------------------------+
| User | Host | Password |
+------------------+-----------+-------------------------------------------+
| root | localhost | *cccccccccccccccccccccccccccccccccccccccc |
| debian-sys-maint | localhost | *cccccccccccccccccccccccccccccccccccccccc |
| appuser | appserver | *cccccccccccccccccccccccccccccccccccccccc |
+------------------+-----------+-------------------------------------------+
I couldnt make it work. I think maybe my real issue was database access.
on the appserver, on the config file I put
I even tried
Code:
db_host: 'mysql.example.com'
Since, I couldnt make it work. I changed the host to lan IP
/etc/mysql/my.cnf
Code:
bind-address = 192.168.1.3
Code:
+------------------+-----------+-------------------------------------------+
| appuser | 192.168.1.172 | *2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB |
+------------------+-----------+-------------------------------------------+
Maybe I should've done
Code:
+------------------+-----------+---------------------------------------------------+
| appuser | localhost | *cccccccccccccccccccccccccccccccccccccccc |
+------------------+-----------+---------------------------------------------------+
then give proper permissions.
Somehow, I figured the application server wouldnt communicate with database server. I figured when you do localhost, it only looks for internal communication, and wont step out to lan.
I was surprised on the pull internally, from database server to application server. The ratio is crazy. It pulls around 5mb to 2mb from database server, and pumps around 1mb outgoing to public ip.
So, I am going to try
on the database server
/etc/mysql/my.cnf
Code:
bind-address = mysql
then mysql
Code:
+------------------+-----------+---------------------------------------------------+
| appuser | localhost | *cccccccccccccccccccccccccccccccccccccccc |
+------------------+-----------+---------------------------------------------------+
then, I will try to connect to database server from the appserver.
mysql -u user -h localhost -p databasename
and on the appserver on the config file I put
db_host: 'localhost'
does that look ok?
Bookmarks