wget http://dl.mycat.io/1.6-RELEASE/Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz

vim schema.xml

--

<?xml version="1.0"?>

<!DOCTYPE mycat:schema SYSTEM "schema.dtd">

<mycat:schema xmlns:mycat="http://io.mycat/">

      <!-- 定义一个MyCat的模式,逻辑数据库名称TestDB -->

      <!-- “checkSQLschema”:描述的是当前的连接是否需要检测数据库的模式 -->

      <!-- “sqlMaxLimit”:表示返回的最大的数据量的行数 -->

      <!-- “dataNode="dn1"”:该操作使用的数据节点是dn1的逻辑名称 -->

      <schema name="zhime-theme" checkSQLschema="true" sqlMaxLimit="100" dataNode="zhime-theme"/>

      <!-- 定义数据的操作节点 -->

      <!-- “dataHost="localhost1"”:定义数据节点的逻辑名称 -->

      <!-- “database="mldn"”:定义数据节点要使用的数据库名称 -->

      <dataNode name="zhime-theme" dataHost="zhime-theme" database="zhime-theme" />

      <!-- 定义数据节点,包括了各种逻辑项的配置 -->

      <dataHost name="zhime-theme" maxCon="1000" minCon="10" balance="0" writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100">

          <!-- 配置真实MySQL与MyCat的心跳 -->

          <heartbeat>select user()</heartbeat>

          <!-- 配置真实的MySQL的连接路径 -->

          <writeHost host="zhime-theme" url="10.10.111.2:3306" user="root" password="bnh1923"></writeHost>

      </dataHost>

</mycat:schema>

--

vim server.xml

--

 <user name="root">

                <property name="password">bnh1923</property>

                <property name="schemas">zhime-theme</property>

                <!-- 表级 DML 权限设置 -->

                <!--            

                <privileges check="false">

                        <schema name="TESTDB" dml="0110" >

                                <table name="tb01" dml="0000"></table>

                                <table name="tb02" dml="1111"></table>

                        </schema>

                </privileges>           

                 -->

        </user>

        <user name="zhime-theme">

                <property name="password">bnh1923</property>

                <property name="schemas">zhime-theme</property>

                <property name="readOnly">false</property>

        </user>

--

wget http://nexus.mycat.io/content/groups/public/io/mycat/mycat/Mycat-web/1.0-SNAPSHOT/Mycat-web-1.0-20160617.083134-5-20160617163048-linux.tar.gz

vim mycat-web/WEB-INF/classes/mycat.properties

--

zookeeper=10.10.111.80:2181

sqlonline.server=10.10.111.2

sqlonline.user=root

sqlonline.passwd=bnh1923

--

web访问:http://localhost:8082/mycat


--------------------------------------------------------------------------------------------------------------

###多实例配置

vim schema.xml

--

<?xml version="1.0"?>

<!DOCTYPE mycat:schema SYSTEM "schema.dtd">

<mycat:schema>

        <schema name="aone" checkSQLschema="false" sqlMaxLimit="100" dataNode="aone"/>

        <schema name="mtop" checkSQLschema="false" sqlMaxLimit="100" dataNode="mtop"/>

        <dataNode name="aone" dataHost="aone" database="aone"/>

        <dataNode name="mtop" dataHost="mtop" database="mtop"/>

        <dataHost name="aone" maxCon="1000" minCon="10" balance="0"

                writeType="0" dbType="mysql" dbDriver="native">

                <heartbeat>select 1</heartbeat>

                <writeHost host="aone" url="192.168.1.220:3301" user="root" password="bnh1923"/>

        </dataHost>

        <dataHost name="mtop" maxCon="1000" minCon="10" balance="0"

                writeType="0" dbType="mysql" dbDriver="native">

                <heartbeat>select 1</heartbeat>

                <writeHost host="mtop" url="192.168.1.220:3302" user="root" password="bnh1923"/>

        </dataHost>

</mycat:schema>

--

vim server.xml

--

        <user name="aone">

                <property name="password">bnh1923</property>

                <property name="schemas">aone</property>

        </user>

        <user name="mtop">

                <property name="password">bnh1923</property>

                <property name="schemas">mtop</property>

</user>

--

=====================

#daily环境

版本:1.6.1

10.10.111.2 mycat,mycat-web

mycat端口:8066

web端:http://10.10.111.2:8082/mycat

#test环境

版本:1.6.1

10.10.111.4 mycat

mycat端口:8066

web端:http://10.10.111.4:8082/mycat

#online环境

版本:1.6.1

10.8.81.67 mycat1

10.8.81.68 mycat2

10.8.81.69 mycat3

mycat端口:8066



签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回