Hi Chan,
first of all sorry to hear that you had no success with the maxscale google group. Looking back at the archive of the group I can not see your post, I suspect somehow it got blocked before getting to the group. I will CC this response to the google group so that it appears there as well.
As for the problem you are having, I can not see an immediate problem with your setup, from the MaxScale side it all looks right. I suspect the problem is related to the way authentication works with host names.
MySQL uses a triple for the authentication that includes the source of the connection. When MaxScale is put between the client and the MySQL server that MySQL server will see all connections as if they originate from MaxScale rather than the host the client application is running on. So if you have three machines A, B and C, with the client application running on machine A, MaxScale on B and the MySQL server on C and you have a user X that you wish to authenticate. You would need to either have the host part wild carded or have entries for user X for both hosts A and B.
MaxScale will lookup X@A, as this is the user that connects to MaxScale and the MySQL server will lookup X@B as it only sees the connection from MaxScale to MySQL and not the real client application.
The other slight complication in the story is that the wildcard % does not match the localhost entry, so if you want to connect from the localhost or 127.0.0.1 you need to have an explicit X@localhost entry in the MySQL user table.
It would be interesting to see what MaxScale has in the way of database users. You can do this by using the relent interface to connect to MaxScale, with telnet localhost <port> and running the show dbusers command with the name of your service, e.g. show dbusers "RW Split Router"
I hope this helps
Mark
On 25 Jun 2014, at 11:08, 성동찬_Chan <
ch...@kakao.com> wrote:
> Hi~!
>
> My name is Chan working as a DBA in Kakao.
> Now, I’m doing functional test about MaxScale, and I have some questions.
> (In fact I asked this question on google group)
>
> I asked to KS Kim in OSS Korea, he introduced you guys :)
>
> I’m testing with below scenario, but I wonder any problem with this?
> (It doesn’t work well)
>
> ------------------------------------------------------------------------------------------------------------
> — I config MaxSale like this. - 1 master, 2 slaves
> ------------------------------------------------------------------------------------------------------------
>
> ######################
> ## MaxScale
> ######################
> [MySQL Monitor]
> type=monitor
> module=mysqlmon
> servers=server1,server2,server3
> user=maxmon
> passwd=maxpwd
>
> [RW Split Router]
> type=service
> router=readwritesplit
> servers=server1,server2,server3
> user=maxmon
> passwd=maxpwd
>
> [RW Split Listener]
> type=listener
> service=RW Split Router
> protocol=MySQLClient
> port=3306
> socket=/tmp/rwsplit.sock
>
> [server1]
> type=server
> address=192.168.0.10
> port=3306
> protocol=MySQLBackend
>
> [server2]
> type=server
> address=192.168.0.11
> port=3306
> protocol=MySQLBackend
>
> [server3]
> type=server
> address=192.168.0.12
> port=3306
> protocol=MySQLBackend
>
>
> And I create users like this.
>
> ######################
> ## Database Servers
> ######################
> GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'maxmon'@'%' IDENTIFIED BY 'maxpwd'
> GRANT SELECT ON `mysql`.`user` TO 'maxmon'@'%';
>
> GRANT USAGE ON *.* TO 'test'@'%' IDENTIFIED BY 'test';
> GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'%’;
>
>
> ------------------------------------------------------------------------------------------------------------
> — Start MaxScale.
> — This is the messages.
> ------------------------------------------------------------------------------------------------------------
>
>
> 2014 06/13 19:51:06 Home directory : /usr/local/MaxScale
> 2014 06/13 19:51:06 Data directory : /usr/local/MaxScale/data3582
> 2014 06/13 19:51:06 Configuration file : /usr/local/MaxScale/etc/MaxScale.cnf
> 2014 06/13 19:51:07 Initialise debug CLI router module V1.1.1.
> 2014 06/13 19:51:07 Loaded module debugcli: V1.1.1 from /usr/local/MaxScale/modules/libdebugcli.so
> 2014 06/13 19:51:07 Initialise readconnroute router module V1.0.2.
> 2014 06/13 19:51:07 Loaded module readconnroute: V1.0.2 from /usr/local/MaxScale/modules/libreadconnroute.so
> 2014 06/13 19:51:07 Initializing statemend-based read/write split router module.
> 2014 06/13 19:51:07 Loaded module readwritesplit: V1.0.2 from /usr/local/MaxScale/modules/libreadwritesplit.so
> 2014 06/13 19:51:07 Initialise the MySQL Monitor module V1.2.0.
> 2014 06/13 19:51:07 Loaded module mysqlmon: V1.2.0 from /usr/local/MaxScale/modules/libmysqlmon.so
> 2014 06/13 19:51:07 SkySQL MaxScale 0.7.0 (C) SkySQL Ab 2013,2014
> 2014 06/13 19:51:07 MaxScale is running in process 3582
> 2014 06/13 19:51:07 Loaded 11 MySQL Users.
> 2014 06/13 19:51:07 Loaded module MySQLClient: V1.0.0 from /usr/local/MaxScale/modules/libMySQLClient.so
> 2014 06/13 19:51:07 Loaded 11 MySQL Users.
> 2014 06/13 19:51:07 Backend server
192.168.0.10:3306 state : RUNNING MASTER
> 2014 06/13 19:51:07 Backend server
192.168.0.11:3306 state : RUNNING SLAVE
> 2014 06/13 19:51:07 Backend server
192.168.0.12:3306 state : RUNNING SLAVE
> 2014 06/13 19:51:07 Loaded 11 MySQL Users.
> 2014 06/13 19:51:07 Loaded 11 MySQL Users.
> 2014 06/13 19:51:07 Loaded module telnetd: V1.0.1 from /usr/local/MaxScale/modules/libtelnetd.so
> 2014 06/13 19:51:07 MaxScale started with 1 server threads.
> 2014 06/13 19:51:07 Started MaxScale log flusher.
>
>
> ------------------------------------------------------------------------------------------------------------
> — I checked “netstat”, I can see “ESTABLISHED”.
> ------------------------------------------------------------------------------------------------------------
> tcp 0 0
0.0.0.0:3306 0.0.0.0:* LISTEN
> tcp 0 0
192.168.0.20:41268 192.168.0.10:3306 ESTABLISHED
> tcp 0 0
192.168.0.20:38929 192.168.0.11:3306 ESTABLISHED
> tcp 0 0
192.168.0.20:60517 192.168.0.12:3306 ESTABLISHED
>
>
> ------------------------------------------------------------------------------------------------------------
> — Finally I tried to connect to one MaxScale, but connection refused;
> ------------------------------------------------------------------------------------------------------------
> $ mysql -utest -ptest -h 127.0.0.1 -P 3306
> ERROR 1045 (2800): Authorization failed
>
>
> ------------------------------------------------------------------------------------------------------------
> — Error log says like this, as I try to connect with “test” user.
> ------------------------------------------------------------------------------------------------------------
> 2014 06/16 10:35:23 Error : getaddrinfo failed for [
192.168.0.12/255.255.254.252] due [Name or service not known]
> 2014 06/16 10:35:23 140364711581664 [getUsers()] setipaddress failed: user
m...@192.168.0.12/255.255.254.252 not added
> 2014 06/16 10:35:23 140364711581664 [mysql_users_add()] Failed adding user
ro...@127.0.0.1(127.0.0.1)
> 2014 06/16 10:35:23 140364711581664 [mysql_users_add()] Failed adding user
ro...@127.0.0.1(127.0.0.1)
> 2014 06/16 10:35:23 140364711581664 [mysql_users_add()] Failed adding user
m...@127.0.0.1(127.0.0.1)
>
>
>
> I have no idea why I can’t to connect through MaxScale.
> I waited the reply on Google Groups, but it still opened.. :(
>
> Thanks.
> Chan.