1.主从同步,不详细说
2.下载amoeba包amoeba-mysql-0.19.tar.gz
3.解压文件 tar -zxvf amoeba-mysql-0.19.tar.gz
4.配置JAVA_HOME
5.修改配置文件,在conf下,相应修改amoeba.xml中内容
<server>
<!-- proxy server绑定的端口 -->
<property name="port">8066</property>
<!-- proxy server绑定的IP -->
<!--
<property name="ipAddress">127.0.0.1</property>
-->
<!-- proxy server net IO Read thread size -->
<property name="readThreadPoolSize">20</property>
<!-- proxy server client process thread size -->
<property name="clientSideThreadPoolSize">30</property>
<!-- mysql server data packet process thread size -->
<property name="serverSideThreadPoolSize">30</property>
<!-- socket Send and receive BufferSize(unit:K) -->
<property name="netBufferSize">128</property>
<!-- Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). -->
<property name="tcpNoDelay">true</property>
<!-- 对外验证的用户名 -->
<property name="user">root</property>
<!-- 对外验证的密码 -->
<property name="password">root</property>
</server>
<dbServerList>
<dbServer name="server1">
<!-- PoolableObjectFactory实现类 -->
<factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
<property name="manager">defaultManager</property>
<!-- 真实mysql数据库端口 -->
<property name="port">3306</property>
<!-- 真实mysql数据库IP -->
<property name="ipAddress">10.20.147.110</property>
<property name="schema">amoeba_study</property>
<!-- 用于登陆mysql的用户名 -->
<property name="user">root</property>
<!-- 用于登陆mysql的密码 -->
<property name="password"></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数据库IP -->
<property name="ipAddress">10.20.147.111</property>
<property name="schema">amoeba_study</property>
<!-- 用于登陆mysql的用户名 -->
<property name="user">root</property>
<!-- 用于登陆mysql的密码 -->
<property name="password"></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>
</dbServerList>
<queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
<property name="LRUMapSize">1500</property>
<property name="defaultPool">server1</property>
<property name="writePool">server1</property>
<property name="readPool">server2</property>
<property name="needParse">true</property>
</queryRouter>
6.启动amoeba 进入amoeba的bin目录下./amoeba,如出现以下则说明启动成功
log4j:WARN log4j config load completed from file:/root/amoeba/conf/log4j.xml
log4j:WARN ip access config load completed from file:/root/amoeba/conf/access_list.conf
2016-04-16 08:30:43,096 INFO net.ServerableConnectionManager - Server listening on 0.0.0.0/0.0.0.0:8066.
7测试连接:
根据配置文件暴漏的用户名和密码登录mysql,mysql -h代理IP -u代理用户名 -p代理密码 -P8066,如出现以下测试说明成功
2016-04-16 08:43:10,583 INFO net.ConnectionManager - Connection Authenticate success [ conn=com.meidusa.amoeba.mysql.net.MysqlClientConnection@Socket[addr=/192.168.80.113,port=38999,localport=8066], hashcode=29112607].
注意:1.防火墙必须关闭,否则连接不上
2.实际数据库的账号必须允许远程登录
2.下载amoeba包amoeba-mysql-0.19.tar.gz
3.解压文件 tar -zxvf amoeba-mysql-0.19.tar.gz
4.配置JAVA_HOME
5.修改配置文件,在conf下,相应修改amoeba.xml中内容
<server>
<!-- proxy server绑定的端口 -->
<property name="port">8066</property>
<!-- proxy server绑定的IP -->
<!--
<property name="ipAddress">127.0.0.1</property>
-->
<!-- proxy server net IO Read thread size -->
<property name="readThreadPoolSize">20</property>
<!-- proxy server client process thread size -->
<property name="clientSideThreadPoolSize">30</property>
<!-- mysql server data packet process thread size -->
<property name="serverSideThreadPoolSize">30</property>
<!-- socket Send and receive BufferSize(unit:K) -->
<property name="netBufferSize">128</property>
<!-- Enable/disable TCP_NODELAY (disable/enable Nagle's algorithm). -->
<property name="tcpNoDelay">true</property>
<!-- 对外验证的用户名 -->
<property name="user">root</property>
<!-- 对外验证的密码 -->
<property name="password">root</property>
</server>
<dbServerList>
<dbServer name="server1">
<!-- PoolableObjectFactory实现类 -->
<factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
<property name="manager">defaultManager</property>
<!-- 真实mysql数据库端口 -->
<property name="port">3306</property>
<!-- 真实mysql数据库IP -->
<property name="ipAddress">10.20.147.110</property>
<property name="schema">amoeba_study</property>
<!-- 用于登陆mysql的用户名 -->
<property name="user">root</property>
<!-- 用于登陆mysql的密码 -->
<property name="password"></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数据库IP -->
<property name="ipAddress">10.20.147.111</property>
<property name="schema">amoeba_study</property>
<!-- 用于登陆mysql的用户名 -->
<property name="user">root</property>
<!-- 用于登陆mysql的密码 -->
<property name="password"></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>
</dbServerList>
<queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter">
<property name="LRUMapSize">1500</property>
<property name="defaultPool">server1</property>
<property name="writePool">server1</property>
<property name="readPool">server2</property>
<property name="needParse">true</property>
</queryRouter>
6.启动amoeba 进入amoeba的bin目录下./amoeba,如出现以下则说明启动成功
log4j:WARN log4j config load completed from file:/root/amoeba/conf/log4j.xml
log4j:WARN ip access config load completed from file:/root/amoeba/conf/access_list.conf
2016-04-16 08:30:43,096 INFO net.ServerableConnectionManager - Server listening on 0.0.0.0/0.0.0.0:8066.
7测试连接:
根据配置文件暴漏的用户名和密码登录mysql,mysql -h代理IP -u代理用户名 -p代理密码 -P8066,如出现以下测试说明成功
2016-04-16 08:43:10,583 INFO net.ConnectionManager - Connection Authenticate success [ conn=com.meidusa.amoeba.mysql.net.MysqlClientConnection@Socket[addr=/192.168.80.113,port=38999,localport=8066], hashcode=29112607].
注意:1.防火墙必须关闭,否则连接不上
2.实际数据库的账号必须允许远程登录