当前位置:网站首页>MYCAT divides the database and table according to the hash value of the string range
MYCAT divides the database and table according to the hash value of the string range
2022-07-19 12:40:00 【Technology -hxy】
Mainly focus on server.xml 、rule.xml、schema.xml 3 File
Log in logs Next wrapper.log mycat.log
wrapper.log Show MyCAT Server startup successfully Successful launch
One :wrapper.conf Next change java Address
wrapper.java.command=java Address
Two :server.xml View or change under mycat Login account password and its default library
<user name="root" defaultAccount="true">
<property name="password">123456</property>
<property name="schemas">sxxfj</property>
<property name="defaultSchema">sxxfj</property>
</user>
Two :schema.xml Next, change the sub database address and its sub table rules
<schema name="sxxfj" checkSQLschema="false" sqlMaxLimit="100" randomDataNode="dn1,dn2">
<!-- auto sharding by id (long) -->
<!--splitTableNames Enable <table name Property to configure multiple tables using comma splitting , That is, multiple tables use this configuration name Table name dataNode Sub database and its address rule Fragmentation rule -->
<table name="tb_order_declaration" dataNode="dn1,dn2" rule="mod_rule" />
<!-- <table name="oc_call" primaryKey="ID" dataNode="dn1$0-743" rule="latest-month-calldate"
/> -->
</schema>
<!-- <dataNode name="dn1$0-743" dataHost="localhost1" database="db$0-743"
/> -->
<dataNode name="dn1" dataHost="localhost1" database="sxxfj" />
<dataNode name="dn2" dataHost="localhost2" database="sxxfj" />
<!--<dataNode name="dn4" dataHost="sequoiadb1" database="SAMPLE" />
<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="localhost1" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM1" url="mysql Address 1:3306" user="root"
password="mysql Address 1 password ">
</writeHost>
<!-- <writeHost host="hostM2" url="localhost:3316" user="root" password="123456"/> -->
</dataHost>
<dataHost name="localhost2" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM2" url="mysql Address 2:3306" user="root"
password="mysql Address 2 password ">
</writeHost>
<!-- <writeHost host="hostM2" url="localhost:3316" user="root" password="123456"/> -->
</dataHost>
3、 ... and :rule.xml Next, change or add rules
<tableRule name="mod_rule">
<rule>
<!-- Field name -->
<columns>channel_no</columns>
<!-- Fragmentation rule -->
<algorithm>murmur</algorithm>
</rule>
</tableRule>
<function name="murmur"
class="io.mycat.route.function.PartitionByMurmurHash">
<property name="seed">0</property><!-- The default is 0 -->
<property name="count">2</property><!-- Number of database nodes to fragment , Must specify , Otherwise, it can't be divided -->
<property name="virtualBucketTimes">160</property><!-- An actual database node is mapped to so many virtual nodes , The default is 160 times , That is, the number of virtual nodes is the number of physical nodes 160 times -->
<!-- <property name="weightMapFile">weightMapFile</property> Weight of nodes , Nodes without weights are 1. With properties Format of documents , From the 0 Start to count-1 That is, the node index is key, Take node weight value as value . Ownership value must be a positive integer , Otherwise, we should 1 Instead of -->
<!-- <property name="bucketMapPath">/etc/mycat/bucketMapPath</property>
Used to observe the distribution of physical nodes and virtual nodes during the test , If this property is specified , The virtual node murmur hash The mapping of values to physical nodes is output to this file by line , No default , If you don't specify , You don't export anything -->
</function>
边栏推荐
- Ah Qu's thinking
- 全球金融危机来袭,如何科学理性投资?2020-03-17
- A skill; Teach you to easily download Tiktok live video, Tiktok live video download new scheme!
- S32K148_ Can drive (bare metal development)
- 超声波传感器系列文章汇总
- Mysql-1366 - Incorrect string value: ‘\xE5\xBC\xA0\xE4\xB8\x89‘ for column ‘userName‘ at row 1
- Logical operator 1 (Gretel software - Jiuye training)
- Database daily question --- day 25: bank account summary II
- 阿荷投资的思考
- In 2022, how to choose cross end technology solutions?
猜你喜欢

String correlation function (II)

Investment logic in market "uncertainty" 2020-03-18

Preparation Notes: Matplotlib learning notes a

Learning record: call TFTLCD

RAID 磁盘阵列详解,RAID分类及优缺点

动态内存规划

关于“抄底”心态,让你筋疲力尽 2020-03-15

Opencv:06 morphology

PyTorch版:集成注意力和MobileNet的YOLOv4

C # from introduction to mastery Part II: C # basic grammar
随机推荐
Redis logical cluster creation
The active and standby cache of redis cluster is full, causing frequent active and standby switchover
Day 1 Experiment
2022全球开发者薪资曝光:中国排第19名,平均年薪23,790美元
mysql如何删除数据表,被关联的数据表如何删除呢
How to invest scientifically and rationally when the global financial crisis strikes? 2020-03-17
Learning record: call TFTLCD
虞美人·寄公度
Lazy to the bone, I am too lazy to write articles in CSDN. I write articles based on selenium simulation
Detailed explanation of RAID disk array, raid classification, advantages and disadvantages
机器学习(上)吴恩达
Genesis and bluerun ventures have in-depth exchanges
Impulse function, step function, ramp function and impulse response
RingBuffer
动态内存规划
Will the market halve? What investment opportunities are there? 2020-03-11
查看mysql数据表结构的两种方法你会吗?
电路故障的分析简略
第四天作業
HICP day 3