标签:database version 读取 schema 技术分享 存储过程 conf ati object
原文链接:http://www.abcdocker.com/abcdocker/81
[root@db01 ~]# tar -xf jdk-8u91-linux-i586.tar.gz -C /usr/lib/
[root@db01 ~]# ln -s /usr/lib/jdk1.8.0_91/ /usr/lib/java
[root@db01 ~]# cat >> /etc/profile <<EOF
[root@db01 ~]# echo ‘
export JAVA_HOME=/usr/lib/java
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH‘ >> /etc/profileEOF
[root@db01 ~]# source /etc/profile
[root@db01 ~]# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) Client VM (build 25.91-b14, mixed mode)
[root@db01 ~]# wget http://ncu.dl.sourceforge.net/project/amoeba/Amoeba%20for%20mysql/2.x/amoeba-mysql-binary-2.1.0-RC5.tar.gz
[root@db01 ~]# mkdir -p /application/amoeba-2.1.0-rc5
[root@db01 ~]# tar -xf amoeba-mysql-binary-2.1.0-RC5.tar.gz /application/amoeba-2.1.0-rc5/
[root@db01 ~]# ln -s /application/amoeba-2.1.0-rc5/ /application/amoeba
[root@db01 ~]# echo ‘PATH=/application/amoeba/bin/:$PATH‘ >> /etc/profile
[root@db01 ~]# source /etc/profile
dbServers.xml #主机IP,端口,Amoeba的用户名密码
rule.xml #切分规则相关
functionMap.xml #描述了函数名和函数处理的关系
ruleFunctionMap.xml #自定义函数
access_list.conf #可以访问和拒绝访问的列表
log4j.xml #日志文件相关配置
[root@db01 ~]# mysql -uroot -poldboy123 -S /data/3306/mysql.sock
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.49-log Source distribution
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
mysql>
<?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="manager">${defaultManager}</property>
<property name="sendBufferSize">64</property>
<property name="receiveBufferSize">128</property>
<!-- mysql port -->
<property name="port">3306</property>
<!-- mysql schema -->
<property name="schema">test</property>
<!-- mysql user -->
<property name="user">oldboy</property>
<!-- mysql password -->
<property name="password">123456</property>
</factoryConfig>
<poolConfig class="com.meidusa.amoeba.net.poolable.PoolableObjectPool">
<property name="maxActive">500</property>
<property name="maxIdle">500</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="server1" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">127.0.0.1</property>
</factoryConfig>
</dbServer>
<dbServer name="multiPool" virtual="true">
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=H
A-->
<property name="loadbalance">1</property>
<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">server1</property>
</poolConfig>
</dbServer>
</amoeba:dbServers>
创建授权用户bzjxs
GRANT ALL ON *.* TO ‘bzjxs‘@‘172.16.1.%‘ IDENTIFIED BY ‘123456‘
配置dbServer.xml
<?xml version="1.0" encoding="gbk"?>
<!DOCTYPE amoeba:dbServers SYSTEM "dbserver.dtd">
<amoeba:dbServers xmlns:amoeba="http://amoeba.meidusa.com/">
...
<dbServer name="Master" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.0.1</property>
</factoryConfig>
</dbServer>
<--配置mysql节点master-->
<dbServer name="Slave1" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.0.2</property>
</factoryConfig>
</dbServer>
<--配置mysql节点slave1-->
<dbServer name="Slave2" parent="abstractServer">
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.0.3</property>
</factoryConfig>
</dbServer>
<--配置mysql节点slave2-->
<dbServer name="virtualSlave" virtual="true">
<--配置mysql节点池-->
<poolConfig class="com.meidusa.amoeba.server.MultipleServerPool">
<!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
<property name="loadbalance">1</property>
<--1代表轮询-->
<!-- Separated by commas,such as: server1,server2,server1 -->
<property name="poolNames">Slave1,Slave1,Slave2</property>
<--配置权重 代表轮询两次Slave1,轮询1次Slave2-->
</poolConfig>
</dbServer>
...
</amoeba:dbServers>
<?xml version="1.0" encoding="gbk"?>
<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/">
...
<queryRouter class=”com.meidusa.amoeba.mysql.parser.MysqlQueryRouter”>
<property name="LRUMapSize">1500</property>
<--amoeba缓存的语句的条数-->
<property name="defaultPool">Master</property>
<--默认访问的mysql节点 一些除了SELECT\UPDATE\INSERT\DELETE的语句都会在defaultPool执行-->
<property name="writePool">Master</property>
<--写入的服务器-->
<property name="readPool">virtualSlave</property>
<--读取的服务器可以是节点名也可以是节点池名-->
<property name="needParse">true</property>
</queryRouter>
...
</amoeba:configuration>
标签:database version 读取 schema 技术分享 存储过程 conf ati object
原文地址:http://www.cnblogs.com/kevincaptain/p/6520434.html