博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away
阅读量:5241 次
发布时间:2019-06-14

本文共 3003 字,大约阅读时间需要 10 分钟。

amoeba下载地址:

amoeba 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 的安装和配置参考

安装和配置的过程比较简单,在此记录一个使用过程中遇到的问题:

[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)
        
查了一些资料,修改了以下三个参数,重启后依然没起作用。
        
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>   

转载于:https://www.cnblogs.com/ylqmf/archive/2012/03/16/2402296.html

你可能感兴趣的文章
python的多行注释
查看>>
连接Oracle需要jar包和javadoc文档的下载
查看>>
UVA 10976 - Fractions Again?!
查看>>
Dreamweaver cc新版本css单行显示
查看>>
【android】安卓的权限提示及版本相关
查看>>
JavaScript可否多线程? 深入理解JavaScript定时机制
查看>>
IOS基础学习
查看>>
PHP 导出 Excell
查看>>
Java基础教程——网络基础知识
查看>>
Kruskal基础最小生成树
查看>>
ubuntu 14.04 安装搜狗拼音输入法
查看>>
浅谈算法和数据结构: 一 栈和队列
查看>>
Java内部类详解
查看>>
【hdu 1429】胜利大逃亡(续)
查看>>
图论-次短路求法
查看>>
What's New for Visual C# 6.0
查看>>
ExtJs学习笔记之ComboBox组件
查看>>
关于收费软件
查看>>
getopt_long
查看>>
TensorFlow MNIST CNN 代码
查看>>