anzhen0429的博客通过本文主要向大家介绍了mycat schema.xml,mycat schema,mycat schema.xml详解,mycat集群,mycat集群百度等相关知识,希望本文的分享对您有所帮助
在第一部分,有简单的介绍MyCAT的搭建和配置文件的基本情况,这一篇详细介绍schema的一些具体参数,以及实际作用
首先贴上自己测试用的schema文件,双引号之前的反斜杠不会消除,姑且当成不存在吧...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | <? xml version=\"1.0\"?> <!DOCTYPE mycat:schema SYSTEM \"schema.dtd\"> < mycat:schema xmlns:mycat=\"http://org.opencloudb/\"> < schema name=\"mycat\" checkSQLschema=\"false\" sqlMaxLimit=\"100\"> <!-- auto sharding by id (long) --> < table name=\"students\" dataNode=\"dn1,dn2,dn3,dn4\" rule=\"rule1\" /> < table name=\"log_test\" dataNode=\"dn1,dn2,dn3,dn4\" rule=\"rule2\" /> <!-- global table is auto cloned to all defined data nodes ,so can join with any table whose sharding node is in the same data node --> <!--<table name=\"company\" primaryKey=\"ID\" type=\"global\" dataNode=\"dn1,dn2,dn3\" /> <table name=\"goods\" primaryKey=\"ID\" type=\"global\" dataNode=\"dn1,dn2\" /> --> < table name=\"item_test\" primaryKey=\"ID\" type=\"global\" dataNode=\"dn1,dn2,dn3,dn4\" /> <!-- random sharding using mod sharind rule --> <!-- <table name=\"hotnews\" primaryKey=\"ID\" dataNode=\"dn1,dn2,dn3\" rule=\"mod-long\" /> --> <!-- <table name=\"worker\" primaryKey=\"ID\" dataNode=\"jdbc_dn1,jdbc_dn2,jdbc_dn3\" rule=\"mod-long\" /> --> <!-- <table name=\"employee\" primaryKey=\"ID\" dataNode=\"dn1,dn2\" rule=\"sharding-by-intfile\" /> <table name=\"customer\" primaryKey=\"ID\" dataNode=\"dn1,dn2\" rule=\"sharding-by-intfile\"> <childTable name=\"orders\" primaryKey=\"ID\" joinKey=\"customer_id\" parentKey=\"id\"> <childTable name=\"order_items\" joinKey=\"order_id\" parentKey=\"id\" /> <ildTable> <childTable name=\"customer_addr\" primaryKey=\"ID\" joinKey=\"customer_id\" parentKey=\"id\" /> --> </ schema > <!-- <dataNode name=\"dn\" dataHost=\"localhost\" database=\"test\" /> --> < dataNode name=\"dn1\" dataHost=\"localhost\" database=\"test1\" /> < dataNode name=\"dn2\" dataHost=\"localhost\" database=\"test2\" /> < dataNode name=\"dn3\" dataHost=\"localhost\" database=\"test3\" /> < dataNode name=\"dn4\" dataHost=\"localhost\" database=\"test4\" /> <!-- <dataNode name=\"jdbc_dn1\" dataHost=\"jdbchost\" database=\"db1\" /> <dataNode name=\"jdbc_dn2\" dataHost=\"jdbchost\" database=\"db2\" /> <dataNode name=\"jdbc_dn3\" dataHost=\"jdbchost\" database=\"db3\" /> --> < dataHost name=\"localhost\" maxCon=\"100\" minCon=\"10\" balance=\"1\" writeType=\"1\" dbType=\&quo
|