amoeba mysql的安装配置实例
发布:smiling 来源: PHP粉丝网 添加日期:2014-09-23 16:21:44 浏览: 评论:0
Amoeba是一个以MySQL为底层数据存储,并对应用提供MySQL协议接口的proxy,它集中地响应应用的请求,依据用户事先设置的规则,将SQL请求发送到特定的数据库上执行,下面我们来看看amoeba mysql的安装配置教程.
1、配置好mysql的主从环境,服务器如下,代码如下:
master:172.16.206.129
slave:172.16.206.130
amoeba:172.16.206.131
2、amoeba配置好JDK环境
可以去oracle的官网去下载JDK,安装目录一边不是标准的命名,使用如下命令做软连接:
ln -s /usr/java/jdk1.8.0_11/ /usr/java/jdk1.8
配置JDK环境:在/etc/profile文件末尾添加以下环境参数,代码如下:
export JAVA_HOME=/usr/java/jdk1.8
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
PS:下载的JDK需要和平台对应,uname 可以查看平台类型
3、下载amoeba
网上搜索可以去一些开源软件的网站下载
4、安装amoeba
安装路径/usr/local/amoeba
5、修改amoeba配置参数.
/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/”>
- <proxy>
- <!– service class must implements com.meidusa.amoeba.service.Service –>
- <service name=”Amoeba for Mysql” class=”com.meidusa.amoeba.mysql.server.MySQLService”>
- <!– port default –>
- <property name=”port”>8066</property>
- <!– bind ipAddress –>
- <!–salley 修改绑定IP地址–>
- <property name=”ipAddress”>172.16.206.129</property>
- <property name=”connectionFactory”>
- <bean class=”com.meidusa.amoeba.mysql.net.MysqlClientConnectionFactory”>
- <property name=”sendBufferSize”>128</property>
- <property name=”receiveBufferSize”>64</property>
- </bean>
- </property>
- <property name=”authenticateProvider”>
- <bean class=”com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator”>
- <!– 访问amoeba的账户名 –>
- <property name=”user”>amoeba</property>
- <!– 访问amoeba的密码 –>
- <property name=”password”>123456</property>
- <property name=”filter”>
- <bean class=”com.meidusa.toolkit.net.authenticate.server.IPAccessController”>
- <property name=”ipFile”>${amoeba.home}/conf/access_list.conf</property>
- </bean>
- </property>
- </bean>
- </property>
- </service>
- <runtime class=”com.meidusa.amoeba.mysql.context.MysqlRuntimeContext”>
- <!– proxy server client process thread size –>
- <property name=”executeThreadSize”>128</property>
- <!– per connection cache prepared statement size –>
- <property name=”statementCacheSize”>500</property>
- <!– default charset –>
- <property name=”serverCharset”>utf8</property>
- <!– query timeout( default: 60 second , TimeUnit:second) –>
- <property name=”queryTimeout”>60</property>
- </runtime>
- </proxy>
- <!–
- Each ConnectionManager will start as thread
- manager responsible for the Connection IO read , Death Detection
- –>
- <connectionManagerList>
- <connectionManager name=”defaultManager” class=”com.meidusa.toolkit.net.MultiConnectionManagerWrapper”>
- <property name=”subManagerClassName”>com.meidusa.toolkit.net.AuthingableConnectionManager</property>
- </connectionManager>
- </connectionManagerList>
- <!– default using file loader –>
- <dbServerLoader class=”com.meidusa.amoeba.context.DBServerConfigFileLoader”>
- <property name=”configFile”>${amoeba.home}/conf/dbServers.xml</property>
- </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.xml</property>
- <property name=”functionFile”>${amoeba.home}/conf/ruleFunctionMap.xml</property>
- </bean>
- </property>
- <property name=”sqlFunctionFile”>${amoeba.home}/conf/functionMap.xml</property>
- <property name=”LRUMapSize”>1500</property>
- <property name=”defaultPool”>master</property>
- <property name=”writePool”>master</property>
- <property name=”readPool”>multiPool</property>
- <property name=”needParse”>true</property>
- </queryRouter>
- </amoeba:configuration>
/usr/local/amoeba/conf/dbServer.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:
- add attribute with name virtual = “true” in dbServer, but the configuration does not allow the element with name factoryConfig
- 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 访问MySQL的端口号 –>
- <property name=”port”>3306</property>
- <!– mysql schema 访问MySQL默认的数据库–>
- <property name=”schema”>test</property>
- <!– mysql user 访问MySQL的账户名–>
- <property name=”user”>amoeba</property>
- <!– mysql password 访问MySQL的密码–>
- <property name=”password”>123456</property>
- </factoryConfig>
- <poolConfig class=”com.meidusa.toolkit.common.poolable.PoolableObjectPool”>
- <property name=”maxActive”>500</property>
- <property name=”maxIdle”>500</property>
- <property name=”minIdle”>1</property>
- <property name=”minEvictableIdleTimeMillis”>600000</property>
- <property name=”timeBetweenEvictionRunsMillis”>600000</property>
- <property name=”testOnBorrow”>true</property>
- <property name=”testOnReturn”>true</property>
- <property name=”testWhileIdle”>true</property>
- </poolConfig>
- </dbServer>
- <dbServer name=”master” parent=”abstractServer”>
- <factoryConfig>
- <!– mysql ip –>
- <property name=”ipAddress”>172.16.206.129</property>
- </factoryConfig>
- </dbServer>
- <dbServer name=”slave” parent=”abstractServer”>
- <factoryConfig>
- <!– mysql ip –>
- <property name=”ipAddress”>172.16.206.130</property>
- </factoryConfig>
- </dbServer>
- <dbServer name=”multiPool” virtual=”true”>
- <poolConfig class=”com.meidusa.amoeba.server.MultipleServerPool”>
- <!– Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA–>
- <property name=”loadbalance”>1</property>
- <!– Separated by commas,such as: server1,server2,server1 –>
- <property name=”poolNames”>master,slave,slave</property>
- //开源代码phpfensi.com
- </poolConfig>
- </dbServer>
- </amoeba:dbServers>
启动amoeba:/usr/local/amoeba/bin/launcher &
关闭amoeba:/usr/local/amoeba/bin/shutdown
amoeba不支持存储过程、不支持大数据量查询,这个比较讨厌,所以我最后还是没有用amoeba.
Tags: amoeba mysql安装配置
相关文章
- ·Mac OS X Lion pythonmysql安装配置记录(2014-10-09)
- ·MySQL HandlerSocket 插件安装配置详解(2015-04-17)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)