zoukankan      html  css  js  c++  java
  • amoeba连接mysqlERROR 2006 (HY000): MySQL server has gone away

    amoeba下载地址:http://sourceforge.net/projects/amoeba/files

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

  • 相关阅读:
    Django的ORM
    Django model中设置多个字段联合唯一约束(多对多)
    Django 基本命令
    Django中使用Microsoft SQL SERVER
    pycharm django 再建一个app
    转载:Emmet使用手册
    线程示例(1)
    用socketserver实现简单的FTP
    python习题1-最大的不可支付邮资问题
    【实例:利用Django管理后台管理IP地址】(六)django_apscheduler实现定时检测IP使用情况
  • 原文地址:https://www.cnblogs.com/ylqmf/p/2402296.html
Copyright © 2011-2022 走看看