amoeba 的安装和配置参考http://docs.hexnova.com/amoeba/index.html
安装和配置的过程比较简单,在此记录一个使用过程中遇到的问题:
[mysql@db01 ]$ mysql -h127.0.0.1-uroot -pmysql -P8066
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 969886252
Server version: 5.1.45-mysql-amoeba-proxy-2.2.0
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 969886252
Current database: *** NONE ***
ERROR 2013 (HY000): Lost connection to MySQL server during query
查看amoeba日志/usr/local/amoeba/logs/net.log中的错误:
2012-12-07 18:25:36,900 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=1076825585
2012-12-07 18:25:36,929 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!
2012-12-07 18:25:36,934 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=1002500837
2012-12-07 18:25:39,905 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!
2012-12-07 18:25:39,908 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=282106579
2012-12-07 18:25:39,938 INFO net.BackendConnectionFactory - open socket channel to server[127.0.0.1:3306] success!
2012-12-07 18:25:39,943 ERROR net.MysqlServerConnection - handShake with /127.0.0.1:3306 error:Access denied for user (using password: NO),hashCode=127368091
仔细检查dbServers.xml配置后发现factoryConfig中
<property name="password">password</property>
默认是被注释掉的,注释取消后正常。
看来这是作者搞的一个乌龙呀,可害苦了我,耽误了好大一会功夫。
修改内容见下:
<factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
<property name="manager">${defaultManager}</property>
<property name="sendBufferSize">64</property>
<property name="receiveBufferSize">128</property>
<!-- mysql port -->
<property name="port">3306</property>
<!-- mysql schema -->
<property name="schema">test</property>
<!-- mysql user -->
<property name="user">root</property>
<!-- mysql password
<property name="password">password</property>
-->
</factoryConfig>
转载于:https://blog.51cto.com/simpledevops/1082001