WO2019242115A1 - 一种数据同步系统及方法 - Google Patents

一种数据同步系统及方法 Download PDF

Info

Publication number
WO2019242115A1
WO2019242115A1 PCT/CN2018/105004 CN2018105004W WO2019242115A1 WO 2019242115 A1 WO2019242115 A1 WO 2019242115A1 CN 2018105004 W CN2018105004 W CN 2018105004W WO 2019242115 A1 WO2019242115 A1 WO 2019242115A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
data
sql
preset
log
Prior art date
Application number
PCT/CN2018/105004
Other languages
English (en)
French (fr)
Inventor
林水明
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019242115A1 publication Critical patent/WO2019242115A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application belongs to the field of computer technology, and particularly relates to a data synchronization system and method.
  • embodiments of the present application provide a data synchronization system and method to solve the problems that the prior art is prone to confusion and errors in the data synchronization process and occupies a large amount of storage space.
  • a first aspect of the embodiments of the present application provides a data synchronization system, which may include a global subsystem and regional subsystems respectively deployed in various regions;
  • the global subsystem is used to synchronize global data.
  • the global data is data shared between various regions.
  • the global subsystem includes a first database set and at least one second database set. Each region has at most Deploying one of the first database set or one of the second database set;
  • the first database set includes a first database and at least one second database, the first database is used for data service of the global data, and the second database is used for data backup of the first database ;
  • the second database set includes a third database and at least one fourth database, the third database is used for data backup of the first database, and the fourth database is used for data of the third database Backup
  • the regional subsystem is used to synchronize regional data.
  • the regional data is data shared within a single region.
  • the regional subsystem includes a fifth database and at least one sixth database.
  • the fifth database is used for Perform data service on the area data
  • the sixth database is used to perform data backup on the fifth database.
  • a second aspect of the embodiments of the present application provides a data synchronization method, which is applied to the foregoing data synchronization system, and is characterized by including:
  • the first database executes the received SQL instruction, and records the SQL instruction in a locally preset first log;
  • the second database reads the SQL instruction from the first log through an I / O thread, writes the read SQL instruction into a second preset log locally, and executes the SQL instruction through the SQL thread. SQL instructions.
  • the data synchronization method may further include:
  • the second database sends a preset data packet to the first database, and receives feedback information sent by the first database. If the feedback information is not received within a preset first time interval, the second database sends A preset routing controller sends a routing configuration request;
  • the routing controller After receiving the routing configuration request sent by the second database, the routing controller modifies a physical IP address corresponding to the first virtual IP address in the routing configuration table to a physical IP address of the second database.
  • the routing configuration table records a physical IP address corresponding to the first virtual IP address, and the first virtual IP address is an IP address provided to the outside by the global subsystem.
  • the data synchronization system provided in the embodiment of the present application includes a global subsystem and regional subsystems respectively deployed in each region.
  • the global subsystem is used to synchronize global data, and the global data is shared among the regions.
  • Data due to the high security requirements of global data, this embodiment of the present application uses multiple backups in the form of a database set in multiple regions, where only a single database (that is, the first in the first database set) is provided. Database) to perform global data data service, while the second database in the first database collection performs local data synchronization backup, and the second database collection in other regions performs remote data synchronization backup, of which the fourth database is the third
  • the database provides local data synchronization backup, and a clear synchronization backup chain is constructed.
  • the area subsystem is used to synchronize area data.
  • the area data is data shared within a single area. Due to the low security requirements of the area data, this embodiment of the present application uses multiple databases in the area to A scheme for synchronous backup, in which each region provides only a single database (ie the fifth database) for data service of regional data, while other databases (ie the sixth database) only perform local data synchronization backup without the need for Redistribution of remote data synchronization backups in other regions greatly reduces the consumption of system resources.
  • FIG. 1 is a schematic block diagram of a data synchronization system according to an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a data synchronization process between a second database and a first database
  • FIG. 3 is a schematic diagram of automatic switching between a master database and a slave database between a second database and a first database
  • FIG. 4 is a schematic flowchart of a data synchronization process between a second database and a first database
  • FIG. 5 is a schematic flowchart of automatic switching between a master database and a slave database between the second database and the first database.
  • An embodiment of a data synchronization system in the embodiments of the present application may include a global subsystem and regional subsystems respectively deployed in various regions.
  • FIG. 1 shows an example of the data synchronization system.
  • the global subsystem is used to synchronize global data.
  • the global data is data shared between various regions.
  • the global data includes, but is not limited to, contact data, alarm configuration data, and alarm record data.
  • the global subsystem includes more than two database sets. Specifically, the global subsystem includes a first database set and at least one second database set. Taking FIG. 1 as an example, database set 1 is the first database set, and database set 2 is the second database set. The figure only illustrates the scenario of deploying one of the second database sets. In an application, a plurality of the second database sets may be deployed according to actual conditions. Each region can deploy a maximum of one database collection, that is, one database collection (the first database collection or the second database collection) can be deployed in any region, or the database collection can not be deployed.
  • the first database set includes a first database and at least one second database, and the first database is used to perform data service on the global data, that is, a user adds, deletes, or modifies global data. This is done through interaction with the first database.
  • the second database is used to perform data backup on the first database.
  • the second database set includes a third database and at least one fourth database, the third database is used for data backup of the first database, and the fourth database is used for data of the third database Backup.
  • database 1 is the first database
  • database 2 is the second database
  • database 3 is the third database
  • database 4 is the fourth database.
  • Only one of the second databases is deployed in the first database set.
  • a plurality of the second databases may be deployed according to actual conditions.
  • only one of the second databases is deployed in the second database set.
  • the fourth database is described. In practical applications, a plurality of the fourth databases may be deployed according to actual conditions.
  • the area subsystem is used to synchronize area data.
  • the area data is data shared within a single area.
  • the area data includes, but is not limited to, the monitoring item index reported by the area, and the monitoring configuration of the area.
  • Each region has its own regional subsystem.
  • the regional subsystem includes a fifth database and at least a sixth database.
  • the fifth database is used to perform data service on the regional data. Operations such as adding, modifying, deleting, and querying the area data of the area are completed through interaction with the fifth database.
  • the sixth database is configured to perform data backup on the fifth database.
  • FIG. 1 Take Figure 1 as an example. There are three areas in this figure. Among them, area subsystem 1 is deployed in area 1, area subsystem 2 is deployed in area 2, area subsystem 3 is deployed in area 3, and the database is deployed. 5 is the fifth database in regional subsystem 1, database 6 is the sixth database in regional subsystem 1, database 7 is the fifth database in regional subsystem 2, and database 8 is For the sixth database in the regional subsystem 2, the database 9 is the fifth database in the regional subsystem 3, and the database 10 is the sixth database in the regional subsystem 3. In the figure, only one sixth database is deployed in each regional subsystem. In actual applications, multiple sixth databases may be deployed according to actual conditions.
  • the first database is further configured to execute the received SQL instruction and record the SQL instruction in a locally preset first log.
  • the SQL is an instruction for a user to add, delete, or modify global data.
  • the second database is further configured to read the SQL instruction from the first log through an I / O thread, write the read SQL instruction to a locally preset second log, and pass the SQL thread Executing the SQL instruction.
  • the first database and the second database may have a master-slave relationship with each other, that is, each database is both a master of another database and a SLAVE of another database.
  • any one database does Changes (for example, adding data, deleting data, modifying data, etc.) will be synchronized to another database.
  • database 1 will record the changed SQL command to a local log, and the I / O thread of database 2 reads the SQL command from the log of database 1.
  • the SQL thread of database 2 will read the log and execute the SQL instructions in it, so that the data changes in database 1 will be synchronized to database 2.
  • database 2 will record the changed SQL instruction in a local log; the I / O thread of database 1 reads the SQL instruction from the log of database 2 Write it to its local log, and then the SQL thread of database 1 will read the log and execute the SQL instructions in it, so that the data changes in database 2 are synchronized to database 1.
  • the database identifier of the current database is recorded in the log, and the database identifier can be used to easily determine from which database a change was originally generated, thereby avoiding a cycle. The case of replication.
  • the third database and the fourth database may also adopt the above-mentioned mutual master-slave relationship.
  • the third database is further configured to execute the received SQL instruction and record the SQL instruction in a locally preset first log.
  • the fourth database is further configured to read the SQL instruction from the first log through an I / O thread, write the read SQL instruction to a second preset log locally, and pass the SQL thread Executing the SQL instruction.
  • the fifth database and the sixth database may also adopt the above-mentioned interactions. Master-slave relationship.
  • the fifth database is further configured to execute the received SQL instruction and record the SQL instruction in a locally preset first log.
  • the SQL is an instruction for the user to perform operations such as adding, deleting, and modifying the regional data.
  • the sixth database is further configured to read the SQL instruction from the first log through an I / O thread, write the read SQL instruction to a locally preset second log, and pass the SQL thread Executing the SQL instruction.
  • the first database and the third database can only adopt a one-way master-slave relationship, that is, the first database is the master of the third database, and the third database is SLAVE of the first database.
  • the first database is further configured to execute the received SQL instructions and record the SQL instructions in a locally preset first log.
  • the third database is further configured to read the SQL instruction from the first log through an I / O thread, write the read SQL instruction to a second preset log locally, and pass the SQL thread Executing the SQL instruction.
  • Specific fault detection can be performed through heartbeat detection.
  • a data packet can be sent to a database that provides SQL services externally at regular intervals. If the database does not respond within a predetermined period of time, it is considered to be a failure and automatically switched to another hot standby.
  • Database to provide external SQL services Or, a database that provides SQL services to the outside can periodically send a data packet to another hot standby database to inform that its service is normal. When the hot standby database does not receive the packet within a specified time, it will consider it to be faulty and automatically Switch to the hot standby database to provide external SQL services.
  • the automatic switching between databases is implemented by means of a virtual IP.
  • IP address is an abstraction of the host hardware address.
  • the MAC address is a physical address and the IP address is a logical address.
  • a virtual IP is an IP that is not assigned to a real host. That is to say, a host providing services to the outside has a virtual IP in addition to a real IP. You can use either of these two IPs to connect to this host.
  • ARP is an address resolution protocol. Its role is to convert an IP address to a MAC address and then use it for the transport layer.
  • Each host has an ARP cache, which stores the correspondence between the IP address and the MAC address in the same network. When the host on the Ethernet sends data, it will first query the MAC address corresponding to the target IP from this cache and will send the This MAC address sends data. The operating system will automatically maintain this cache.
  • the actual host IP of database A is IP1
  • the actual host IP of database B is IP2
  • database A is used as a database for external services
  • database B is used as a hot standby database.
  • database B learns that database A fails through heartbeat detection, it will Send its own ARP cache, let the router modify the routing table, and tell the virtual address should point to its actual host IP (that is, IP2).
  • database B will become a database for external services.
  • Database A becomes the hot standby database. This completes the automatic switching of the master-slave database, which is transparent to the outside world.
  • the data synchronization system in this embodiment may further include a routing controller, where the routing controller is configured to modify a preset routing configuration table, and the routing configuration table records a physical IP corresponding to the first virtual IP address Address, the first virtual IP address is an IP address provided to the outside by the global subsystem.
  • the second database is further configured to send a preset data packet to the first database, and receive feedback information sent by the first database. After receiving the feedback information, a routing configuration request is sent to the routing controller.
  • the routing controller is further configured to modify the physical IP address corresponding to the first virtual IP address in the routing configuration table to the second database after receiving the routing configuration request sent by the second database. Physical IP address.
  • the routing configuration table also records physical IP addresses corresponding to respective second virtual IP addresses, and the second virtual IP addresses are IP addresses provided by the area subsystem to the outside.
  • the sixth database is further configured to send a preset data packet to the fifth database and receive feedback information sent by the fifth database. If the feedback information is not received within the first time interval, Sending a routing configuration request to the routing controller.
  • the routing controller is further configured to modify the physical IP address corresponding to the second virtual IP address in the routing configuration table to the sixth database after receiving the routing configuration request sent by the sixth database. Physical IP address.
  • the third database is further configured to send a preset data packet to the first database, and receive feedback information sent by the first database, if all the data is not received within a preset second time interval.
  • the feedback information a routing configuration request is sent to the routing controller.
  • the second time interval should be greater than the first time interval, so that when the first database fails, the second database will be preferentially switched to, and only when all databases in the first database set appear When the fault occurs, the three databases will be switched.
  • the routing controller is further configured to modify the physical IP address corresponding to the first virtual IP address in the routing configuration table to the third database after receiving the routing configuration request sent by the third database. Physical IP address.
  • this embodiment uses an incremental primary key for each database. Discontinuous scheme, specifically, the primary key of the data record in any database is:
  • d is the serial number of the database
  • 1 ⁇ d ⁇ DataBaseNum DataBaseNum is the total number of the database
  • r is the serial number of the data record
  • PerimaryKeyd r is the primary key value of the data record of the serial number r in the database of serial number d .
  • serial numbers of the four databases are set to 1-4, among which, the serial number of database 1 is set to 1 (then its primary key value will be 1 in order. , 5, 9, 13, 17, %), the sequence number of database 2 is set to 2 (then its primary key value will be 2, 6, 10, 14, 18, %), and the sequence number of database 3 is set to 4 (Then its primary key value will be 3, 7, 11, 15, 19, ...), and the serial number of database 4 is set to 4 (then its primary key value will be 4, 8, 12, 16, 20, ... ...), So you can effectively avoid primary key conflicts.
  • the data synchronization system provided in the embodiment of the present application includes a global subsystem and regional subsystems respectively deployed in various regions.
  • the global subsystem is used to synchronize global data.
  • this embodiment of the present application uses multiple backups in the form of a database collection in multiple regions, where only a single database (that is, the first database) is provided.
  • the first database in the collection to perform global data data services, while the second database in the first database collection performs local data synchronization backup, and the second database collection in other regions performs remote data synchronization backup, of which the fourth
  • the database also provides a local data synchronization backup for the third database, and a clear synchronization backup chain is constructed to ensure data security while avoiding confusion and errors in the data synchronization process.
  • the area subsystem is used to synchronize area data.
  • the area data is data shared within a single area.
  • this embodiment of the present application uses multiple databases in the area to A scheme for synchronous backup, in which each region provides only a single database (ie the fifth database) for data service of regional data, while other databases (ie the sixth database) only perform local data synchronization backup without the need for Redistribution of remote data synchronization backups in other regions greatly reduces the consumption of system resources.
  • an embodiment of the present application further provides a data synchronization method, and the method is applied to the data synchronization system described in the foregoing embodiments.
  • the data synchronization method may include:
  • Step S401 The first database executes the received SQL instruction, and records the SQL instruction in a locally preset first log.
  • Step S402 The second database reads the SQL instruction from the first log through an I / O thread, writes the read SQL instruction into a locally preset second log, and passes the SQL thread Executing the SQL instruction.
  • the data synchronization process between the fourth database and the third database may include:
  • the third database executes the received SQL instruction, and records the SQL instruction in a locally preset first log;
  • the fourth database reads the SQL instruction from the first log through an I / O thread, writes the read SQL instruction into a second preset log locally, and executes the SQL instruction through the SQL thread SQL instructions.
  • the data synchronization process between the fifth database and the sixth database may include:
  • the fifth database executes the received SQL instructions, and records the SQL instructions in a locally preset first log.
  • the SQL is an instruction for the user to perform operations such as adding, deleting, and modifying the regional data.
  • the sixth database reads the SQL instruction from the first log through an I / O thread, writes the read SQL instruction into a second preset log locally, and executes the SQL instruction through the SQL thread SQL instructions.
  • the data synchronization process between the first database and the third database may include:
  • the first database executes the received SQL instructions and records the SQL instructions in a locally preset first log.
  • the third database reads the SQL instruction from the first log through an I / O thread, writes the read SQL instruction into a second preset log locally, and executes the SQL instruction through the SQL thread SQL instructions.
  • the data synchronization method may further include:
  • Step S501 The second database sends a preset data packet to the first database, and receives feedback information sent by the first database.
  • Step S502 If the second database does not receive the feedback information within a preset first time interval, send a routing configuration request to a preset routing controller.
  • Step S503 After receiving the routing configuration request sent by the second database, the routing controller changes the physical IP address corresponding to the first virtual IP address in the routing configuration table to the physical IP address of the second database. .
  • the routing configuration table records a physical IP address corresponding to the first virtual IP address, and the first virtual IP address is an external IP address provided by the global subsystem.
  • the automatic switching process of the master-slave database between the first database and the third database may include:
  • the third database sends a preset data packet to the first database, and receives feedback information sent by the first database, and if the feedback information is not received within a preset second time interval, the third database
  • the routing controller sends a routing configuration request, and the second time interval is greater than the first time interval
  • the routing controller After receiving the routing configuration request sent by the third database, the routing controller changes the physical IP address corresponding to the first virtual IP address in the routing configuration table to the physical IP of the third database. address.
  • the automatic switching process of the master-slave database between the fifth database and the sixth database may include:
  • the sixth database sends a preset data packet to the fifth database, and receives feedback information sent by the fifth database, and if the feedback information is not received within the first time interval, the The routing controller sends a routing configuration request;
  • the routing controller After receiving the routing configuration request sent by the sixth database, the routing controller changes the physical IP address corresponding to the second virtual IP address in the routing configuration table to the physical IP of the sixth database. Addresses, and the routing configuration table also records physical IP addresses corresponding to respective second virtual IP addresses, and the second virtual IP addresses are IP addresses provided by the area subsystem to the outside.
  • d is the serial number of the database
  • 1 ⁇ d ⁇ DataBaseNum DataBaseNum is the total number of the database
  • r is the serial number of the data record
  • PerimaryKeyd r is the primary key value of the data record of the serial number r in the database of serial number d .

