amoeba mysql的安装配置实例

小明SEO博客 小明SEO博客,新时代SEO博客

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 修改如下:

  1. <?xmlversion=”1.0″encoding=”gbk”?>
  2. <!DOCTYPEamoeba:configurationSYSTEM“amoeba.dtd”>
  3. <amoeba:configurationxmlns:amoeba=”http://amoeba.meidusa.com/”>
  4. <proxy>
  5. <!–serviceclassmustimplementscom.meidusa.amoeba.service.Service–>
  6. <servicename=”AmoebaforMysql”class=”com.meidusa.amoeba.mysql.server.MySQLService”>
  7. <!–portdefault–>
  8. <propertyname=”port”>8066</property>
  9. <!–bindipAddress–>
  10. <!–salley修改绑定IP地址–>
  11. <propertyname=”ipAddress”>172.16.206.129</property>
  12. <propertyname=”connectionFactory”>
  13. <beanclass=”com.meidusa.amoeba.mysql.net.MysqlClientConnectionFactory”>
  14. <propertyname=”sendBufferSize”>128</property>
  15. <propertyname=”receiveBufferSize”>64</property>
  16. </bean>
  17. </property>
  18. <propertyname=”authenticateProvider”>
  19. <beanclass=”com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator”>
  20. <!–访问amoeba的账户名–>
  21. <propertyname=”user”>amoeba</property>
  22. <!–访问amoeba的密码–>
  23. <propertyname=”password”>123456</property>
  24. <propertyname=”filter”>
  25. <beanclass=”com.meidusa.toolkit.net.authenticate.server.IPAccessController”>
  26. <propertyname=”ipFile”>${amoeba.home}/conf/access_list.conf</property>
  27. </bean>
  28. </property>
  29. </bean>
  30. </property>
  31. </service>
  32. <runtimeclass=”com.meidusa.amoeba.mysql.context.MysqlRuntimeContext”>
  33. <!–proxyserverclientprocessthreadsize–>
  34. <propertyname=”executeThreadSize”>128</property>
  35. <!–perconnectioncachepreparedstatementsize–>
  36. <propertyname=”statementCacheSize”>500</property>
  37. <!–defaultcharset–>
  38. <propertyname=”serverCharset”>utf8</property>
  39. <!–querytimeout(default:60second,TimeUnit:second)–>
  40. <propertyname=”queryTimeout”>60</property>
  41. </runtime>
  42. </proxy>
  43. <!–
  44. EachConnectionManagerwillstartasthread
  45. managerresponsiblefortheConnectionIOread,DeathDetection
  46. –>
  47. <connectionManagerList>
  48. <connectionManagername=”defaultManager”class=”com.meidusa.toolkit.net.MultiConnectionManagerWrapper”>
  49. <propertyname=”subManagerClassName”>com.meidusa.toolkit.net.AuthingableConnectionManager</property>
  50. </connectionManager>
  51. </connectionManagerList>
  52. <!–defaultusingfileloader–>
  53. <dbServerLoaderclass=”com.meidusa.amoeba.context.DBServerConfigFileLoader”>
  54. <propertyname=”configFile”>${amoeba.home}/conf/dbServers.xml</property>
  55. </dbServerLoader>
  56. <queryRouterclass=”com.meidusa.amoeba.mysql.parser.MysqlQueryRouter”>
  57. <propertyname=”ruleLoader”>
  58. <beanclass=”com.meidusa.amoeba.route.TableRuleFileLoader”>
  59. <propertyname=”ruleFile”>${amoeba.home}/conf/rule.xml</property>
  60. <propertyname=”functionFile”>${amoeba.home}/conf/ruleFunctionMap.xml</property>
  61. </bean>
  62. </property>
  63. <propertyname=”sqlFunctionFile”>${amoeba.home}/conf/functionMap.xml</property>
  64. <propertyname=”LRUMapSize”>1500</property>
  65. <propertyname=”defaultPool”>master</property>
  66. <propertyname=”writePool”>master</property>
  67. <propertyname=”readPool”>multiPool</property>
  68. <propertyname=”needParse”>true</property>
  69. </queryRouter>
  70. </amoeba:configuration>

