IT星球论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 237|回复: 0

amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away

[复制链接]

2000

主题

1

好友

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

优秀会员 助人为乐 辛勤工作 技术精英 多才多艺 优秀班竹 灌水天才 星球管理 宣传大使 灌水之王 财富勋章 版主勋章 动漫勋章 勤奋会员 论坛精英 PS高手 心 8 闪游皮肤 双鱼座 8★8➹ 志愿者 乖

发表于 2016-2-18 16:42:40 |显示全部楼层
amoeba连接MySQL--ERROR 2006 (HY000): MySQL Server has gone away
amoeba下载地址:http://sourceforge.net/projects/amoeba/filesamoeba version:amoeba-mysql-binary-2.1.0-RC5.tar.gz
mysql version:5.5.20
os:Oracle linux Server release 5.7
Java 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 的安装和配置参考http://docs.hexnova.com/amoeba/index.html
安装和配置的过程比较简单,在此记录一个使用过程中遇到的问题:
[mysql@db01 ]$ mysql -uroot -pmysql -h192.168.0.18 -P8066
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11416420
Server version: 5.1.45-mysql-amoeba-proxy-2.1.0-RC5
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use test;
No connection. Trying to reconnect...
Connection id:    11416420
Current database: *** NONE ***
mysql> select * from t1;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    11416420
Current database: test
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    11416420
Current database: test
ERROR 2006 (HY000): MySQL server has gone away
amoeba日志中的错误:
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)
        
查了一些资料,修改了以下三个参数,重启后依然没起作用。
http://dev.mysql.com/doc/refman/5.5/en/error-lost-connection.html      
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>        
amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away

该会员没有填写今日想说内容.
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

回顶部