Abstract

本申请属于计算机技术领域,尤其涉及一种数据同步系统及方法。所述数据同步系统包括一个全局子系统以及分别部署在各个区域的区域子系统;所述全局子系统用于进行全局数据的同步,所述全局子系统包括一个第一数据库集合和至少一个第二数据库集合;所述第一数据库集合包括一个第一数据库和至少一个第二数据库,所述第一数据库用于对所述全局数据进行数据服务,所述第二数据库用于对所述第一数据库进行数据备份;所述第二数据库集合包括一个第三数据库和至少一个第四数据库,所述第三数据库用于对所述第一数据库进行数据备份,所述第四数据库用于对所述第三数据库进行数据备份;所述区域子系统用于进行区域数据的同步。

Description

一种数据同步系统及方法
本申请要求于2018年6月20日提交中国专利局、申请号为201810637155.4、发明名称为“一种数据同步系统及方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于计算机技术领域,尤其涉及一种数据同步系统及方法。
背景技术
在现有的数据库技术中,为了提高数据的安全性,往往采用在不同区域进行多个数据库备份的方案,但是这样的方案存在两个问题,一是由于涉及到多个数据库的协同,架构复杂,极易在数据同步过程中出现混乱和差错,二是占用了大量的存储空间,造成系统资源的浪费。
技术问题
有鉴于此,本申请实施例提供了一种数据同步系统及方法,以解决现有技术极易在数据同步过程中出现混乱和差错且占用了大量的存储空间的问题。
技术解决方案
本申请实施例的第一方面提供了一种数据同步系统,可以包括一个全局子系统以及分别部署在各个区域的区域子系统;
所述全局子系统用于进行全局数据的同步,所述全局数据为在各个区域之间共享的数据,所述全局子系统包括一个第一数据库集合和至少一个第二数据库集合,每个区域最多部署一个所述第一数据库集合或者一个所述第二数据库集合;
所述第一数据库集合包括一个第一数据库和至少一个第二数据库,所述第一数据库用于对所述全局数据进行数据服务,所述第二数据库用于对所述第一数据库进行数据备份;
所述第二数据库集合包括一个第三数据库和至少一个第四数据库,所述第三数据库用于对所述第一数据库进行数据备份,所述第四数据库用于对所述第三数据库进行数据备份;
所述区域子系统用于进行区域数据的同步,所述区域数据为在单个区域内部共享的数据,所述区域子系统包括一个第五数据库和至少一个第六数据库,所述第五数据库用于对所述区域数据进行数据服务,所述第六数据库用于对所述第五数据库进行数据备份。
本申请实施例的第二方面提供了一种数据同步方法,应用于上述的数据同步系统中,其特征在于,包括:
所述第一数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
所述第二数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
进一步地,所述数据同步方法还可以包括:
所述第二数据库向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第一时间间隔内未接收到所述反馈信息,则向预设的路由控制器发送路由配置请求;
所述路由控制器在接收到所述第二数据库发送的路由配置请求后,将路由配置表中与第一虚拟IP地址对应的物理IP地址修改为所述第二数据库的物理IP地址,所述路由配置表记录了与所述第一虚拟IP地址对应的物理IP地址,所述第一虚拟IP地址为所述全局子系统提供给外部的IP地址。
有益效果
本申请实施例提供的数据同步系统包括一个全局子系统以及分别部署在各个区域的区域子系统,所述全局子系统用于进行全局数据的同步,所述全局数据为在各个区域之间共享的数据,由于全局数据的安全要求较高,本申请实施例采用了在多个区域以数据库集合的形式对其进行多重备份,其中,只提供唯一的一个数据库(即第一数据库集合中的第一数据库)来进行全局数据的数据服务,而第一数据库集合中的第二数据库进行本地的数据同步备份,其它区域的第二数据库集合进行异地的数据同步备份,其中的第四数据库又为第三数据库提供本地数据同步备份,构建出了一个清晰的同步备份链条,在保证数据安全性的同时,又避免了在数据同步过程中出现混乱和差错。所述区域子系统用于进行区域数据的同步,所述区域数据为在单个区域内部共享的数据,由于区域数据的安全要求较低,本申请实施例采用了在本区域使用多个数据库对其进行同步备份的方案,其中,每个区域只提供唯一的一个数据库(即第五数据库)来进行区域数据的数据服务,而其它数据库(即第六数据库)只进行本地的数据同步备份,而无需在其它区域重新部署异地的数据同步备份,大大减少了对系统资源的消耗。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。
图1为本申请实施例中一种数据同步系统的一个示意框图;
图2为第二数据库与第一数据库之间的数据同步过程的示意图;
图3为第二数据库与第一数据库之间主从数据库自动切换的示意图;
图4为第二数据库与第一数据库之间的数据同步过程的示意流程图;
图5为第二数据库与第一数据库之间主从数据库自动切换的示意流程图。
本发明的实施方式
为使得本申请的发明目的、特征、优点能够更加的明显和易懂,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本申请一部分实施例,而非全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
本申请实施例中一种数据同步系统的一个实施例可以包括一个全局子系统以及分别部署在各个区域的区域子系统,图1所示为所述数据同步系统的一个实例。
所述全局子系统用于进行全局数据的同步,所述全局数据为在各个区域之间共享的数据,所述全局数据包括但不限于联系人数据、告警配置数据、告警记录数据等。
所述全局子系统包括两个以上的数据库集合,具体的,所述全局子系统包括一个第一数据库集合和至少一个第二数据库集合。以图1为例,数据库集合1即为所述第一数据库集合,数据库集合2即为所述第二数据库集合,该图中仅示意出了部署一个所述第二数据库集合的情景,在实际应用中,可以根据实际情况部署多个所述第二数据库集合。每个区域最多部署一个数据库集合,即在任意一个区域可以部署一个数据库集合(第一数据库集合或者第二数据库集合),也可以不部署数据库集合。
所述第一数据库集合包括一个第一数据库和至少一个第二数据库,所述第一数据库用于对所述全局数据进行数据服务,即用户对全局数据进行的增加、删除、修改等操作都是通过与所述第一数据库的交互来完成。所述第二数据库用于对所述第一数据库进行数据备份。
所述第二数据库集合包括一个第三数据库和至少一个第四数据库,所述第三数据库用于对所述第一数据库进行数据备份,所述第四数据库用于对所述第三数据库进行数据备份。
以图1为例,数据库1即为所述第一数据库,数据库2即为所述第二数据库,数据库3即为所述第三数据库,数据库4即为所述第四数据库,该图中,第一数据库集合中只部署了一个所述第二数据库,在实际应用中,可以根据实际情况部署多个所述第二数据库,同样地,该图中,第二数据库集合中只部署了一个所述第四数据库,在实际应用中,可以根据实际情况部署多个所述第四数据库。
所述区域子系统用于进行区域数据的同步,所述区域数据为在单个区域内部共享的数据,所述区域数据包括但不限于区域上报的监控项索引、区域的监控配置等。
每个区域中均部署了各自的区域子系统,所述区域子系统包括一个第五数据库和至少一个第六数据库,所述第五数据库用于对所述区域数据进行数据服务,即用户对该区域的区域数据进行的增添、修改、删除、查询等操作都是通过与所述第五数据库的交互来完成。所述第六数据库用于对所述第五数据库进行数据备份。
以图1为例,该图中共有3个区域,其中,在区域1中部署了区域子系统1,在区域2中部署了区域子系统2,在区域3中部署了区域子系统3,数据库5即为区域子系统1中的所述第五数据库,数据库6即为区域子系统1中的所述第六数据库,数据库7即为区域子系统2中的所述第五数据库,数据库8即为区域子系统2中的所述第六数据库,数据库9即为区域子系统3中的所述第五数据库,数据库10即为区域子系统3中的所述第六数据库。该图中,每个区域子系统中只部署了一个所述第六数据库,在实际应用中,可以根据实际情况部署多个所述第六数据库。
进一步地,如图2所示,所述第一数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。所述SQL即为用户对全局数据进行的增加、删除、修改等操作的指令。
所述第二数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
通过如图2所示的这一过程,实现了所述第二数据库与所述第一数据库之间的数据同步,或者说,实现了所述第二数据库对所述第一数据库的数据备份。
可选地,所述第一数据库和所述第二数据库之间可以互为主从关系,即每个数据库既是另一个数据库的MASTER,又是另一个数据库的SLAVE,这样,任何一个数据库所做的变更(例如,增加数据,删除数据,修改数据等等),都会同步到另外一个数据库中。例如,若数据库1中的数据发生了变更,则数据库1会将本次变更的SQL指令记录到一个本地的日志中,数据库2的I/O线程从数据库1的日志中读取该SQL指令,写入自己本地的日志中,然后数据库2的SQL线程会读取该日志,并执行其中的SQL指令,这样,数据库1中的数据变更就同步到了数据库2中。
类似地,若数据库2中的数据发生了变更,则数据库2会将本次变更的SQL指令记录到本地的日志中;数据库1的I/O线程从数据库2的日志中读取该SQL指令,写入自己本地的日志中,然后数据库1的SQL线程会读取该日志,并执行其中的SQL指令,这样,数据库2中的数据变更就同步到了数据库1中。
由上述过程可见,任意一个数据库上执行过的SQL指令在另一个数据库上也会重复执行一遍,这样,只要两个数据库的初始状态是一致的,两者即可一直保持同步。
进一步地,为了避免两个数据库之间的循环复制,在日志中记录了当前数据库的数据库标识,通过该数据库标识即可很容易判断某个变更是从哪一个数据库最初产生的,从而避免出现循环复制的情况。
所述第三数据库和所述第四数据库之间(例如,图1中的数据库3和数据库4之间)也可以采取上述的互为主从的关系。
所述第三数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。
所述第四数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
所述第五数据库和所述第六数据库之间(例如,图1中的数据库5和数据库6之间,数据库7和数据库8之间,数据库9和数据库10之间)也可以采取上述的互为主从的关系。
所述第五数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。所述SQL即为用户对区域数据进行的增加、删除、修改等操作的指令。
所述第六数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
但需要注意的是,所述第一数据库和所述第三数据库之间只能采用单向主从的关系,即所述第一数据库为所述第三数据库的MASTER,所述第三数据库为所述第一数据库的SLAVE。
所述第一数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。
所述第三数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
正常情况下,互为主从关系的两个数据库中只有一个数据库对外提供SQL服务,另一个作为热备,当对外提供SQL服务的数据库出现故障时,自动切换到另一个热备的数据库来对外提供SQL服务。
具体的故障检测可以通过心跳检测来进行,例如,可以定时向对外提供SQL服务的数据库发送一个数据包,如果该数据库在预定时间内未反应,则认为是发生故障,自动切换到另一个热备的数据库来对外提供SQL服务。或者向对外提供SQL服务的数据库可以定时的给另一个热备的数据库发送数据包,告知其服务正常,当热备数据库在规定时间内没有收到该数据包,就会认为其发生故障,自动切换到热备的数据库来对外提供SQL服务。
本方案中通过虚拟IP的方式来实现数据库间的自动切换,在TCP/IP的架构下,所有联网的设备,不论是用何种方式连上网路,都必须要有一个唯一的IP地址。事实上IP地址是主机硬件地址的一种抽象,MAC地址是物理地址,IP地址是逻辑地址。虚拟IP,就是一个未分配给真实主机的IP,也就是说对外提供服务的主机除了有一个真实IP外还有一个虚拟IP,使用这两个IP中的任意一个都可以连接到这台主机。
ARP是地址解析协议,它的作用是将一个IP地址转换为MAC地址,然后给传输层使用。每台主机中都有一个ARP高速缓存,存储同一个网络内的IP地址与MAC地址的对应关系,以太网中的主机发送数据时会先从这个缓存中查询目标IP对应的MAC地址,会向这个MAC地址发送数据。操作系统会自动维护这个缓存。
假设数据库A的实际主机IP是IP1,数据库B的实际主机IP是IP2,数据库A作为对外服务的数据库,数据库B作为热备数据库,当数据库B通过心跳检测得知数据库A发生故障时,会将自己的ARP缓存发送出去,让路由器修改路由表,告知虚拟地址应该指向自己的实际主机IP(即IP2),这时候,当外界再次访问虚拟IP的时候,数据库B会变成对外服务的数据库,而数据库A成为热备数据库。这就完成了主从数据库的自动切换,这一切对外界是透明的。
通过这样的方式,无论是哪一个数据库出现故障,其对外提供的服务均不会受到影响。
基于上述思想,本实施例中的数据同步系统还可以包括路由控制器,所述路由控制器用于修改预设的路由配置表,所述路由配置表记录了与第一虚拟IP地址对应的物理IP地址,所述第一虚拟IP地址为所述全局子系统提供给外部的IP地址。
如图3所示,所述第二数据库还用于向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求。
所述路由控制器还用于在接收到所述第二数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第二数据库的物理IP地址。
类似地,所述路由配置表还记录了分别与各个第二虚拟IP地址对应的物理IP地址,所述第二虚拟IP地址为所述区域子系统提供给外部的IP地址。
所述第六数据库还用于向所述第五数据库发送预设的数据包,并接收所述第五数据库发送的反馈信息,若在所述第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求。
所述路由控制器还用于在接收到所述第六数据库发送的路由配置请求后,将所述路由配置表中与所述第二虚拟IP地址对应的物理IP地址修改为所述第六数据库的物理IP地址。
特殊地,若所述第一数据库集合中的所有数据库均出现故障,则需要使用第一数据库集合中的数据库来对所述全局数据进行数据服务。
具体地,所述第三数据库还用于向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第二时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求。所述第二时间间隔应大于所述第一时间间隔,这样当所述第一数据库出现故障时,会优先切换至所述第二数据库,只有当所述第一数据库集合中的所有数据库均出现故障时,才会切换至所述三数据库。
所述路由控制器还用于在接收到所述第三数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第三数据库的物理IP地址。
进一步地,考虑到如果数据记录有一个自动增长的主键,那么就会在多数据库上出现主键冲突,为了避免同步和数据恢复时的主键冲突,本实施例采用了让每个数据库的自增主键不连续的方案,具体地,任意一个数据库中的数据记录的主键取值为:
PerimaryKeyd,r=d+DataBaseNum×(r-1)
其中,d为数据库的序号,1≤d≤DataBaseNum, DataBaseNum为数据库的总个数,r为数据记录的序号,PerimaryKeyd,r为序号为d的数据库中的序号为r的数据记录的主键取值。
以图1中的数据库1、数据库2、数据库3和数据库4为例,4个数据库的序号分别设置为1-4,其中,数据库1的序号设置为1(则其主键取值将依次为1、5、9、13、17、……),数据库2的序号设置为2(则其主键取值将依次为2、6、10、14、18、……),数据库3的序号设置为4(则其主键取值将依次为3、7、11、15、19、……),数据库4的序号设置为4(则其主键取值将依次为4、8、12、16、20、……),这样,即可有效避免主键冲突。
综上所述,本申请实施例提供的数据同步系统包括一个全局子系统以及分别部署在各个区域的区域子系统,所述全局子系统用于进行全局数据的同步,所述全局数据为在各个区域之间共享的数据,由于全局数据的安全要求较高,本申请实施例采用了在多个区域以数据库集合的形式对其进行多重备份,其中,只提供唯一的一个数据库(即第一数据库集合中的第一数据库)来进行全局数据的数据服务,而第一数据库集合中的第二数据库进行本地的数据同步备份,其它区域的第二数据库集合进行异地的数据同步备份,其中的第四数据库又为第三数据库提供本地数据同步备份,构建出了一个清晰的同步备份链条,在保证数据安全性的同时,又避免了在数据同步过程中出现混乱和差错。所述区域子系统用于进行区域数据的同步,所述区域数据为在单个区域内部共享的数据,由于区域数据的安全要求较低,本申请实施例采用了在本区域使用多个数据库对其进行同步备份的方案,其中,每个区域只提供唯一的一个数据库(即第五数据库)来进行区域数据的数据服务,而其它数据库(即第六数据库)只进行本地的数据同步备份,而无需在其它区域重新部署异地的数据同步备份,大大减少了对系统资源的消耗。
对应于上文实施例所述的一种数据同步系统,本申请实施例还提供了一种数据同步方法,该方法应用于上文实施例所述的数据同步系统中。
如图4所示,所述数据同步方法可以包括:
步骤S401、所述第一数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。
步骤S402、所述第二数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
通过如图4所示的这一过程,实现了所述第二数据库与所述第一数据库之间的数据同步,或者说,实现了所述第二数据库对所述第一数据库的数据备份。
类似地,所述第四数据库与所述第三数据库之间的数据同步过程可以包括:
所述第三数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
所述第四数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
所述第五数据库与所述第六数据库之间的数据同步过程可以包括:
所述第五数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。所述SQL即为用户对区域数据进行的增加、删除、修改等操作的指令。
所述第六数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
所述第一数据库与所述第三数据库之间的数据同步过程可以包括:
所述第一数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中。
所述第三数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
进一步地,如图5所示,所述数据同步方法还可以包括:
步骤S501、所述第二数据库向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息。
步骤S502、所述第二数据库若在预设的第一时间间隔内未接收到所述反馈信息,则向预设的路由控制器发送路由配置请求。
步骤S503、所述路由控制器在接收到所述第二数据库发送的路由配置请求后,将路由配置表中与第一虚拟IP地址对应的物理IP地址修改为所述第二数据库的物理IP地址。
所述路由配置表记录了与所述第一虚拟IP地址对应的物理IP地址,所述第一虚拟IP地址为所述全局子系统提供给外部的IP地址。
通过如图5所示的这一过程,实现了第一数据库与第二数据库之间主从数据库的自动切换。
类似地,所述第一数据库与所述第三数据库之间主从数据库的自动切换过程可以包括:
所述第三数据库向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第二时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求,所述第二时间间隔大于所述第一时间间隔;
所述路由控制器在接收到所述第三数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第三数据库的物理IP地址。
所述第五数据库与所述第六数据库之间主从数据库的自动切换过程可以包括:
所述第六数据库向所述第五数据库发送预设的数据包,并接收所述第五数据库发送的反馈信息,若在所述第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求;
所述路由控制器在接收到所述第六数据库发送的路由配置请求后,将所述路由配置表中与所述第二虚拟IP地址对应的物理IP地址修改为所述第六数据库的物理IP地址,所述路由配置表还记录了分别与各个第二虚拟IP地址对应的物理IP地址,所述第二虚拟IP地址为所述区域子系统提供给外部的IP地址。
进一步地,任意一个数据库中的数据记录的主键取值为:
PerimaryKeyd,r=d+DataBaseNum×(r-1)
其中,d为数据库的序号,1≤d≤DataBaseNum, DataBaseNum为数据库的总个数,r为数据记录的序号,PerimaryKeyd,r为序号为d的数据库中的序号为r的数据记录的主键取值。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的数据同步方法的具体工作过程,可以参考前述数据同步系统实施例中的对应过程,在此不再赘述。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种数据同步系统,其特征在于,包括一个全局子系统以及分别部署在各个区域的区域子系统;
    所述全局子系统用于进行全局数据的同步,所述全局数据为在各个区域之间共享的数据,所述全局子系统包括一个第一数据库集合和至少一个第二数据库集合,每个区域最多部署一个所述第一数据库集合或者一个所述第二数据库集合;
    所述第一数据库集合包括一个第一数据库和至少一个第二数据库,所述第一数据库用于对所述全局数据进行数据服务,所述第二数据库用于对所述第一数据库进行数据备份;
    所述第二数据库集合包括一个第三数据库和至少一个第四数据库,所述第三数据库用于对所述第一数据库进行数据备份,所述第四数据库用于对所述第三数据库进行数据备份;
    所述区域子系统用于进行区域数据的同步,所述区域数据为在单个区域内部共享的数据,所述区域子系统包括一个第五数据库和至少一个第六数据库,所述第五数据库用于对所述区域数据进行数据服务,所述第六数据库用于对所述第五数据库进行数据备份。
  2. 根据权利要求1所述的数据同步系统,其特征在于,所述第一数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第二数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  3. 根据权利要求1所述的数据同步系统,其特征在于,还包括路由控制器,所述路由控制器用于修改预设的路由配置表,所述路由配置表记录了与第一虚拟IP地址对应的物理IP地址,所述第一虚拟IP地址为所述全局子系统提供给外部的IP地址;
    所述第二数据库还用于向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求;
    所述路由控制器还用于在接收到所述第二数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第二数据库的物理IP地址。
  4. 根据权利要求3所述的数据同步系统,其特征在于,所述第三数据库还用于向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第二时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求,所述第二时间间隔大于所述第一时间间隔;
    所述路由控制器还用于在接收到所述第三数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第三数据库的物理IP地址。
  5. 根据权利要求3所述的数据同步系统,其特征在于,所述路由配置表还记录了分别与各个第二虚拟IP地址对应的物理IP地址,所述第二虚拟IP地址为所述区域子系统提供给外部的IP地址;
    所述第六数据库还用于向所述第五数据库发送预设的数据包,并接收所述第五数据库发送的反馈信息,若在所述第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求;
    所述路由控制器还用于在接收到所述第六数据库发送的路由配置请求后,将所述路由配置表中与所述第二虚拟IP地址对应的物理IP地址修改为所述第六数据库的物理IP地址。
  6. 根据权利要求1所述的数据同步系统,其特征在于,所述第三数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第四数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  7. 根据权利要求1所述的数据同步系统,其特征在于,所述第五数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第六数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  8. 根据权利要求1所述的数据同步系统,其特征在于,所述第一数据库还用于执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第三数据库还用于通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  9. 根据权利要求1所述的数据同步系统,其特征在于,所述全局数据包括联系人数据、告警配置数据、告警记录数据。
  10. 根据权利要求1所述的数据同步系统,其特征在于,所述区域数据包括区域上报的监控项索引、区域的监控配置。
  11. 根据权利要求1至10任一项所述的数据同步系统,其特征在于,任意一个数据库中的数据记录的主键取值为:
    PerimaryKeyd,r=d+DataBaseNum×(r-1)
    其中,d为数据库的序号,1≤d≤DataBaseNum, DataBaseNum为数据库的总个数,r为数据记录的序号,PerimaryKeyd,r为序号为d的数据库中的序号为r的数据记录的主键取值。
  12. 一种数据同步方法,应用于权利要求1所述的数据同步系统中,其特征在于,包括:
    所述第一数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第二数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  13. 根据权利要求12所述的数据同步方法,其特征在于,还包括:
    所述第二数据库向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第一时间间隔内未接收到所述反馈信息,则向预设的路由控制器发送路由配置请求;
    所述路由控制器在接收到所述第二数据库发送的路由配置请求后,将路由配置表中与第一虚拟IP地址对应的物理IP地址修改为所述第二数据库的物理IP地址,所述路由配置表记录了与所述第一虚拟IP地址对应的物理IP地址,所述第一虚拟IP地址为所述全局子系统提供给外部的IP地址。
  14. 根据权利要求13所述的数据同步方法,其特征在于,还包括:
    所述第三数据库向所述第一数据库发送预设的数据包,并接收所述第一数据库发送的反馈信息,若在预设的第二时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求,所述第二时间间隔大于所述第一时间间隔;
    所述路由控制器在接收到所述第三数据库发送的路由配置请求后,将所述路由配置表中与所述第一虚拟IP地址对应的物理IP地址修改为所述第三数据库的物理IP地址。
  15. 根据权利要求13所述的数据同步方法,其特征在于,还包括:
    所述第六数据库向所述第五数据库发送预设的数据包,并接收所述第五数据库发送的反馈信息,若在所述第一时间间隔内未接收到所述反馈信息,则向所述路由控制器发送路由配置请求;
    所述路由控制器在接收到所述第六数据库发送的路由配置请求后,将所述路由配置表中与所述第二虚拟IP地址对应的物理IP地址修改为所述第六数据库的物理IP地址,所述路由配置表还记录了分别与各个第二虚拟IP地址对应的物理IP地址,所述第二虚拟IP地址为所述区域子系统提供给外部的IP地址。
  16. 根据权利要求12所述的数据同步方法,其特征在于,还包括:
    所述第三数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第四数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  17. 根据权利要求12所述的数据同步方法,其特征在于,还包括:
    所述第五数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第六数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  18. 根据权利要求12所述的数据同步方法,其特征在于,还包括:
    所述第一数据库执行接收到的SQL指令,并将所述SQL指令记录到本地预设的第一日志中;
    所述第三数据库通过I/O线程从所述第一日志中读取所述SQL指令,将读取的所述SQL指令写入本地预设的第二日志中,并通过SQL线程执行所述SQL指令。
  19. 根据权利要求12所述的数据同步方法,其特征在于,所述全局数据包括联系人数据、告警配置数据、告警记录数据,所述区域数据包括区域上报的监控项索引、区域的监控配置。
  20. 根据权利要求12至19任一项所述的数据同步方法,其特征在于,任意一个数据库中的数据记录的主键取值为:
    PerimaryKeyd,r=d+DataBaseNum×(r-1)
    其中,d为数据库的序号,1≤d≤DataBaseNum, DataBaseNum为数据库的总个数,r为数据记录的序号,PerimaryKeyd,r为序号为d的数据库中的序号为r的数据记录的主键取值。
