当前位置:网站首页>[MYCAT] MYCAT configuration file
[MYCAT] MYCAT configuration file
2022-07-24 05:54:00 【Why don't you laugh】
Mycat The configuration file
1. service (server)
Service related configuration , stay conf Under the path , The default configuration is enough

2. user (user)
Configure user related information , stay conf/users Under the path
Command mode :{ user name }.user.json

vim root.user.json
{
"ip":null,
"password":"123456",
"transactionType":"xa",
"username":"root",
"isolation":3
}
# Field meaning
#ip: Client access ip, Suggestion is empty , After filling in, the client will be ip Limit
#username: user name
#password: password
#isolation: Initialized transaction isolation level
READ_UNCOMMITTED:1
READ_COMMITTED:2
REPEATED_READ:3, Default
SERIALIZABLE:4
#transactionType: Transaction type
proxy Local transactions , Involving more than 1 Transactions of databases ,commit Phase failure can lead to inconsistencies , But the compatibility is the best
xa Business , You need to confirm whether the storage node cluster type supports XA
3. data source (datasource)
To configure mycat Connected data source information , stay conf/datasources Under the path
Command mode :{ Data source name }.datasource.json

vim protorypeDs.datasource.json
{
"dbType": "mysql",
"idleTimeout": 60000,
"initSqls": [],
"initSqlsGetConnection": true,
"instanceType": "READ_WRITE",
"maxCon": 1000,
"maxConnectTimeout": 3000,
"maxRetryCount": 5,
"minCon": 1,
"name": "prototype",
"password": "123456",
"type": "JDBC",
"url":
"jdbc:mysql://127.0.0.1:3306/mysql?useUnicode=true&serverTimezone=UTC",
"user": "root",
"weight": 0,
"queryTimeout":30,//mills
}
# Field meaning
# dbType: Database type ,mysql
# name: user name
# password: password
# type: Data source type , Default JDBC
# url: Database access address
# idleTimeout: Idle connection timeout
# initSqls: initialization SQL
# initSqlsGetConnection: about jdbc Whether to execute every time you get a connection initSqls
# instanceType: Configure whether the instance is read-only or read-write ,READ_WRITE,READ,WRITE
# weight: The weight
# Connection related configuration
"maxCon": 1000,
"maxConnectTimeout": 3000,
"maxRetryCount": 5,
"minCon": 1
4. colony (cluster)
Configure cluster information , stay conf/clusters Under the path
stay mycat in , Create a cluster , A corresponding cluster file
Command mode :{ Cluster name }.cluster.json

vim prototype.cluster.json
{
"clusterType":"MASTER_SLAVE",
"heartbeat":{
"heartbeatTimeout":1000,
"maxRetryCount":3,//2021-6-4 Before is maxRetry, Later, it is corrected to maxRetryCount
"minSwitchTimeInterval":300,
"slaveThreshold":0
},
"masters":[ // Configure multiple master nodes , During the main connection, a data source that detects the survival will be selected as the main node
"prototypeDs"
],
"replicas":[// Configure multiple slave nodes
"xxxx"
],
"maxCon":200,
"name":"prototype",
"readBalanceType":"BALANCE_ALL",
"switchType":"SWITCH",
"timer":{
//MySQL Cluster heartbeat cycle , Configure to start the cluster heartbeat ,Mycat Actively detect master-slave delay and high availability master-slave handover
"initialDelay": 30,
"period":5,
"timeUnit":"SECONDS"
},
readBalanceName:"BALANCE_ALL",
writeBalanceName:"BALANCE_ALL",
}
# Field meaning
# clusterType: Cluster type , Optional value SINGLE_NODE: Single node ,MASTER_SLAVE: Common master and slave ,GARELA_CLUSTER:garela cluster/PXC colony ,MHA:MHA colony ,MGR:MGR colony
# readBalanceType: Query load balancing policy
Optional value :
BALANCE_ALL( The default value is )
Get all data sources in the cluster
BALANCE_ALL_READ
Get the data sources that are allowed to be read in the cluster
BALANCE_READ_WRITE
Get the data sources that are allowed to read and write in the cluster , But data sources that are allowed to read take precedence
BALANCE_NONE
Get the data sources that are allowed to write in the cluster , That is, select... From the master node
# switchType: Switch type
Optional value :
NOT_SWITCH: No master-slave switching
SWITCH: Switch between master and slave
Official website :mycat file
5. Logical library table (schema)
Configure logical library table , Realize the sub database and sub table , stay conf/schemas route
stay mycat Create a logic library in , It will generate a corresponding schema file
Command mode :{ Library name }.schema.json

vim mysql.schema.json
# Library Configuration
{
"schemaName": "mydb",
"targetName": "prototype"
}
# schemaName: Logical library name
# targetName: Destination data source or cluster ,targetName Automatically from prototype Target load test The physical table or view under the library is regarded as a single table ,prototype Must be mysql The server
# Single table configuration
{
"schemaName": "mysql-test",
"normalTables": {
"role_edges": {
"createTableSQL":null,// Optional
"locality": {
"schemaName": "mysql",// Physics library , Optional
"tableName": "role_edges",// Physical watch , Optional
"targetName": "prototype"// Point to cluster , Or data sources
}
}
......
# See sub database and sub table for detailed configuration
边栏推荐
- Multi merchant mall system function disassembly lecture 13 - platform side member management
- Multi merchant mall system function disassembly lecture 04 - platform side merchants settling in
- Loss after cosine annealing decay of learning rate
- Two architectures of data integration: ELT and ETL
- jupyter notebook一直自动重启(The kernel appears to have died. It will restart automatically.)
- 多商户商城系统功能拆解10讲-平台端商品单位
- Erp+rpa opens up the enterprise information island, and the enterprise benefits are doubled
- Too many database connections
- Machine learning (zhouzhihua) Chapter 1 Introduction notes learning experience
- Mysqldump export Chinese garbled code
猜你喜欢
![Use streaming media to transfer RSTP to the Web terminal for playback (II) [review]](/img/b9/2c0e6eb19acaa2356ff49f6e272826.png)
Use streaming media to transfer RSTP to the Web terminal for playback (II) [review]

如何在网页上下载视频

What do programmers often mean by API? What are the API types?

Chapter IV decision tree summary

电商系统PC商城模块介绍

PDF文本合并

西瓜书/南瓜书--第1,2章总结

Delete the weight of the head part of the classification network pre training weight and modify the weight name

多商户商城系统功能拆解09讲-平台端商品品牌

《机器学习》(周志华) 第5章 神经网络 学习心得 笔记
随机推荐
Multi merchant mall system function disassembly lecture 09 - platform end commodity brands
[activiti] activiti introduction
Numpy cheatsheet
PDF文本合并
Numpy array broadcast rule memory method array broadcast broadcast principle broadcast mechanism
How to quickly recover data after MySQL misoperation
Multi merchant mall system function disassembly lecture 13 - platform side member management
Recommend a fully open source, feature rich, beautiful interface mall system
字符串方法以及实例
《统计学习方法(第2版)》李航 第十三章 无监督学习概论 思维导图笔记
[activiti] Introduction to activiti
统计信号处理小作业——瑞利分布噪声中确定性直流信号的检测
多商户商城系统功能拆解10讲-平台端商品单位
对ArrayList<ArrayList<Double>>排序
电商系统PC商城模块介绍
Add se channel attention module to the network
Multi merchant mall system function disassembly lecture 06 - platform side merchant settlement agreement
Chapter 5 neural network
@Async does not execute asynchronously
Statistical learning methods (2nd Edition) Li Hang Chapter 22 summary of unsupervised learning methods mind mapping notes