当前位置:网站首页>[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
边栏推荐
- 【USB Host】STM32H7 CubeMX移植带FreeRTOS的USB Host读取U盘,USBH_Process_OS卡死问题,有个值为0xA5A5A5A5
- Multi merchant mall system function disassembly lecture 09 - platform end commodity brands
- Machine learning (zhouzhihua) Chapter 2 model selection and evaluation notes learning experience
- Too many database connections
- What do programmers often mean by API? What are the API types?
- likeshop单商户商城系统搭建,代码开源无加密
- vscode 多行注释总是会自动展开的问题
- ‘Results do not correspond to current coco set‘
- systemctl + journalctl
- 《统计学习方法(第2版)》李航 第16章 主成分分析 PCA 思维导图笔记 及 课后习题答案(步骤详细)PCA 矩阵奇异值 第十六章
猜你喜欢

LSTM神经网络

jestson安装ibus输入法

Are you still trying to limit MySQL paging?

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

如何解决训练集和测试集的分布差距过大问题

关于卷积神经网络中的“输入通道”和“输出通道”的概念

多商户商城系统功能拆解04讲-平台端商家入驻

谷歌/火狐浏览器管理后台新增账号时用户名密码自动填入的问题

tensorflow和pytorch框架的安装以及cuda踩坑记录

Add se channel attention module to the network
随机推荐
likeshop | 单商户商城系统代码开源无加密-PHP
"Statistical learning methods (2nd Edition)" Li Hang Chapter 13 introduction to unsupervised learning mind map notes
快速打开管理工具的命令
What do programmers often mean by API? What are the API types?
PDF文本合并
[activiti] activiti system table description
《统计学习方法(第2版)》李航 第十三章 无监督学习概论 思维导图笔记
Recommend a fully open source, feature rich, beautiful interface mall system
【树莓派4B】七、远程登录树莓派的方法总结XShell,PuTTY,vncServer,Xrdp
《统计学习方法(第2版)》李航 第15章 奇异值分解 SVD 思维导图笔记 及 课后习题答案(步骤详细)SVD 矩阵奇异值 十五章
Numpy数组广播规则记忆方法 array broadcast 广播原理 广播机制
GCC 中__attribute__((constructor)和__attribute__(((destructor))的注意事项。
A small problem in labelme to VOC code
How to quickly connect CRM system and ERP system to realize the automatic flow of business processes
PyTorch 单机多卡分布式训练
How to quickly recover data after MySQL misoperation
Problems in SSM project configuration, various dependencies, etc. (for personal use)
《统计学习方法(第2版)》李航 第22章 无监督学习方法总结 思维导图笔记
Likeshop single merchant SaaS mall system opens unlimited
Multi merchant mall system function disassembly lecture 06 - platform side merchant settlement agreement