PCT/CN2018/105004 2018-06-20 2018-09-11 一种数据同步系统及方法 WO2019242115A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810637155.4A CN109062727B (zh) 2018-06-20 2018-06-20 一种数据同步系统及方法
CN201810637155.4 2018-06-20

Publications (1)

Publication Number Publication Date
WO2019242115A1 true WO2019242115A1 (zh) 2019-12-26

Family

ID=64821074

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/105004 WO2019242115A1 (zh) 2018-06-20 2018-09-11 一种数据同步系统及方法

Country Status (2)

Country Link
CN (1) CN109062727B (zh)
WO (1) WO2019242115A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515499A (zh) * 2021-03-25 2021-10-19 中国雄安集团数字城市科技有限公司 一种数据库服务方法及系统

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110471906B (zh) * 2019-08-20 2023-11-14 创新先进技术有限公司 数据库切换方法、装置及设备
CN110781243A (zh) * 2019-11-06 2020-02-11 杭州安恒信息技术股份有限公司 关系型数据库双主数据增量同步方法和系统
CN110968462A (zh) * 2019-12-13 2020-04-07 重庆首厚智能科技研究院有限公司 一种实时安全备份系统

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189340A1 (en) * 2007-02-01 2008-08-07 David Randall Blea Apparatus, system, and method for synchronizing a remote database
CN104850583A (zh) * 2015-04-15 2015-08-19 清华大学 海量气候模式输出数据的分布式协同分析系统及方法
CN105468475A (zh) * 2015-11-16 2016-04-06 北京奇虎科技有限公司 数据库的备份方法及备份装置
CN105701168A (zh) * 2015-12-31 2016-06-22 北京金山安全软件有限公司 一种数据存储方法、装置及电子设备
CN105760552A (zh) * 2016-03-25 2016-07-13 北京奇虎科技有限公司 数据管理方法和装置
CN107015883A (zh) * 2016-01-28 2017-08-04 中国移动通信集团上海有限公司 一种动态数据备份方法及装置
CN107423452A (zh) * 2017-09-02 2017-12-01 国网辽宁省电力有限公司 一种电网异构数据库同步复制迁移方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2011265370B2 (en) * 2004-07-29 2013-09-26 Hitachi Vantara, LLC Metadata management for fixed content distributed data storage
CN101963928A (zh) * 2009-07-22 2011-02-02 升东网络科技发展(上海)有限公司 数据库全量备份系统及方法
CN102385637A (zh) * 2011-12-22 2012-03-21 山东中创软件商用中间件股份有限公司 一种数据库信息的备份方法及系统
CN105528368B (zh) * 2014-09-30 2019-03-12 北京金山云网络技术有限公司 一种数据库迁移方法及装置
CN105025071B (zh) * 2015-03-31 2018-11-16 中国石油天然气集团公司 一种油气管道云处理系统及实现方法

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189340A1 (en) * 2007-02-01 2008-08-07 David Randall Blea Apparatus, system, and method for synchronizing a remote database
CN104850583A (zh) * 2015-04-15 2015-08-19 清华大学 海量气候模式输出数据的分布式协同分析系统及方法
CN105468475A (zh) * 2015-11-16 2016-04-06 北京奇虎科技有限公司 数据库的备份方法及备份装置
CN105701168A (zh) * 2015-12-31 2016-06-22 北京金山安全软件有限公司 一种数据存储方法、装置及电子设备
CN107015883A (zh) * 2016-01-28 2017-08-04 中国移动通信集团上海有限公司 一种动态数据备份方法及装置
CN105760552A (zh) * 2016-03-25 2016-07-13 北京奇虎科技有限公司 数据管理方法和装置
CN107423452A (zh) * 2017-09-02 2017-12-01 国网辽宁省电力有限公司 一种电网异构数据库同步复制迁移方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515499A (zh) * 2021-03-25 2021-10-19 中国雄安集团数字城市科技有限公司 一种数据库服务方法及系统

