mysql slave : 127.0.0.1 port: 3306
mysql master : 47.104.27.47 port: 3306
amoeba proxy : 127.0.0.1 port:8066
#主从配置的细节参看我的上一篇博客
dbServer.xml
<amoeba:dbServers xmlns:amoeba="http://amoeba.meidusa.com/">
<dbServer name="abstractServer" abstractive="true">
<factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
<property name="manager">${defaultManager}property>
<property name="sendBufferSize">64property>
<property name="receiveBufferSize">128property>
<property name="port">3306property>
<property name="schema">crmproperty>
<property name="user">amoebaproperty>
<property name="password">amoebaproperty>
factoryConfig>
<poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
<property name="maxActive">500property>
<property name="maxIdle">500property>
<property name="minIdle">10property>
<property name="minEvictableIdleTimeMillis">600000property>
<property name="timeBetweenEvictionRunsMillis">600000property>
<property name="testOnBorrow">trueproperty>
<property name="testOnReturn">trueproperty>
<property name="testWhileIdle">trueproperty>
poolConfig>
dbServer>
<dbServer name="master" parent="abstractServer">
<factoryConfig>
<property name="ipAddress">47.104.27.47property>
factoryConfig>
dbServer>
<dbServer name="slave" parent="abstractServer">
<factoryConfig>
<property name="ipAddress">127.0.0.1property>
factoryConfig>
dbServer>
<dbServer name="MultiPool" virtual="true">
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<property name="loadbalance">1property>
<property name="poolNames">master,slaveproperty>
poolConfig>
dbServer>
amoeba:dbServers>
amoeba.xml
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">
<proxy>
<service name="Amoeba for Mysql" class="com.meidusa.amoeba.net.ServerableConnectionManager">
<property name="port">8066property>
<property name="ipAddress">127.0.0.1property>
<property name="manager">${clientConnectioneManager}property>
<property name="connectionFactory">
<bean class="com.meidusa.amoeba.mysql.net.MysqlClientConnectionFactory">
<property name="sendBufferSize">128property>
<property name="receiveBufferSize">64property>
bean>
property>
<property name="authenticator">
<bean class="com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator">
<property name="user">rootproperty>
<property name="password">123456property>
<property name="filter">
<bean class="com.meidusa.amoeba.server.IPAccessController">
<property name="ipFile">${amoeba.home}/conf/access_list.confproperty>
bean>
property>
bean>
property>
service>
<service name="Amoeba Monitor Server" class="com.meidusa.amoeba.monitor.MonitorServer">
<property name="ipAddress">127.0.0.1property>
<property name="daemon">trueproperty>
<property name="manager">${clientConnectioneManager}property>
<property name="connectionFactory">
<bean class="com.meidusa.amoeba.monitor.net.MonitorClientConnectionFactory">bean>
property>
service>
<runtime class="com.meidusa.amoeba.mysql.context.MysqlRuntimeContext">
<property name="readThreadPoolSize">20property>
<property name="clientSideThreadPoolSize">30property>
<property name="serverSideThreadPoolSize">30property>
<property name="statementCacheSize">500property>
<property name="queryTimeout">60property>
runtime>
proxy>
<connectionManagerList>
<connectionManager name="clientConnectioneManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
<property name="subManagerClassName">com.meidusa.amoeba.net.ConnectionManagerproperty>
connectionManager>
<connectionManager name="defaultManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper">
<property name="subManagerClassName">com.meidusa.amoeba.net.AuthingableConnectionManagerproperty>
connectionManager>
connectionManagerList>
<dbServerLoader class="com.meidusa.amoeba.context.DBServerConfigFileLoader">
<property name="configFile">${amoeba.home}/conf/dbServers.xmlproperty>
dbServerLoader>
<queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
<property name="ruleLoader">
<bean class="com.meidusa.amoeba.route.TableRuleFileLoader">
<property name="ruleFile">${amoeba.home}/conf/rule.xmlproperty>
<property name="functionFile">${amoeba.home}/conf/ruleFunctionMap.xmlproperty>
bean>
property>
<property name="sqlFunctionFile">${amoeba.home}/conf/functionMap.xmlproperty>
<property name="LRUMapSize">1500property>
<property name="defaultPool">masterproperty>
<property name="writePool">masterproperty>
<property name="readPool">MultiPoolproperty>
<property name="needParse">trueproperty>
queryRouter>
amoeba:configuration>
mysql -u amoeba -h 127.0.0.1 -P 8066 -p
架构师之路