当前位置:网站首页>MYCAT configuration
MYCAT configuration
2022-04-23 08:53:00 【Both refined and popular tastes zyyyy】
<!--schema Used to define mycat The logical library of , surface , Fragmentation rule ,dataNode and dataHost-->
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name=" Write the database name here " checkSQLschema="false" sqlMaxLimit="100">
<!--checkSQLschema Used to check whether the database name . Query by table name , if true, The query is sql It's going to be select * from Database name . Table name ; if false, be sql by select * from Table name -->
<!--sqlMaxLimit Used to implement limit, Even if sql No definition shown limit, After setting this value ,sql The effect is equivalent to limit 100-->
<table name=" Write the table name here , It's a logical table to slice " primaryKey="id" dataNode=" To work with dataNode Of name Consistent attributes , Here, for example. dn5" subTables=" Table name _$1-100, This represents 100 Slice table , Table name + Underline + Numbers " rule=" Fragment rule name , The rule name is in rule.xml Definition , for example ysgs"/>
</schema>
<!-- Entity library related -->
<dataNode name="dn5" dataHost=" Database instance , And dataHost Of name Consistent attributes , for example localhost4" database=" Entity database name " />
<!-- Instance connection related -->
<!--balance Property represents the load balancing policy :
balance=”0”, Do not turn on the read-write separation mechanism , All read operations are sent to the currently available writeHost On .
balance=”1”, All of the readHost And stand by writeHost Participate in select Statement load balancing , To put it simply , When dual master dual slave mode (M1->S1,M2->S2, also M1 And M2 Prepare for each other ), Under normal circumstances ,M2,S1,S2 All involved select Statement load balancing .
balance=”2”, All the reading operations are random in writeHost、readhost To distribute .
balance=”3”, All read requests are randomly distributed to wiriterHost Corresponding readhost perform ,writerHost No pressure to read
-->
<!--dbDriver, Specify the connection to the back-end database Driver, The values currently available are native and JDBC. Use native Words , Because the value is binary mysql agreement , So you can use mysql and maridb. Other types of databases need to use JDBC Drive to support -->
<!--switchType,-1 Means no automatic switching ;1 The default value is , Automatic switch ;2 be based on mysql Master slave state switching ;3 Based on cluster switching -->
<dataHost name="localhost4" maxCon=" Specifies the maximum connection for each read-write instance connection pool , for example 1000" minCon=" Specifies the minimum connection for each read-write instance connection pool , for example 10" balance="0"
writeType="1" dbType=" Database type , for example mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<writeHost host="hostM1" url=" Database connection " user=" user name " password=" password ">
</writeHost>
</dataHost>
</mycat:schema>
<!--rule.xml Configuration related -->
<tableRule name="ysgs, This corresponds to the partition rule name written above ">
<rule>
<columns> Which column name is used as the partition benchmark </columns>
<algorithm> Fragmentation rule ,murmur For consistency hash,10 See other bloggers' blogs for the rules of segmentation , Link to [https://blog.csdn.net/zxp2624161989/article/details/107230370/](https://blog.csdn.net/zxp2624161989/article/details/107230370/)</algorithm>
</rule>
</tableRule>
<function name="murmur"
class="io.mycat.route.function.PartitionByMurmurHash">
<property name="seed">0</property><!-- The default is 0 -->
<property name="count">100</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>
版权声明
本文为[Both refined and popular tastes zyyyy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230816162322.html
边栏推荐
- php基于哈希算法出现的强弱比较漏洞
- Flink reads MySQL and PgSQL at the same time, and the program will get stuck without logs
- LeetCode_DFS_中等_1254. 统计封闭岛屿的数目
- 搜索树判断 (25 分)
- Search tree judgment (25 points)
- K210 learning notes (II) serial communication between k210 and stm32
- 洋桃电子STM32物联网入门30步笔记一、HAL库和标准库的区别
- Noyer électronique stm32 Introduction à l'Internet des objets 30 étapes notes I. différences entre la Bibliothèque Hal et la Bibliothèque standard
- 怎样读取Excel表格到数据库
- Share the office and improve the settled experience
猜你喜欢
L2-024 部落 (25 分)(并查集)
Redis Desktop Manager for Mac(Redis可视化工具)
Study notes of deep learning (8)
Virtual online exhibition - Online VR exhibition hall realizes 24h immersive exhibition viewing
valgrind和kcachegrind使用运行分析
valgrind和kcachegrind使用運行分析
idea打包 jar文件
Notes on 30 steps of introduction to Internet of things of yangtao electronics STM32 III. Explanation of new cubeide project and setting
ONEFLOW learning notes: from functor to opexprinter
MATLAB 画五星红旗
随机推荐
Download and install bashdb
Introduction to matlab
xctf刷题小记
idea底栏打开services
Kubernetes如何使用harbor拉去私有镜像
Failed to prepare device for development
Arbre de dépendance de l'emballage des ressources
Play with binary tree (25 points)
Flink同时读取mysql与pgsql程序会卡住且没有日志
Go语言自学系列 | golang结构体作为函数参数
On time atom joins hands with oneos live broadcast, and the oneos system tutorial is fully launched
After a circle, I sorted out this set of interview questions..
共享办公室,提升入驻体验
Consensus Token:web3. 0 super entrance of ecological flow
OneFlow学习笔记:从Functor到OpExprInterpreter
Error: cannot find or load main class
Go语言自学系列 | golang方法
DJ音乐管理软件Pioneer DJ rekordbox
LaTeX数学公式
The crawler returns null when parsing with XPath. The reason why the crawler cannot get the corresponding element and the solution