In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to achieve heterogeneous data synchronization in MySQL database, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
When the levelDB is mounted into the MySQL engine, it is found that when the actual storage is in key-value format, the heterogeneous data synchronization of MySQL can be simpler and more general.
Take tair as an example, briefly describe a scheme based on MySQL.
The so-called heterogeneous data synchronization means that the application only updates MySQL, and some back-end mechanisms apply these updates to other data storage services.
1. MySQL-Tair engine
A) use
B) description
This is not a "storage engine", but the data is actually stored on the tair server. When you execute insert/update/delete, you simply send the corresponding action put / remove to the tair server. Of course, this process is transparent to the user.
2. How is the MySQL-Tair engine used to update tair data
First, there are two ways to update data, synchronous update and asynchronous update.
A) Asynchronous updates
Let's start with asynchronous updates. This is similar to the "read binlog to update data" solution. If you use the MySQL-Tair engine, the structure can be as follows:
Note: the tair table exists only on Slave and has the same name as the table to be updated on the main library.
Completeness: with the binglog structure of the main library in row format as the background, the complete line information of this update will be received on the Slave, from which the required key and value can be extracted.
B) synchronous updates
Synchronous update means that the MySQL is updated on the application side. After the MySQL and tair are updated at the same time, the MySQL returns the user's update successfully.
This mode is more like using tair as a network-level caching service for MySQL. Of course, when reading, the application can bypass MySQL and directly access tair, but only as an update scheme.
This mode allows the next updated access to directly hit the cached data in the tair. Asynchronism is not guaranteed.
The structure is as follows:
Description: here the entity data table and the tair table are in the same database, the table structure is the same, and the engine is different. Apply or update the data table, and update the tair table with the same statement triggered by the trigger.
Completeness: similarly, the trigger gets the full value of the new row for this update.
3. Advantages of MySQL synchronization
This has the following advantages, even if only asynchronous update mode is considered:
A) there is no need to simulate a slave library of a MySQL database and no need to maintain a connection (MySQL comes with it)
B) there is no need to parse binlog (care should be paid to when binlog is switched, there are too many things to do)
C) more convenient monitoring. The existing monitoring interface of MySQL database can directly get tps, delay time and synchronization point.
D) more convenient management If the main library is down, a Change master command can be used; if you want to temporarily stop updating, stop slave, start slave.
E) more convenient expansion. Directly use the cascade master-slave of MySQL database.
Of course, there are synchronization options that cannot be achieved by reading binlog.
4. Other
Not limited to tair, just examples.
If the back end is a reliable storage, such as TFS, it can be used as a storage table, and both reads and writes are SQL interfaces. What's the difference between updating TFS directly? To put it simply, you can do join operations directly with the entity table in MySQL.
The above is how to synchronize heterogeneous data in MySQL database. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.