飞鸿无痕 发表于 2010-10-27 16:03

回复 20# sjehzy

我明白了,应该是版本的问题,我一会我的版本放上来,把连接也该下!
直接下载吧!
http://blogimg.chinaunix.net/blog/upfile2/101027160252.zip

yingtank 发表于 2010-10-27 16:37

Amoeba我觉得,现在不成熟。

飞鸿无痕 发表于 2010-10-27 16:40

回复 22# yingtank


    不断的发现bug并不断的修复就会越来越成熟!

sjehzy 发表于 2010-10-27 17:00

本帖最后由 sjehzy 于 2010-10-27 17:04 编辑

我用最新上传的wget http://blogimg.chinaunix.net/blog/upfile2/101027160252.zip还是不行。。。
我的jkd用的是jdk-6u22-linux-i586.rpm
我的系统OS是:
CentOS release 5.3 (Final)

现在一运行就报:
# /usr/local/amoeba/bin/amoeba &
5008
# log4j:WARN log4j config load completed from file:/usr/local/amoeba/conf/log4j.xml
Exception in thread "main" com.meidusa.amoeba.config.ConfigurationException: Error loading configuration file /usr/local/amoeba/conf/amoeba.xml
    with nested exception
com.meidusa.amoeba.config.ConfigurationException: Caught exception while loading file /usr/local/amoeba/conf/amoeba.xml
    with nested exception
