mycat应用

1.rule.xml

<?xml version="1.0" encoding="UTF-8"?>

<mycat:rule xmlns:mycat=“http://io.mycat/”>

​ id

​ func1

​ user_id

​ func1

​ sharding_id

​ hash-int

​ id

​ rang-long

​ id

​ mod-long

​ id

​ murmur

​ id

​ crc32slot

​ create_time

​ partbymonth

​ calldate

​ latestMonth

​ id

​ rang-mod

​ id

​ jump-consistent-hash

​ create_date

​ sharding-by-date

​ yyyy-MM-dd

​ 2018-01-03

​ 2018-01-07

​ 1

​ <function name=“murmur”

​ class=“io.mycat.route.function.PartitionByMurmurHash”>

​ 0

​ 2

​ 160

​ <!-- /etc/mycat/bucketMapPath

​ 用于测试时观察各物理节点与虚拟节点的分布情况,如果指定了这个属性,会把虚拟节点的murmur hash值与物理节点的映射按行输出到这个文件,没有默认值,如果不指定,就不会输出任何东西 -->

​ <function name=“crc32slot”

​ class=“io.mycat.route.function.PartitionByCRC32PreSlot”>

​ 2

​ <function name=“hash-int”

​ class=“io.mycat.route.function.PartitionByFileMap”>

​ partition-hash-int.txt

​ <function name=“rang-long”

​ class=“io.mycat.route.function.AutoPartitionByLong”>

​ autopartition-long.txt

​ 3

​ 8

​ 128

​ <function name=“latestMonth”

​ class=“io.mycat.route.function.LatestMonthPartion”>

​ 24

​ <function name=“partbymonth”

​ class=“io.mycat.route.function.PartitionByMonth”>

​ yyyy-MM-dd

​ 2015-01-01

​ partition-range-mod.txt

​ 3

</mycat:rule>

2.schema.xml

<?xml version="1.0"?>

<mycat:schema xmlns:mycat=“http://io.mycat/”>

  <table primaryKey="id" name="code_data" dataNode="dn1,dn2,dn3,dn4,dn5" rule="sharding-by-date" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="code_data_batch_report" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="code_data_import_error" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="code_data_upload_moa" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="code_data_upload_moa_record" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="code_data_upload_record" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="create_code_bag" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="create_code_base" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="distributor" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="error_moa_code_data" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="factory" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="product" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="production_task" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="query_report" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="query_report_detail" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="query_report_security" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="query_report_security_detail" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="rdc_user" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="rdc_warehouse" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="storage_data" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="storage_data_error" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="storage_data_upload_record" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="sys_dict" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="sys_param" />

  <table primaryKey="id" type="global" dataNode="dn1,dn2,dn3,dn4,dn5" name="sys_user" />      

  <table primaryKey="id" name="code_data" dataNode="lb1,lb2,lb3,lb4,lb5" rule="sharding-by-date" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="code_data_batch_report" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="code_data_import_error" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="code_data_upload_moa" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="code_data_upload_moa_record" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="code_data_upload_record" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="create_code_bag" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="create_code_base" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="distributor" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="error_moa_code_data" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="factory" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="product" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="production_task" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="query_report" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="query_report_detail" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="query_report_security" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="query_report_security_detail" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="rdc_user" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="rdc_warehouse" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="storage_data" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="storage_data_error" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="storage_data_upload_record" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="sys_dict" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="sys_param" />

  <table primaryKey="id" type="global" dataNode="lb1,lb2,lb3,lb4,lb5" name="sys_user" />

​ select 1

​ select 1

</mycat:schema>

3.server.xml

<?xml version="1.0" encoding="UTF-8"?>

<mycat:server xmlns:mycat=“http://io.mycat/”>

​ 0

​ 0

​ 2

​ <!–

​ 1

​ 32

​ -->

​ 0

​ <!–

​ 8066 9066

​ 300000 0.0.0.0

​ 4096 32 -->

​ 0

​ <!–

​ off heap for merge/order/group/limit 1开启 0关闭

​ -->

​ 1

​ <!–

​ 单位为m

​ -->

​ 1m

​ <!–

​ 单位为k

​ -->

​ 1k

​ 0

​ <!–

​ 单位为m

​ -->

​ 384m

​ true

​ <!–

​ -->

​ sierac1q2w3e

​ logicdb

​ <!–

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

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

​ -->

​ sierac1q2w3e

​ logiclb

</mycat:server>

猜你喜欢

转载自blog.csdn.net/fzt12138/article/details/101065902