/usr/local/amoeba/conf/dbServer.xml修改如下:

  1. <?xmlversion=”1.0″encoding=”gbk”?>
  2. <!DOCTYPEamoeba:dbServersSYSTEM“dbserver.dtd”>
  3. <amoeba:dbServersxmlns:amoeba=”http://amoeba.meidusa.com/”>
  4. <!–
  5. EachdbServerneedstobeconfiguredintoaPool,
  6. IfyouneedtoconfiguremultipledbServerwithloadbalancingthatcanbesimplifiedbythefollowingconfiguration:
  7. addattributewithnamevirtual=“true”indbServer,buttheconfigurationdoesnotallowtheelementwithnamefactoryConfig
  8. suchas‘multiPool’dbServer
  9. –>
  10. <dbServername=”abstractServer”abstractive=”true”>
  11. <factoryConfigclass=”com.meidusa.amoeba.mysql.net.MysqlServerConnectionFactory”>
  12. <propertyname=”connectionManager”>${defaultManager}</property>
  13. <propertyname=”sendBufferSize”>64</property>
  14. <propertyname=”receiveBufferSize”>128</property>
  15. <!–mysqlport访问MySQL的端口号–>
  16. <propertyname=”port”>3306</property>
  17. <!–mysqlschema访问MySQL默认的数据库–>
  18. <propertyname=”schema”>test</property>
  19. <!–mysqluser访问MySQL的账户名–>
  20. <propertyname=”user”>amoeba</property>
  21. <!–mysqlpassword访问MySQL的密码–>
  22. <propertyname=”password”>123456</property>
  23. </factoryConfig>
  24. <poolConfigclass=”com.meidusa.toolkit.common.poolable.PoolableObjectPool”>
  25. <propertyname=”maxActive”>500</property>
  26. <propertyname=”maxIdle”>500</property>
  27. <propertyname=”minIdle”>1</property>
  28. <propertyname=”minEvictableIdleTimeMillis”>600000</property>
  29. <propertyname=”timeBetweenEvictionRunsMillis”>600000</property>
  30. <propertyname=”testOnBorrow”>true</property>
  31. <propertyname=”testOnReturn”>true</property>
  32. <propertyname=”testWhileIdle”>true</property>
  33. </poolConfig>
  34. </dbServer>
  35. <dbServername=”master”parent=”abstractServer”>
  36. <factoryConfig>
  37. <!–mysqlip–>
  38. <propertyname=”ipAddress”>172.16.206.129</property>
  39. </factoryConfig>
  40. </dbServer>
  41. <dbServername=”slave”parent=”abstractServer”>
  42. <factoryConfig>
  43. <!–mysqlip–>
  44. <propertyname=”ipAddress”>172.16.206.130</property>
  45. </factoryConfig>
  46. </dbServer>
  47. <dbServername=”multiPool”virtual=”true”>
  48. <poolConfigclass=”com.meidusa.amoeba.server.MultipleServerPool”>
  49. <!–Loadbalancingstrategy:1=ROUNDROBIN,2=WEIGHTBASED,3=HA–>
  50. <propertyname=”loadbalance”>1</property>
  51. <!–Separatedbycommas,suchas:server1,server2,server1–>
  52. <propertyname=”poolNames”>master,slave,slave</property>
  53. //开源代码phpfensi.com
  54. </poolConfig>
  55. </dbServer>
  56. </amoeba:dbServers>

启动amoeba:/usr/local/amoeba/bin/launcher &

关闭amoeba:/usr/local/amoeba/bin/shutdown

amoeba不支持存储过程、不支持大数据量查询,这个比较讨厌,所以我最后还是没有用amoeba.

相关广告
  • amoeba mysql的安装配置实例 amoeba mysql的安装配置实例 amoeba mysql的安装配置实例
相关阅读

amoeba mysql的安装配置实例

2019/10/10 17:37:49 | 谷歌SEO算法 | 微服务