amoeba的部署(mysql读写分离,负载均衡)

本文介绍了在Java环境中使用Amoeba作为MySQL中间件,实现数据库的读写分离和负载均衡。首先确保不是在主从复制环境下,然后下载并安装Amoeba,配置dbServers.xml和amoeba.xml文件,设置读写服务器和负载均衡策略。在amoeba.xml中定义服务器配置,最后通过launcher启动Amoeba。如果遇到JVM堆大小问题,可以调整jvm.properties中的设置。测试时需关闭主从复制以观察效果。
摘要由CSDN通过智能技术生成

环境前提:java (负载均衡在主从复制环境下针对从库池,读写分离不需要主从复制,有也需要关掉服务才有测试效果)
amoeba是阿里沿用的mysql中间件,
下载包 amoeba-mysql-3.0.5-RC-distribution.zip
解压到/usr/src/
主要两个配置文件 dbServer.xml 控制代理端和逻辑库池间的关系 amoeba.xml控制amoeba的连接端口和密码
dbServers.xml 多个数据源,多个数据库
amoeba.xml 启动参数,谁负责读,谁负责写,谁负责负载均衡

[root@mycat3 ~]# vim /usr/src/amoeba/conf/dbServers.xml 

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

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

                <!-- 
                        Each dbServer needs to be configured into a Pool,
                        If you need to configure multiple dbServer with load balancing that can be simplified by the following configuration:
                         such as 'multiPool' dbServer   
                -->

        <dbServer name="abstractServer" abstractive="true">
                <factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
                        <property name="connectionManager">${defaultManager}</property>
                        <property name="sendBufferSize">64</property>
                <!-- 
                        Each dbServer needs to be configured into a Pool,
                        If you need to configure multiple dbServer with load balancing that can be simplified by the following configuration:
                         such as 'multiPool' dbServer   
                -->

        <dbServer name="abstractServer" abstractive="true">
                <factoryConfig class="com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory">
                        <property name="connectionManager">${defaultManager}</property>
                        <property name="sendBufferSize">64</property>
                        <property name="receiveBufferSize">128</property>

                        <!-- mysql port -->
                        <property name="port">3306</property>

                        <!-- mysql schema -->
                        <property name="schema">wkbbs</property>

                        <!-- mysql user -->
                        <property name="user">rs</proper
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值