[Getting started with cobar configuration]

Cobar can be described as the old ancestor of mycat, and its configuration is almost the same as that of mycat. mycat configuration reference:

Permalink:  http://gaojingsong.iteye.com/blog/2337539

Preview article: [Introduction to sub-database and sub-table of Mycat operation]

Here is an example configuration for Cobar:

First, configure the data source file

<cobar:schema xmlns:cobar="http://cobar.alibaba.com/">

 

  <!-- schema definition-->

  <schema name="dbtest" dataNode="dnTest1">

    <table name="t_gaojs" dataNode="dnTest2,dnTest3" rule="rule1" />

  </schema>

 

  <!-- Data node definition, data node is organized by data source and some other parameters. -->

  <dataNode name="dnTest1">

    <property name="dataSource">

      <dataSourceRef>dsTest[0]</dataSourceRef>

    </property>

  </dataNode>

  <dataNode name="dnTest2">

    <property name="dataSource">

      <dataSourceRef>dsTest[1]</dataSourceRef>

    </property>

  </dataNode>

  <dataNode name="dnTest3">

    <property name="dataSource">

      <dataSourceRef> dsTest[2] </dataSourceRef>   --> Guess to refer to the database in location

    </property>

  </dataNode>

 

  <!-- Data source definition, a data source is a representation of a specific back-end data connection. -->

  <dataSource name="dsTest" type="mysql">

    <property name="location">

     <location>127.0.0.1:3306/db1</location>

      <location>127.0.0.1:3306/db2</location>

      <location>127.0.0.1:3306/db3</location>

    </property>

    <property name="user">root</property>

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

    <property name="sqlMode">STRICT_TRANS_TABLES</property>

  </dataSource>

 

</cobar:schema>

2. Enable the test



 

 



 

log4j:WARN 2017-03-22 20:48:27 [cobar.home] is not set.

20:48:27,017 INFO  ===============================================

20:48:27,017 INFO  Cobar is ready to startup ...

20:48:27,017 INFO  Startup processors ...

20:48:27,079 INFO  Startup connector ...

20:48:27,079 INFO  Initialize dataNodes ...

20:48:27,095 INFO  dnTest1:0 init success

20:48:27,095 INFO  dnTest3:0 init success

20:48:27,095 INFO  dnTest2:0 init success

20:48:27,095 INFO  CobarManager is started and listening on 9066

20:48:27,111 INFO  CobarServer is started and listening on 8066

20:48:27,111 INFO  ===============================================



 

Error solution:

 

Out of memory solution



 This error is cobar:schema misconfiguration

 

 

 

Original is not easy, welcome to reward, please look for the correct address, beware of counterfeiting



 

 

 



 



 

 

 



 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326588795&siteId=291194637