amoeba下载地址:
amoeba version:amoeba-mysql-binary-2.1.0-RC5.tar.gz
mysql version:5.5.20OS:Oracle Linux Server release 5.7java version: "1.6.0_14"Java(TM) SE Runtime Environment (build 1.6.0_14-b08)Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)amoeba 的安装和配置参考
安装和配置的过程比较简单,在此记录一个使用过程中遇到的问题:[mysql@db01 ]$ mysql -uroot -pmysql -h192.168.0.18 -P8066Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11416420Server version: 5.1.45-mysql-amoeba-proxy-2.1.0-RC5Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> use test;No connection. Trying to reconnect...Connection id: 11416420Current database: *** NONE ***mysql> select * from t1;
ERROR 2006 (HY000): MySQL server has gone awayNo connection. Trying to reconnect...Connection id: 11416420Current database: testERROR 2006 (HY000): MySQL server has gone awayNo connection. Trying to reconnect...Connection id: 11416420Current database: testERROR 2006 (HY000): MySQL server has gone awayamoeba日志中的错误:
2012-03-05 15:10:21,028 INFO net.ServerableConnectionManager - Amoeba Monitor Server listening on /192.168.0.18:8634.java.util.NoSuchElementException: Could not create a validated object, cause: ValidateObject failed at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1191) at com.meidusa.amoeba.net.poolable.GenericObjectPool.borrowObject(GenericObjectPool.java:381) at com.meidusa.amoeba.mysql.handler.CommandMessageHandler.startSession(CommandMessageHandler.java:629) at com.meidusa.amoeba.mysql.handler.MySqlCommandDispatcher.handleMessage(MySqlCommandDispatcher.java:123) at com.meidusa.amoeba.mysql.net.MysqlClientConnection$2.run(MysqlClientConnection.java:291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) 查了一些资料,修改了以下三个参数,重启后依然没起作用。 mysql>show variables like 'connect_timeout';mysql>show variables like 'net_read_timeout';mysql>show variables like 'max_allowed_packet';仔细检查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>