org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
        at com.meidusa.amoeba.context.ProxyRuntimeContext.loadConfig(ProxyRuntimeContext.java:324)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeContext.java:185)
        at com.meidusa.amoeba.mysql.server.MysqlProxyServer.main(MysqlProxyServer.java:126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
with nested exception com.meidusa.amoeba.config.ConfigurationException: Caught exception while loading file /usr/local/amoeba/conf/amoeba.xml
    with nested exception
org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
com.meidusa.amoeba.config.ConfigurationException: Caught exception while loading file /usr/local/amoeba/conf/amoeba.xml
    with nested exception
org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
        at com.meidusa.amoeba.context.ProxyRuntimeContext.loadConfigurationFile(ProxyRuntimeContext.java:343)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.loadConfig(ProxyRuntimeContext.java:321)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeContext.java:185)
        at com.meidusa.amoeba.mysql.server.MysqlProxyServer.main(MysqlProxyServer.java:126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
with nested exception org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
org.xml.sax.SAXParseException: The string "--" is not permitted within comments.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:774)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1040)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2953)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.loadConfigurationFile(ProxyRuntimeContext.java:339)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.loadConfig(ProxyRuntimeContext.java:321)
        at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeContext.java:185)
        at com.meidusa.amoeba.mysql.server.MysqlProxyServer.main(MysqlProxyServer.java:126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

飞鸿无痕 发表于 2010-10-27 17:08

回复 24# sjehzy

再把你的配置文件贴下!这个应该是你配置文件的问题!

sjehzy 发表于 2010-10-27 17:16

# vi /usr/local/amoeba/conf/amoeba.xml

<?xml version="1.0" encoding="gbk"?>

<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">

      <server>
                <!-- proxy server掳?亩丝?-->
                <property name="port">8066</property>

                <!-- proxy server掳??P -->
                <property name="ipAddress">192.168.18.119</property>
                <!-- proxy server net IO Read thread size -->
                <property name="readThreadPoolSize">100</property>

                <!-- proxy server client process thread size -->
                <property name="clientSideThreadPoolSize">80</property>

                <!-- mysql server data packet process thread size -->
                <property name="serverSideThreadPoolSize">100</property>

                <!-- socket Send and receive BufferSize(unit:K)-->

                <!-- 露?芒证碌?没搂? -->
                <property name="user">root</property>

                <!-- 露?芒证碌??毛->
                <property name="password">justdoit</property>

                <!-- query timeout( default: 60 second , TimeUnit:second) -->
                <property name="queryTimeout">60</property>
      </server>

      <!--
                每赂枚nectionManager露录陆芦?为一赂枚??拢
                manager赂潞?Connection IO露?麓/??录矛
      -->
      <connectionManagerList>

                        <!--
                        default value is avaliable Processors
                        <property name="processors">5</property>
                         -->
                </connectionManager>
      </connectionManagerList>

      <dbServerList>
                <!--
                        一台mysqlServer ?要??一赂枚l拢卢
                        ?鹿没 平碌鹊?ysql?要陆酶adBalance拢卢
                        平台?戮颅?鹿漏一赂枚懈潞?戮霉f碌?bjectPool拢潞com.meidusa.amoeba.mysql.server.MultipleS
                        录??盲???录??virtual="true",赂?ool 虏禄????factoryConfig
                        禄貌约潞写一赂枚ectPool隆拢
                -->
                <dbServer name="server1">

                        <!-- PoolableObjectFactory实?? -->
                        <factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
                              <property name="manager">defaultManager</property>

                              <!-- ?实mysql?戮菘芒驴?-->
                              <property name="port">3306</property>

                              <!-- ?实mysql?戮菘芒 -->
                              <property name="ipAddress">192.168.18.117</property>
                              <property name="schema">test</property>

                              <!-- ??碌?陆mysql碌?没搂? -->
                              <property name="user">root</property>

                              <!-- ??碌?陆mysql碌??毛->

                              <property name="password">justdoit</property>

                        </factoryConfig>

                        <!-- ObjectPool实?? -->
                        <poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
                              <property name="maxActive">200</property>
                              <property name="maxIdle">200</property>
                              <property name="minIdle">10</property>
                              <property name="minEvictableIdleTimeMillis">600000</property>
                              <property name="timeBetweenEvictionRunsMillis">600000</property>
                              <property name="testOnBorrow">true</property>
                              <property name="testWhileIdle">true</property>
                        </poolConfig>
                </dbServer>

                <dbServer name="server2">

                        <!-- PoolableObjectFactory实?? -->
                        <factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
                              <property name="manager">defaultManager</property>

                              <!-- ?实mysql?戮菘芒驴?-->
                              <property name="port">3306</property>

                              <!-- ?实mysql?戮菘芒 -->
                              <property name="ipAddress">192.168.18.118</property>
                              <property name="schema">test</property>

                              <!-- ??碌?陆mysql碌?没搂? -->
                              <property name="user">root</property>

                              <!-- ??碌?陆mysql碌??毛->

                              <property name="password">justdoit</property>

                        </factoryConfig>

                        <!-- ObjectPool实?? -->
                        <poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
                              <property name="maxActive">200</property>
                              <property name="maxIdle">200</property>
                              <property name="minIdle">10</property>
                              <property name="minEvictableIdleTimeMillis">600000</property>
                              <property name="timeBetweenEvictionRunsMillis">600000</property>
                              <property name="testOnBorrow">true</property>
                              <property name="testWhileIdle">true</property>
                        </poolConfig>
                </dbServer>



                <dbServer name="master" virtual="true">
                        <poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
                              <!-- 赂潞?戮霉? 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
                              <property name="loadbalance">1</property>

                              <!-- 虏?毛pool赂潞?戮霉poolName?卤铆露潞潞欧指卯->
                              <property name="poolNames">server1</property>
                        </poolConfig>
                </dbServer>

               <dbServer name="slave" virtual="true">
                        <poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
                              <!-- 赂潞?戮霉? 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
                              <property name="loadbalance">1</property>

                              <!-- 虏?毛pool赂潞?戮霉poolName?卤铆露潞潞欧指卯->
                              <property name="poolNames">server1,server2</property>
                        </poolConfig>
                </dbServer>

      </dbServerList>

      <queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
                <property name="ruleConfig">${amoeba.home}/conf/rule.xml</property>
                <property name="functionConfig">${amoeba.home}/conf/functionMap.xml</property>
                <property name="ruleFunctionConfig">${amoeba.home}/conf/ruleFunctionMap.xml</property>
                <property name="LRUMapSize">1500</property>
                <property name="defaultPool">master</property>
                <property name="writePool">master</property>
                <property name="readPool">slave</property>
                <property name="needParse">true</property>
      </queryRouter>
</amoeba:configuration>

飞鸿无痕 发表于 2010-10-27 17:21

回复 26# sjehzy


    以代码的形式发,很多乱码~!

sjehzy 发表于 2010-10-27 17:29

大哥现在已经正常启动了。。。。
我知道什么原因了。。。
因我amoeba.xml文件里的必须是中文,不能乱码。。。
我现在看了,前面你给我的配置文件中我修改后保存后全部变成的了乱码。。。现在是中文的可以正常了。。。

sjehzy 发表于 2010-10-28 10:34

我早上也试了,好像不行,无法读写分离。。。。
而且我两台数据库,他只能找到我的master 服务器,我的Slave 服务器无法找到。。。

。。。。。

飞鸿无痕 发表于 2010-10-28 10:37

本帖最后由 飞鸿无痕 于 2010-10-28 10:45 编辑

回复 29# sjehzy

你的读写分离那里没生效。看是不是注释掉了,默认是注释掉的!
                <!--
                <property name="writePool">master</property>
                <property name="readPool">slave</property>
                -->
是这样吗???如果是,更改成下面的:
                <property name="writePool">master</property>
                <property name="readPool">slave</property>
去掉注释后,你多查询几次,应该主和从的查询应该是1:1,写操作都会在主上进行!
页: 1 2 [3] 4 5 6
查看完整版本: 【原创】Amoeba搞定mysql主从读写分离