Also Published As

Publication number Publication date
CN109062727A (zh) 2018-12-21
CN109062727B (zh) 2023-04-14

Similar Documents

Publication Publication Date Title
WO2019242115A1 (zh) 一种数据同步系统及方法
CN106062717B (zh) 一种分布式存储复制系统和方法
US20200310660A1 (en) Identifying sub-health object storage devices in a data storage system
JP5508798B2 (ja) クラスタを考慮してレプリケーションを管理する管理方法及びシステム
US10764119B2 (en) Link handover method for service in storage system, and storage device
CN108234306A (zh) 网络装置、网络方法和计算机可读存储介质
US20140244578A1 (en) Highly available main memory database system, operating method and uses thereof
WO2011157156A2 (zh) 数据存储系统的操作方法和装置
CN108234302A (zh) 保持网络装置用的分布式操作系统中的一致性
CN111581284A (zh) 一种数据库高可用性方法、装置、系统和存储介质
US10320905B2 (en) Highly available network filer super cluster
WO2016177231A1 (zh) 基于双主控的主备倒换方法及装置
WO2013131448A1 (zh) 数据同步方法、系统及数据访问装置
CN103761166A (zh) 一种虚拟化环境下针对网络服务的双机热备份容灾系统及其方法
WO2014023000A1 (zh) 分布式数据处理方法及装置
WO2012145963A1 (zh) 数据管理系统及方法
CN105049258B (zh) 网络容灾系统的数据传输方法
CN110175089A (zh) 一种具有读写分离功能的双活灾备系统
JP2015005037A (ja) 情報処理装置、情報処理装置の制御プログラム、および情報処理装置の制御方法
EP3896571B1 (en) Data backup method, apparatus and system
CN110704541A (zh) 一种Redis集群多数据中心高可用的分布式方法及架构
CN103428288A (zh) 基于分区状态表和协调节点的副本同步方法
CN105824571A (zh) 一种实现数据无缝迁移的方法及装置
CN114785807A (zh) 一种数据处理方法、装置、电子设备及存储介质
CN112783694B (zh) 一种高可用Redis的异地灾备方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18923393

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 10.02.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18923393

Country of ref document: EP

Kind code of ref document: A1