当前位置:网站首页>MYCAT read / write separation configuration
MYCAT read / write separation configuration
2022-07-29 03:06:00 【ELIAUK``】
Why use MyCat
Now with the development of the Internet , The magnitude of the data also supports the exponential growth , from GB To TB To PB. It is also more difficult to operate data , The traditional relational database can not meet the needs of fast query and data insertion . This is the time NoSQL The emergence of a temporary solution to the crisis . It reduces data security , Reduce support for transactions , Reduce support for complex queries , To get performance improvements . however , On some occasions NoSQL Some trade-offs are not enough for use scenarios , For example, some usage scenarios must have transaction and security indicators . This is the time NoSQL It must be unsatisfied , So you still need to use a relational database . How to use relational database to solve the problem of mass storage ? At this point, we need to do database clustering , In order to improve query performance, the data of a database is distributed to different databases for storage , In response to this problem came ——MyCat
At the same time, read-write separation can also be used , Solve a single problem , Separate the lines , The pressure will not be so great , If one goes down , The other one can continue to run , At the same time, it can also build a read-write separation master-slave , One is responsible for reading , One is responsible for writing , If one goes down , The other one reads and writes , If it's restored , Then use it normally
mycat Read write separation deployment
Move installation package to /data Inside
tar xvf Mycat-server-1.6.6.1-release-20031195535-linux.tar.gz # decompression bin --- Startup file
catlet --- It's not what it takes.
conf --- Initial profile , Including read-write separation, etc., are configured here
cd bin ./mycat start start-up mycat After failure
# install java yum install javanetstat -tnlp Check whether it is opened successfully 8066 It's success / You can also use
ps -ef | grep mycatGet into conf Configure two main files ,schema.xml and server.xml
First configuration schema.xml( In which TESTDB working principle : Several database connections mycat Then the client also connects mycat, It's mainly about pretending to be a database , Because our development is mainly connected to this fake database , And then distribute it to the real , It's safer )
Connect to database :mysql -uuser -p -P8066 -h127.0.0.1 password :user

Read / write separation :1 Owners 1 From the , When the user reads , The connection is below S, If it is written, it is connected to the above one M, Generally, when this architecture is used, the pressure on the database is relatively high , The database can't handle , There's a bottleneck , Will use read-write separation , Read and write separately , If the pressure is still high , Will be adding a slave , It becomes 2 The desk is responsible for reading ,1 Desk writing , Generally, reading is stressful . So high availability and load balancing can depend on your needs
Check whether the database can execute 1 Lord 2 from
show slave status\GTo write schema.xml The configuration file
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="gpsdb2020" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn2"></schema>
<schema name="zhangsan" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn3"></schema>
<dataNode name="dn2" dataHost="localhost1" database="gpsdb2020" />
<dataNode name="dn3" dataHost="localhost1" database="zhangsan" />
<dataHost name="localhost1" maxCon="500" minCon="20" balance="1" writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<writeHost host="master" url="192.168.174.133:3306" user="rep" password="123456">
<readHost host="slave" url="192.168.174.143:3306" user="rep" password="123456" />
</writeHost>
</dataHost>
</mycat:schema> Modify here :

To configure server.xml
<user name="admin">
<property name="password">admin</property>
<property name="schemas">gpsdb2020,zhangsan</property>
</user>
Save startup ./mycat stop ./mycat start
边栏推荐
- VASP calculation task error: M_ divide:can not subdivide 8 nodes by 6
- 单例模式(饿汉式 懒汉式)
- Chapter 2 VRP command line
- 【机器人学习】机械臂抓手matlab运动学与admas动力学分析
- 万字详解 Google Play 上架应用标准包格式 AAB
- C traps and defects Chapter 3 semantic "traps" 3.1 pointers and arrays
- 照片比例校正工具:DxO ViewPoint 3 直装版
- C陷阱与缺陷 第2章 语法“陷阱” 2.6 “悬挂”else引发的问题
- Typescript学习(一)
- Navicat new database
猜你喜欢

Analysis of Project-based Learning Creativity in steam Education

Mongodb index (3)

MySQL compound query (important)

Plato Farm在Elephant Swap上铸造的ePLATO是什么?为何具备高溢价?

【FreeSwitch开发实践】UniMRCP编译与安装

Detailed steps for installing MySQL 8.0 under Linux

13_ue4进阶_蒙太奇动画实现一边走一边攻击

会议OA项目之我的审批功能

【打开新世界大门】看测试老鸟如何把API 测试玩弄在鼓掌之间

Hangao database best practice configuration tool Hg_ BP log collection content
随机推荐
Shell编程规范与变量
工科男生:20岁未满,平凡但不平庸
C traps and defects Chapter 3 semantic "traps" 3.4 avoid "couple method"
Object转String的几种方法
vasp计算任务报错:M_divide:can not subdivide 8 nodes by 6
Feedback function of conference OA
融云 IM & RTC 能力上新盘点
My approval function of conference OA project
2022-07-28 第四小组 修身课 学习笔记(every day)
万字详解 Google Play 上架应用标准包格式 AAB
带你来浅聊一下,单商户功能模块汇总
12_ UE4 advanced_ Change a more beautiful character model
13_ UE4 advanced_ Montage animation realizes attack while walking
百度副总裁李硕:数字技术加持下中国劳动力成本上升是好事
C traps and defects Chapter 3 semantic "traps" 3.9 integer overflow
shell脚本总结
接口自动化测试实践指导(上):接口自动化需要做哪些准备工作
HTB-Blue
从零开始实现lmax-Disruptor队列(六)Disruptor 解决伪共享、消费者优雅停止实现原理解析
C language small project - address book (static version + dynamic version + file version)