CN117349381A - Data synchronization method, device, management equipment, controller, system and media - Google Patents

Data synchronization method, device, management equipment, controller, system and media Download PDF

Info

Publication number
CN117349381A
CN117349381A CN202311329650.6A CN202311329650A CN117349381A CN 117349381 A CN117349381 A CN 117349381A CN 202311329650 A CN202311329650 A CN 202311329650A CN 117349381 A CN117349381 A CN 117349381A
Authority
CN
China
Prior art keywords
controller
bitmap
data
main controller
database
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202311329650.6A
Other languages
Chinese (zh)
Inventor
李奋翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data Technology Co ltd
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 Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202311329650.6A priority Critical patent/CN117349381A/en
Publication of CN117349381A publication Critical patent/CN117349381A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a data synchronization method, a device, a management device, a controller, a system and a medium, wherein the method is applied to the management device and can comprise the following steps: setting a database and bitmaps corresponding to the controllers one by one in the storage equipment; setting a main controller to enable the main controller to independently obtain the read-write permission of the database, and updating the data writing position to the bitmap of the main controller when executing the data writing task to the database; setting a takeover controller when determining that the master controller fails, so that the takeover controller takes over the read-write permission of the database, and synchronizing data in a bitmap of the master controller to the bitmap of the takeover controller, so as to resume execution of the data writing service which is not completed by the master controller according to the bitmap of the takeover controller; the method can set the database shared by all controllers, and can ensure that the taking-over controller can restore the service only by synchronizing the bitmap information which is generated by the main controller and records the writing condition of the database, thereby improving the stability of the multi-control storage array.

Description

数据同步方法、装置、管理设备、控制器、系统及介质Data synchronization method, device, management equipment, controller, system and media

技术领域Technical field

本发明涉及存储领域,特别涉及数据同步方法、装置、管理设备、控制器、系统及介质。The present invention relates to the field of storage, and in particular to data synchronization methods, devices, management equipment, controllers, systems and media.

背景技术Background technique

随着数据的爆炸性增长和存储技术的发展,多控存储阵列逐渐成为了一种提升系统性能和数据可靠性的存储方式。多控存储阵列通常包含多个控制器,这多个控制器可将存储系统中的用户、硬盘、存储池、逻辑卷等存储资源信息保存在数据库中,以实现对多控存储阵列的管控。With the explosive growth of data and the development of storage technology, multi-control storage arrays have gradually become a storage method to improve system performance and data reliability. Multi-control storage arrays usually include multiple controllers. These multiple controllers can store storage resource information such as users, hard disks, storage pools, and logical volumes in the storage system in the database to achieve management and control of the multi-control storage array.

相关技术中,各控制器的数据库文件通常保存在各控制器对应的系统盘中,由于多控制器之间系统盘是相互隔离,因此需采取数据同步手段对各控制器的数据库文件进行同步。这导致当控制器数量增多时,数据同步周期和数据同步算法会变得更复杂,极大地增加了数据丢失的风险;更严重的是,若在主控制器故障时正在进行数据库同步,则会导致主控制器和备用控制器获取到的数据库内容不一致。In the related art, the database files of each controller are usually stored in the system disks corresponding to each controller. Since the system disks of multiple controllers are isolated from each other, data synchronization means need to be used to synchronize the database files of each controller. This causes the data synchronization cycle and data synchronization algorithm to become more complex when the number of controllers increases, greatly increasing the risk of data loss; more seriously, if database synchronization is in progress when the main controller fails, As a result, the database contents obtained by the primary controller and the backup controller are inconsistent.

发明内容Contents of the invention

本发明的目的是提供一种数据同步方法、装置、管理设备、控制器、系统及介质,可设置所有控制器共享的数据库,并可确保接管控制器仅同步主控制器生成的记录有数据库写入情况的位图信息即可恢复业务,从而可提升多控存储阵列的稳定性。The purpose of the present invention is to provide a data synchronization method, device, management equipment, controller, system and medium that can set up a database shared by all controllers and ensure that the takeover controller only synchronizes the records generated by the main controller with database writing The business can be restored by inputting the status bitmap information, thereby improving the stability of the multi-control storage array.

为解决上述技术问题,本发明提供一种数据同步方法,应用于管理设备,包括:In order to solve the above technical problems, the present invention provides a data synchronization method, which is applied to management equipment, including:

在存储设备中设置数据库以及与各控制器一一对应的位图;Set the database and the bitmap corresponding to each controller in the storage device;

设置主控制器,以使所述主控制器单独获得所述数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述主控制器的位图中;Set the main controller so that the main controller independently obtains the read and write permissions of the database, and when performing a data writing task to the database, updates the data writing position to the bitmap of the main controller middle;

当确定所述主控制器故障时设置接管控制器,以使所述接管控制器接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至所述接管控制器的位图,以便根据所述接管控制器的位图恢复执行所述主控制器未完成的数据写入业务。When it is determined that the main controller fails, a takeover controller is set so that the takeover controller takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to the takeover controller. bitmap, so that the unfinished data writing service of the main controller can be resumed according to the bitmap of the takeover controller.

可选地,在存储设备中设置数据库以及与各控制器一一对应的位图之前,还包括:Optionally, before setting the database and the bitmap corresponding to each controller in the storage device, it also includes:

在存储系统中选择多块硬盘设备,并利用所述多块硬盘设备组建磁盘阵列,以使所述磁盘阵列至少允许一块硬盘设备损坏而不中断存储服务;Select multiple hard disk devices in the storage system, and use the multiple hard disk devices to form a disk array, so that the disk array allows at least one hard disk device to be damaged without interrupting storage services;

将所述磁盘阵列设置为所述存储设备。The disk array is configured as the storage device.

可选地,所述利用所述多块硬盘设备组建磁盘阵列,包括:Optionally, using the plurality of hard disk devices to form a disk array includes:

在各所述硬盘设备中划分出预设大小的分区空间;Divide a partition space of a preset size in each of the hard disk devices;

利用各所述硬盘设备对应的分区空间组建所述磁盘阵列。The disk array is constructed using the partition space corresponding to each hard disk device.

可选地,在设置接管控制器之后,还包括:Optionally, after setting up the takeover controller, also include:

将所述主控制器未完成的数据写入业务下发至所述接管控制器,以使所述接管控制器在将所述主控制器的位图中的数据同步至所述接管控制器的位图之后,根据所述数据写入业务及接管控制器的位图确定所述主控制器对所述数据写入业务的完成进度,并根据所述完成进度恢复执行所述主控制器未完成的数据写入业务。Send the unfinished data writing service of the main controller to the takeover controller, so that the takeover controller synchronizes the data in the bitmap of the main controller to the takeover controller. After the bitmap, determine the completion progress of the data writing service by the main controller according to the bitmap of the data writing service and the takeover controller, and resume execution of the unfinished work of the main controller according to the completion progress. data writing business.

可选地,还包括:Optionally, also includes:

将所述存储设备中的存储空间划分为多个数据块,并设置所述位图中的每一位与所述数据块之间的一一映射关系;Divide the storage space in the storage device into multiple data blocks, and set a one-to-one mapping relationship between each bit in the bitmap and the data blocks;

将记录有所述映射关系的映射关系信息下发至各所述控制器,以使所述主控制器根据所述数据写入位置对应的数据块,对所述主控制器的位图中的对应位进行更新。The mapping relationship information recorded with the mapping relationship is delivered to each of the controllers, so that the main controller writes the data in the bitmap of the main controller according to the data block corresponding to the data writing position. The corresponding bit is updated.

本发明还提供一种数据同步方法,应用于控制器,所述方法包括:The present invention also provides a data synchronization method, which is applied to the controller. The method includes:

当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述存储设备中与自身对应的位图;所述存储设备中设置有与各控制器一一对应的位图;When the managed device is set as the master controller, it independently obtains the read and write permissions of the database in the storage device, and when performing data writing tasks to the database, updates the data writing location to the storage device and itself. Corresponding bitmap; the storage device is provided with a bitmap that corresponds to each controller one-to-one;

当被所述管理设备设置为接管控制器时,接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行所述主控制器未完成的数据写入业务。When the management device is set to take over the controller, it takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to its own corresponding bitmap so that it can be used according to its own corresponding bitmap. Resume execution of unfinished data writing services of the main controller.

可选地,在被所述管理设备设置为接管控制器之后,还包括:Optionally, after being set by the management device to take over the controller, it also includes:

在接收到所述管理设备下发的所述主控制器未完成的数据写入业务,并且完成将所述主控制器的位图中的数据同步至自身对应的位图时,根据所述数据写入业务及自身对应的位图确定所述主控制器对所述数据写入业务的完成进度,并根据所述完成进度恢复执行所述主控制器未完成的数据写入业务。After receiving the unfinished data writing service of the main controller issued by the management device and completing the synchronization of the data in the bitmap of the main controller to its corresponding bitmap, according to the data The writing service and its corresponding bitmap determine the completion progress of the data writing service by the main controller, and resume execution of the unfinished data writing service by the main controller according to the completion progress.

可选地,在将所述主控制器的位图中的数据同步至自身对应的位图之后,还包括:Optionally, after synchronizing the data in the bitmap of the main controller to its corresponding bitmap, it also includes:

清除所述主控制器的位图中的数据。Clears the data in the host controller's bitmap.

可选地,所述将数据写入位置更新至所述存储设备中与自身对应的位图,包括:Optionally, updating the data writing location to a bitmap corresponding to itself in the storage device includes:

获取映射关系信息;所述映射关系信息记录有所述位图中的每一位与所述存储设备中的每一数据块之间的一一映射关系;Obtain mapping relationship information; the mapping relationship information records a one-to-one mapping relationship between each bit in the bitmap and each data block in the storage device;

根据所述数据写入位置对应的数据块,对自身的位图中的对应位进行更新。According to the data block corresponding to the data writing position, the corresponding bit in its own bitmap is updated.

本发明还提供一种数据同步装置,应用于管理设备,包括:The invention also provides a data synchronization device applied to management equipment, including:

存储设备设置模块,用于在存储设备中设置数据库以及与各控制器一一对应的位图;The storage device setting module is used to set the database in the storage device and the bitmap corresponding to each controller;

主控制器设置模块,用于设置主控制器,以使所述主控制器单独获得所述数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述主控制器的位图中;The main controller setting module is used to set the main controller so that the main controller independently obtains the read and write permissions of the database, and when performing a data writing task to the database, updates the data writing position to In the bitmap of the main controller;

接管控制器设置模块,用于当确定所述主控制器故障时设置接管控制器,以使所述接管控制器接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至所述接管控制器的位图,以便根据所述接管控制器的位图恢复执行所述主控制器未完成的数据写入业务。A takeover controller setting module, configured to set a takeover controller when it is determined that the main controller is faulty, so that the takeover controller takes over the read and write permissions of the database and changes the bitmap in the main controller to The data is synchronized to the bitmap of the takeover controller, so that the unfinished data writing service of the main controller can be resumed according to the bitmap of the takeover controller.

本发明还提供一种数据同步装置,应用于控制器,包括:The invention also provides a data synchronization device applied to a controller, including:

主控制器模块,用于当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述存储设备中与自身对应的位图;所述存储设备中设置有与各控制器一一对应的位图;The main controller module is used to independently obtain read and write permissions for the database in the storage device when the managed device is set as the main controller, and when performing data writing tasks to the database, update the data writing location to A bitmap corresponding to itself in the storage device; a bitmap corresponding to each controller in a one-to-one manner is provided in the storage device;

接管模块,用于当被所述管理设备设置为接管控制器时,接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行所述主控制器未完成的数据写入业务。A takeover module, configured to take over the read and write permissions of the database when the management device is set to take over the controller, and synchronize the data in the bitmap of the main controller to its corresponding bitmap so that the data can be processed according to the The corresponding bitmap resumes execution of the unfinished data writing service of the main controller.

本发明还提供一种管理设备,包括:The invention also provides a management device, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现如上所述的应用于管理设备的数据同步方法。A processor, configured to implement the above-mentioned data synchronization method applied to management equipment when executing the computer program.

本发明还提供一种控制器,包括:The invention also provides a controller, including:

存储器,用于存储计算机程序;Memory, used to store computer programs;

处理器,用于执行所述计算机程序时实现如上所述的应用于控制器的数据同步方法。A processor, configured to implement the data synchronization method applied to the controller as described above when executing the computer program.

本发明还提供一种数据同步系统,包括:The invention also provides a data synchronization system, including:

存储设备,用于设置数据库以及与各控制器一一对应的位图;Storage device, used to set the database and the bitmap corresponding to each controller;

管理设备,用于执行如上所述的应用于管理设备的数据同步方法;A management device configured to perform the data synchronization method applied to the management device as described above;

控制器,用于执行如上所述的应用于控制器的数据同步方法。A controller that performs the data synchronization methods applied to the controller as described above.

本发明还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现如上所述的应用于管理设备的数据同步方法和/或如上所述的应用于控制器的数据同步方法。The present invention also provides a computer-readable storage medium. Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are loaded and executed by a processor, they can be applied to management equipment as described above. The data synchronization method and/or the data synchronization method applied to the controller as described above.

本发明提供一种数据同步方法,应用于管理设备,包括:在存储设备中设置数据库以及与各控制器一一对应的位图;设置主控制器,以使所述主控制器单独获得所述数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述主控制器的位图中;当确定所述主控制器故障时设置接管控制器,以使所述接管控制器接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至所述接管控制器的位图,以便根据所述接管控制器的位图恢复执行所述主控制器未完成的数据写入业务。The invention provides a data synchronization method, which is applied to management equipment, including: setting a database and a bitmap corresponding to each controller in a storage device; setting a main controller so that the main controller can obtain the The read and write permissions of the database, and when performing data writing tasks to the database, the data writing position is updated to the bitmap of the main controller; when it is determined that the main controller fails, a takeover controller is set, So that the takeover controller takes over the read and write permissions of the database, and synchronizes the data in the bitmap of the main controller to the bitmap of the takeover controller, so that according to the bitmap of the takeover controller Resume execution of unfinished data writing services of the main controller.

可见,本发明中的管理设备首先可在存储设备中设置数据库以及与各控制器一一对应的位图,其中数据库仅设置一套,并由各控制器共享,而位图用于记录控制器对数据库的更新情况;随后,管理设备可设置主控制器,以使主控制器单独获得数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至主控制器的位图中;而当确定主控制器故障时,管理设备可设置接管控制器,以使接管控制器接管数据库的读写权限,并将主控制器的位图中的数据同步至接管控制器的位图,以便根据接管控制器的位图恢复执行主控制器未完成的数据写入业务,即接管控制器仅需同步主控制器所记录的位图数据,并可根据该位图数据便可掌握主控制器对数据库的更新情况,从而能够恢复执行主控制器未完成的数据写入业务,而不需要对数据库进行完整同步;并且,主控制器生成的位图数据记录在独立于主控制器的存储设备上,进而在主控制器故障时,接管控制器仍可完成数据同步,从而极大地提升了多控存储阵列的稳定性,并降低了数据丢失的风险。本发明还提供一种数据同步装置、管理设备、控制器、系统及计算机可读存储介质,具有上述有益效果。It can be seen that the management device in the present invention can first set a database and a bitmap corresponding to each controller in the storage device. There is only one set of databases and is shared by each controller, and the bitmap is used to record the controller. Updates to the database; subsequently, the management device can set the main controller so that the main controller obtains read and write permissions to the database alone, and updates the data writing location to the main controller when performing data writing tasks to the database. in the bitmap; when it is determined that the main controller is faulty, the management device can set the takeover controller so that the takeover controller takes over the read and write permissions of the database and synchronizes the data in the main controller's bitmap to the takeover controller bitmap, so that the unfinished data writing business of the main controller can be resumed based on the bitmap of the takeover controller, that is, the takeover controller only needs to synchronize the bitmap data recorded by the main controller, and can write data based on the bitmap data. The update status of the database by the main controller can be grasped, so that the unfinished data writing business of the main controller can be resumed without complete synchronization of the database; and the bitmap data generated by the main controller is recorded independently of the main controller. On the storage device of the controller, when the main controller fails, the takeover controller can still complete data synchronization, thus greatly improving the stability of the multi-control storage array and reducing the risk of data loss. The invention also provides a data synchronization device, management equipment, controller, system and computer-readable storage medium, which have the above beneficial effects.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without exerting creative efforts.

图1为本发明实施例所提供的一种数据同步系统的结构框图;Figure 1 is a structural block diagram of a data synchronization system provided by an embodiment of the present invention;

图2为本发明实施例所提供的一种数据同步方法的流程图;Figure 2 is a flow chart of a data synchronization method provided by an embodiment of the present invention;

图3为本发明实施例所提供的另一种数据同步方法的流程图;Figure 3 is a flow chart of another data synchronization method provided by an embodiment of the present invention;

图4为本发明实施例所提供的一种具有冗余保护功能的RAID1设备数据分布示意图;Figure 4 is a schematic diagram of data distribution of a RAID1 device with redundancy protection function provided by an embodiment of the present invention;

图5为本发明实施例所提供的一种数据同步装置的结构框图;Figure 5 is a structural block diagram of a data synchronization device provided by an embodiment of the present invention;

图6为本发明实施例所提供的另一种数据同步装置的结构框图;Figure 6 is a structural block diagram of another data synchronization device provided by an embodiment of the present invention;

图7为本发明实施例所提供的一种管理设备的结构框图;Figure 7 is a structural block diagram of a management device provided by an embodiment of the present invention;

图8为本发明实施例所提供的一种控制器的结构框图。Figure 8 is a structural block diagram of a controller provided by an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

相关技术中,各控制器的数据库文件通常保存在各控制器对应的系统盘中,由于多控制器之间系统盘是相互隔离,因此需采取数据同步手段对各控制器的数据库文件进行同步。这导致当控制器数量增多时,数据同步周期和数据同步算法会变得更复杂,极大地增加了数据丢失的风险;更严重的是,若在主控制器故障时正在进行数据库同步,则会导致主控制器和备用控制器获取到的数据库内容不一致。有鉴于此,本发明可提供一种数据同步方法,可设置所有控制器共享的数据库,并可确保接管控制器仅同步主控制器生成的记录有数据库写入情况的位图信息即可恢复业务,从而可提升多控存储阵列的稳定性。In the related art, the database files of each controller are usually stored in the system disks corresponding to each controller. Since the system disks of multiple controllers are isolated from each other, data synchronization means need to be used to synchronize the database files of each controller. This causes the data synchronization cycle and data synchronization algorithm to become more complex when the number of controllers increases, greatly increasing the risk of data loss; more seriously, if database synchronization is in progress when the main controller fails, As a result, the database contents obtained by the primary controller and the backup controller are inconsistent. In view of this, the present invention can provide a data synchronization method, which can set up a database shared by all controllers, and ensure that the takeover controller can resume business by only synchronizing the bitmap information generated by the main controller with records of database writing. , thereby improving the stability of multi-control storage arrays.

为便于理解,请参考图1,图1为本发明实施例所提供的一种数据同步系统的结构框图。本系统包括管理设备10、多个控制器20及存储设备30,其中多个控制器20可形成集群,而管理设备10则可集中管理该集群,如可在控制器20中设置主控制器和备用控制器;管理设备10还用于在存储设备中设置数据库以及与每个控制器一一对应的位图,其中数据库由所有控制器20共享,而位图则用于记录控制器20对数据库的更新情况。具体的,备用控制器可对数据库进行读操作,而主控制器则可对数据库进行读操作和写操作。在向数据库写入数据时,主控制器可进一步将写入数据的位置记录在其对应的位图中。进而,主控制器发生故障时,由于可根据主控制器的位图确定主控制器对数据库的写入情况,因此接管主控制器的接管控制器可将主控制器产生的位图数据同步至自己的位图中,以根据自己位图中的位图数据对主控制器未完成的写入业务进行恢复。显然,在本发明实施例中,由于各控制器20并不单独保存数据库文件,而是设置了由所有控制器20共享的数据库,且该数据库设置在独立于控制器20的存储设备中,因此既避免在各控制器20之间同步数据库文件,也避免了当主控制器发生故障则接管控制器无法获取主控制器数据库文件的情况;且,在进行业务恢复时,接管控制器仅需同步主控制器产生的位图数据即可,而不需要完整同步数据库,能够极大减少数据同步量,因此本发明实施例可显著提升多控存储阵列的稳定性,并降低数据丢失风险。For ease of understanding, please refer to Figure 1 , which is a structural block diagram of a data synchronization system provided by an embodiment of the present invention. This system includes a management device 10, multiple controllers 20 and a storage device 30. Multiple controllers 20 can form a cluster, and the management device 10 can centrally manage the cluster. For example, a main controller and a storage device can be set in the controller 20. Standby controller; the management device 10 is also used to set a database and a bitmap corresponding to each controller in the storage device, where the database is shared by all controllers 20, and the bitmap is used to record the controller 20's response to the database. updates. Specifically, the standby controller can perform read operations on the database, while the primary controller can perform read operations and write operations on the database. When writing data to the database, the main controller can further record the location of the written data in its corresponding bitmap. Furthermore, when the main controller fails, since the writing status of the main controller to the database can be determined based on the bitmap of the main controller, the takeover controller that takes over the main controller can synchronize the bitmap data generated by the main controller to in its own bitmap to recover the unfinished write business of the main controller based on the bitmap data in its own bitmap. Obviously, in the embodiment of the present invention, since each controller 20 does not save the database file independently, but sets a database shared by all controllers 20, and the database is set in a storage device independent of the controller 20, therefore It not only avoids the synchronization of database files between controllers 20, but also avoids the situation where the takeover controller cannot obtain the database files of the main controller when the main controller fails; and, during business recovery, the takeover controller only needs to synchronize the main controller's database files. The bitmap data generated by the controller is sufficient, without the need for complete synchronization of the database, which can greatly reduce the amount of data synchronization. Therefore, embodiments of the present invention can significantly improve the stability of the multi-control storage array and reduce the risk of data loss.

需要说明的是,本发明实施例并不限定管理设备10、控制器20是以物理设备形态存在还是以虚拟机形态存在,可根据实际应用需求进行设定。在以物理设备形态存在时,本发明实施例并不限定管理设备10及控制器20具体对应的物理设备,例如可以为个人电脑、服务器等;在以虚拟机形态存在时,本发明实施例并不限定部署有管理设备10、控制器20或同时部署有管理设备10、控制器20的物理设备的具体类型,例如可以为个人电脑、服务器等。本发明实施例也不限定控制器20的数量,可根据实际应用需求进行设定。It should be noted that the embodiment of the present invention does not limit whether the management device 10 and the controller 20 exist in the form of physical devices or in the form of virtual machines. They can be set according to actual application requirements. When existing in the form of a physical device, the embodiment of the present invention does not limit the specific physical devices corresponding to the management device 10 and the controller 20, for example, they can be personal computers, servers, etc.; when existing in the form of a virtual machine, the embodiment of the present invention does not limit the specific physical devices corresponding to the management device 10 and the controller 20. The specific type of the physical device on which the management device 10 and the controller 20 are deployed or on which the management device 10 and the controller 20 are deployed is not limited. For example, it may be a personal computer, a server, etc. The embodiment of the present invention does not limit the number of controllers 20, which can be set according to actual application requirements.

基于上述对数据同步系统的介绍,下面将对本发明实施例提供的应用于管理设备的数据同步方法进行详细介绍。请参考图2,图2为本发明实施例所提供的一种数据同步方法的流程图。该方法应用于管理设备,可以包括:Based on the above introduction to the data synchronization system, the data synchronization method applied to the management device provided by the embodiment of the present invention will be introduced in detail below. Please refer to Figure 2, which is a flow chart of a data synchronization method provided by an embodiment of the present invention. This method should be used to manage devices and can include:

S201、在存储设备中设置数据库以及与各控制器一一对应的位图。S201. Set a database and a bitmap corresponding to each controller in the storage device.

在本发明实施例中,管理设备首先可在存储设备中设置数据库以及与各控制器一一对应的位图(bitmap)。其中,该数据库由所有控制器共享,例如所有控制器均具有该数据库的读权限,而主控制器进一步具有该数据库的读写权限;而位图则用于保存对应控制器对数据库的更新情况。对于数据库而言,由于本发明实施例中的控制器将不会单独维护数据库文件,而是可采用同一数据库来保存多控存储阵列中的重要数据(如用户、硬盘、存储池、逻辑卷等存储资源信息),因此能够避免在各控制器间同步数据导致的稳定性差、容易丢失数据的问题。对于位图而言,首先各控制器可独立维护其对应的位图,能够避免数据混乱;且,由于主控制器利用其对应的位图记录对数据库的更新情况,因此接管主控制器的接管控制器可根据主控制器的位图确定主控制器对数据库的写入情况,因此在将主控制器产生的位图数据同步至自己的位图之后,接管控制器能够快速恢复主控制器未完成的数据库写入业务。更重要的是,由于存储设备独立于各控制器,因此在遭遇控制器故障时,其他控制器仍可从独立的存储设备中访问位图及数据库,从而能够避免因控制器故障而发生数据无法获取、不一致的问题。In this embodiment of the present invention, the management device may first set up a database and a bitmap corresponding to each controller in the storage device. Among them, the database is shared by all controllers. For example, all controllers have read permissions to the database, and the main controller further has read and write permissions to the database; and the bitmap is used to save the updates to the database by the corresponding controller. . For the database, the controller in the embodiment of the present invention will not maintain the database file separately, but can use the same database to save important data in the multi-control storage array (such as users, hard disks, storage pools, logical volumes, etc. Storage resource information), so it can avoid the problems of poor stability and easy data loss caused by data synchronization between controllers. For bitmaps, first of all, each controller can independently maintain its corresponding bitmap, which can avoid data confusion; and, because the main controller uses its corresponding bitmap to record updates to the database, it takes over the control of the main controller. The controller can determine the writing status of the main controller to the database based on the bitmap of the main controller. Therefore, after synchronizing the bitmap data generated by the main controller to its own bitmap, the takeover controller can quickly restore the data that the main controller has not written. Completed database writing business. More importantly, since the storage device is independent of each controller, when a controller failure occurs, other controllers can still access bitmaps and databases from independent storage devices, thus avoiding data loss due to controller failure. Acquisition,inconsistency issues.

需要说明的是,本发明实施例并不限定在存储设备中设置数据库的具体方式,可参考存储系统的相关技术,例如可将存储设备格式化为XFS文件系统(X File System,新一代文件系统),并将数据库文件保存在该文件系统中,形成数据库。为确保各控制器可访问该数据库,管理设备还可将数据集路径挂载至各控制器。本发明实施例也不限定在存储设备中设置位图的具体方式,例如可为每一控制器分配对应的位图空间,以利用该位图空间中的每一位(bit)作为位图中的每一位。It should be noted that the embodiments of the present invention are not limited to the specific manner of setting up the database in the storage device. Reference may be made to related technologies of the storage system. For example, the storage device may be formatted into an XFS file system (X File System, a new generation file system). ), and save the database file in the file system to form a database. To ensure that each controller can access the database, the management device can also mount the data set path to each controller. The embodiment of the present invention is not limited to the specific way of setting the bitmap in the storage device. For example, each controller can be allocated a corresponding bitmap space to use each bit in the bitmap space as a bitmap in the bitmap. of everyone.

进一步,本发明实施例中的存储设备既可以由单个硬盘设备组成,也可以由多个硬盘设备组成。而为了进一步提升数据库及位图的存储可靠性,本发明实施例不仅将利用多个硬盘设备组成上述存储设备,还可利用硬盘设备组件为磁盘阵列,以使磁盘阵列至少允许一块硬盘设备损坏而不中断存储服务,从而可确保在部分硬盘设备损坏时,仍确保数据库及位图不丢失。需要说明的是,本发明实施例并不限定阵列的具体形式,例如可利用多个硬盘设备组件RAID1、RAID5、RAID10阵列,这三种阵列均至少允许一块硬盘设备损坏而不中断存储服务,可根据实际应用需求进行选择。本发明实施例也不限定具体的硬盘设备数量,同样可根据实际应用需求进行设定。Furthermore, the storage device in the embodiment of the present invention may be composed of a single hard disk device or multiple hard disk devices. In order to further improve the storage reliability of databases and bitmaps, embodiments of the present invention not only use multiple hard disk devices to form the above storage device, but also use hard disk device components to form a disk array, so that the disk array allows at least one hard disk device to be damaged. The storage service is not interrupted, thus ensuring that the database and bitmaps are not lost when some hard disk devices are damaged. It should be noted that the embodiment of the present invention does not limit the specific form of the array. For example, multiple hard disk device components can be used in RAID1, RAID5, and RAID10 arrays. These three arrays allow at least one hard disk device to be damaged without interrupting storage services. Choose according to actual application needs. The embodiment of the present invention does not limit the specific number of hard disk devices, which can also be set according to actual application requirements.

基于此,在存储设备中设置数据库以及与各控制器一一对应的位图之前,还可以包括:Based on this, before setting the database and the bitmap corresponding to each controller in the storage device, you can also include:

步骤11:在存储系统中选择多块硬盘设备,并利用多块硬盘设备组建磁盘阵列,以使磁盘阵列至少允许一块硬盘设备损坏而不中断存储服务;Step 11: Select multiple hard disk devices in the storage system and use multiple hard disk devices to form a disk array so that the disk array can allow at least one hard disk device to be damaged without interrupting storage services;

步骤12:将磁盘阵列设置为存储设备。Step 12: Set up the disk array as a storage device.

进一步,由于上述数据库及位图对硬盘设备的空间占用不大,为避免资源浪费,本发明实施例也可仅在各硬盘设备中划分出预设大小的分区空间,并利用各硬盘设备对应的分区空间组建磁盘阵列。需要说明的是,本发明实施例并不限定具体的预设大小,可根据实际应用需求进行设定,例如可以为8G。Furthermore, since the above-mentioned database and bitmap do not occupy much space on the hard disk device, in order to avoid resource waste, embodiments of the present invention can also only divide the partition space of a preset size in each hard disk device, and use the corresponding partition space of each hard disk device. Partition space to form a disk array. It should be noted that the embodiment of the present invention does not limit the specific preset size, which can be set according to actual application requirements, for example, it can be 8G.

基于此,利用多块硬盘设备组建磁盘阵列,可以包括:Based on this, multiple hard disk devices are used to form a disk array, which can include:

步骤21:在各硬盘设备中划分出预设大小的分区空间;Step 21: Divide the partition space of the preset size in each hard disk device;

步骤22:利用各硬盘设备对应的分区空间组建磁盘阵列。Step 22: Use the partition space corresponding to each hard disk device to build a disk array.

S202、设置主控制器,以使主控制器单独获得数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至主控制器的位图中。S202. Set the main controller so that the main controller independently obtains the read and write permissions of the database, and when performing a data writing task to the database, updates the data writing position to the bitmap of the main controller.

在完成数据库和位图设置后,本发明实施例中的管理设备在所有控制器中选择主控制器,以使主控制器单独获得数据库的读写权限。而主控制器在向数据库执行数据写入任务时,可将数据写入位置更新至主控制器的位图中。After completing the database and bitmap settings, the management device in the embodiment of the present invention selects the main controller among all controllers, so that the main controller independently obtains the read and write permissions of the database. When the main controller performs a data writing task to the database, it can update the data writing position to the bitmap of the main controller.

而为确保控制器能够利用位图记录数据写入位置,在设置存储设备时,管理设备可将存储设备中的存储空间划分为多个数据块,并设置位图中的每一位与数据块之间的一一映射关系;随后,管理设备可将记录有映射关系的映射关系信息下发至各控制器,以使主控制器根据数据写入位置对应的数据块,对主控制器的位图中的对应位进行更新。值得指出的是,当存储设备以磁盘阵列出现时,上述数据块可以为一个磁盘阵列中的chunk块,以便将位图中的每一位与磁盘阵列中进行数据恢复的基本存储单元进行对应,从而方便数据恢复。In order to ensure that the controller can use the bitmap to record the data writing location, when setting up the storage device, the management device can divide the storage space in the storage device into multiple data blocks and set each bit in the bitmap to the data block. The one-to-one mapping relationship between them; then, the management device can send the mapping relationship information recorded with the mapping relationship to each controller, so that the main controller can update the bits of the main controller according to the data block corresponding to the data writing position. The corresponding bits in the figure are updated. It is worth pointing out that when the storage device appears as a disk array, the above-mentioned data block can be a chunk block in a disk array, so that each bit in the bitmap corresponds to the basic storage unit in the disk array for data recovery. This facilitates data recovery.

基于此,本发明还可以包括:Based on this, the present invention may also include:

步骤31:将存储设备中的存储空间划分为多个数据块,并设置位图中的每一位与数据块之间的一一映射关系;Step 31: Divide the storage space in the storage device into multiple data blocks, and set a one-to-one mapping relationship between each bit in the bitmap and the data blocks;

步骤32:将记录有映射关系的映射关系信息下发至各控制器,以使主控制器根据数据写入位置对应的数据块,对主控制器的位图中的对应位进行更新。Step 32: Send the mapping relationship information recorded with the mapping relationship to each controller, so that the main controller updates the corresponding bits in the main controller's bitmap according to the data block corresponding to the data writing position.

S203、当确定主控制器故障时设置接管控制器,以使接管控制器接管数据库的读写权限,并将主控制器的位图中的数据同步至接管控制器的位图,以便根据接管控制器的位图恢复执行主控制器未完成的数据写入业务。S203. When it is determined that the main controller is faulty, set the takeover controller so that the takeover controller takes over the read and write permissions of the database, and synchronizes the data in the bitmap of the main controller to the bitmap of the takeover controller so that the takeover controller can be used according to the takeover control. The bitmap of the controller resumes and executes the unfinished data writing business of the main controller.

在确定主控制器故障时,管理平台可在剩余正常工作的备用控制器选择接管控制器,以利用接管控制器接管该主控制器。应当特别说明的是,接管控制器是一种特殊的主控制器。接管控制器在开始向数据库写入数据前,需同步故障的主控制器所产生的位图数据,以掌握主控制器对数据库的写入更新情况。在完成数据同步后,接管控制器正式变更为新的主控制器,进而可根据自身位图恢复执行主控制器未完成的数据写入业务,或在确定先前主控制器没有未完成的数据写入业务时,开始响应新的数据写入业务。When it is determined that the main controller is faulty, the management platform can select a takeover controller from the remaining normally working backup controller to use the takeover controller to take over the main controller. It should be noted that the takeover controller is a special master controller. Before the takeover controller starts writing data to the database, it needs to synchronize the bitmap data generated by the failed main controller to grasp the write and update status of the main controller to the database. After the data synchronization is completed, the takeover controller is officially changed to the new main controller, and then the unfinished data writing business of the main controller can be resumed according to its own bitmap, or it can be determined that the previous main controller has no unfinished data writing. When entering the business, it starts to respond to the new data writing business.

具体的,管理平台在设置了接管控制器之后,可将主控制器未完成的数据写入业务下发至接管控制器,以使接管控制器在将主控制器的位图中的数据同步至接管控制器的位图之后,根据数据写入业务及接管控制器的位图确定主控制器对数据写入业务的完成进度,并根据完成进度恢复执行主控制器未完成的数据写入业务。当然,接管控制器也可自行从管理平台获取主控制器未完成的数据写入业务,可根据实际应用需求进行设定。Specifically, after setting up the takeover controller, the management platform can deliver the unfinished data writing business of the main controller to the takeover controller, so that the takeover controller can synchronize the data in the bitmap of the main controller to After taking over the controller's bitmap, the master controller determines the completion progress of the data write service based on the data writing service and the takeover controller's bitmap, and resumes execution of the main controller's unfinished data write service based on the completion progress. Of course, the takeover controller can also obtain the unfinished data writing business of the main controller from the management platform, and can set it according to actual application requirements.

进一步,需要说明的是,本发明实施例并不限定管理平台如何检测主控制器是否故障,例如管理平台与各控制器间可设置心跳机制,进而可根据各控制器响应心跳报文的情况来确定各控制器的工作、故障情况。Further, it should be noted that the embodiment of the present invention does not limit how the management platform detects whether the main controller is faulty. For example, a heartbeat mechanism can be set up between the management platform and each controller, and the detection can be based on how each controller responds to heartbeat messages. Determine the operation and fault conditions of each controller.

基于上述实施例,本发明中的管理设备首先可在存储设备中设置数据库以及与各控制器一一对应的位图,其中数据库仅设置一套,并由各控制器共享,而位图用于记录控制器对数据库的更新情况;随后,管理设备可设置主控制器,以使主控制器单独获得数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至主控制器的位图中;而当确定主控制器故障时,管理设备可设置接管控制器,以使接管控制器接管数据库的读写权限,并将主控制器的位图中的数据同步至接管控制器的位图,以便根据接管控制器的位图恢复执行主控制器未完成的数据写入业务,即接管控制器仅需同步主控制器所记录的位图数据,并可根据该位图数据便可掌握主控制器对数据库的更新情况,从而能够恢复执行主控制器未完成的数据写入业务,而不需要对数据库进行完整同步;并且,主控制器生成的位图数据记录在独立于主控制器的存储设备上,进而在主控制器故障时,接管控制器仍可完成数据同步,从而极大地提升了多控存储阵列的稳定性,并降低了数据丢失的风险。Based on the above embodiments, the management device in the present invention can first set a database and a bitmap corresponding to each controller in the storage device, where only one set of databases is set and shared by each controller, and the bitmap is used for Record the update of the database by the controller; then, the management device can set the main controller so that the main controller obtains read and write permissions to the database alone, and when performing data writing tasks to the database, the data writing location is updated to in the bitmap of the main controller; when it is determined that the main controller is faulty, the management device can set a takeover controller so that the takeover controller takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to The bitmap of the takeover controller is used to resume execution of the unfinished data writing business of the main controller based on the bitmap of the takeover controller. That is, the takeover controller only needs to synchronize the bitmap data recorded by the main controller and can use the bitmap according to the bitmap of the takeover controller. The graph data can grasp the update status of the database by the main controller, so that the unfinished data writing business of the main controller can be resumed without the need for complete synchronization of the database; and, the bitmap data generated by the main controller is recorded in On a storage device that is independent of the main controller, when the main controller fails, the takeover controller can still complete data synchronization, thus greatly improving the stability of the multi-control storage array and reducing the risk of data loss.

基于上述实施例,下面将对本发明实施例提供的应用于控制器的数据同步方法进行详细介绍。请参考图3,图3为本发明实施例所提供的另一种数据同步方法的流程图,该方法应用于控制器,可以包括:Based on the above embodiments, the data synchronization method applied to the controller provided by the embodiment of the present invention will be introduced in detail below. Please refer to Figure 3. Figure 3 is a flow chart of another data synchronization method provided by an embodiment of the present invention. This method is applied to a controller and may include:

S301、当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至存储设备中与自身对应的位图;存储设备中设置有与各控制器一一对应的位图。S301. When the managed device is set as the master controller, it independently obtains the read and write permissions of the database in the storage device, and when performing the data writing task to the database, updates the data writing location to the corresponding location in the storage device. Bitmap; a bitmap corresponding to each controller is set in the storage device.

可以理解的是,本控制器是从备用控制器调整为主控制器。如上所述,存储设备中设置有与各控制器一一对应的位图,且这些位图有各控制器进行独立维护。因此当被管理设备设置为主控制器时,本控制器在向数据库执行数据写入任务时,需将数据写入位置更新至存储设备中与自身对应的位图。It can be understood that this controller is adjusted from the backup controller to the main controller. As mentioned above, the storage device is provided with bitmaps corresponding to each controller, and these bitmaps are independently maintained by each controller. Therefore, when the managed device is set as the master controller, when the controller performs data writing tasks to the database, it needs to update the data writing location to the bitmap corresponding to itself in the storage device.

而为确保控制器能够利用位图记录数据写入位置,在设置存储设备时,管理设备可将存储设备中的存储空间划分为多个数据块,并设置位图中的每一位与数据块之间的一一映射关系;随后,管理设备可将记录有映射关系的映射关系信息下发至各控制器,以使主控制器根据数据写入位置对应的数据块,对主控制器的位图中的对应位进行更新。In order to ensure that the controller can use the bitmap to record the data writing location, when setting up the storage device, the management device can divide the storage space in the storage device into multiple data blocks and set each bit in the bitmap to the data block. The one-to-one mapping relationship between them; then, the management device can send the mapping relationship information recorded with the mapping relationship to each controller, so that the main controller can update the bits of the main controller according to the data block corresponding to the data writing position. The corresponding bits in the figure are updated.

基于此,将数据写入位置更新至存储设备中与自身对应的位图,可以包括:Based on this, updating the data writing location to the bitmap corresponding to itself in the storage device may include:

步骤41:获取映射关系信息;映射关系信息记录有位图中的每一位与存储设备中的每一数据块之间的一一映射关系;Step 41: Obtain the mapping relationship information; the mapping relationship information records the one-to-one mapping relationship between each bit in the bitmap and each data block in the storage device;

步骤42:根据数据写入位置对应的数据块,对自身的位图中的对应位进行更新。Step 42: According to the data block corresponding to the data writing position, update the corresponding bit in its own bitmap.

S302、当被管理设备设置为接管控制器时,接管数据库的读写权限,并将主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行主控制器未完成的数据写入业务。S302. When the managed device is set to take over the controller, it takes over the read and write permissions of the database, and synchronizes the data in the bitmap of the main controller to its corresponding bitmap, so as to resume execution of the main control according to its corresponding bitmap. The unfinished data writing business of the server.

同样可以理解的是,本控制器是从备用控制器调整为接管控制器。如上所述,接管控制器在开始向数据库写入数据前,需同步故障的主控制器所产生的位图数据,以掌握主控制器对数据库的写入更新情况。在完成数据同步后,接管控制器正式变更为新的主控制器,进而可根据自身位图恢复执行主控制器未完成的数据写入业务,或在确定先前主控制器没有未完成的数据写入业务时,开始响应新的数据写入业务。It is also understandable that this controller is adjusted from a standby controller to a takeover controller. As mentioned above, before starting to write data to the database, the takeover controller needs to synchronize the bitmap data generated by the failed main controller to grasp the write and update status of the main controller to the database. After the data synchronization is completed, the takeover controller is officially changed to the new main controller, and then the unfinished data writing business of the main controller can be resumed according to its own bitmap, or it can be determined that the previous main controller has no unfinished data writing. When entering the business, it starts to respond to the new data writing business.

对于恢复数据写入业务的场景,本控制器在接收到管理设备下发的主控制器未完成的数据写入业务,并且完成将主控制器的位图中的数据同步至自身对应的位图时,可根据数据写入业务及自身对应的位图确定主控制器对数据写入业务的完成进度,并根据完成进度恢复执行主控制器未完成的数据写入业务。当然,接管控制器也可自行从管理平台获取主控制器未完成的数据写入业务,可根据实际应用需求进行设定。For the scenario of resuming the data writing service, the controller receives the unfinished data writing service of the main controller from the management device and completes the synchronization of the data in the main controller's bitmap to its own corresponding bitmap. At that time, the main controller's completion progress of the data writing service can be determined based on the data writing service and its corresponding bitmap, and the unfinished data writing service of the main controller can be resumed based on the completion progress. Of course, the takeover controller can also obtain the unfinished data writing business of the main controller from the management platform, and can set it according to actual application requirements.

进一步,在完成对位图数据的同步之后,为避免先前故障的主控制器再次上线并读取到旧位图数据发生错误,接管控制器在将主控制器的位图中的数据同步至自身对应的位图之后,还可以清除主控制器的位图中的数据。Furthermore, after completing the synchronization of the bitmap data, in order to prevent the previously failed main controller from coming online again and causing errors in reading the old bitmap data, the takeover controller synchronizes the data in the main controller's bitmap to itself. After corresponding bitmap, you can also clear the data in the bitmap of the main controller.

基于上述实施例,本发明中的管理设备首先可在存储设备中设置数据库以及与各控制器一一对应的位图,其中数据库仅设置一套,并由各控制器共享,而位图用于记录控制器对数据库的更新情况;随后,管理设备可设置主控制器,以使主控制器单独获得数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至主控制器的位图中;而当确定主控制器故障时,管理设备可设置接管控制器,以使接管控制器接管数据库的读写权限,并将主控制器的位图中的数据同步至接管控制器的位图,以便根据接管控制器的位图恢复执行主控制器未完成的数据写入业务,即接管控制器仅需同步主控制器所记录的位图数据,并可根据该位图数据便可掌握主控制器对数据库的更新情况,从而能够恢复执行主控制器未完成的数据写入业务,而不需要对数据库进行完整同步;并且,主控制器生成的位图数据记录在独立于主控制器的存储设备上,进而在主控制器故障时,接管控制器仍可完成数据同步,从而极大地提升了多控存储阵列的稳定性,并降低了数据丢失的风险。Based on the above embodiments, the management device in the present invention can first set a database and a bitmap corresponding to each controller in the storage device, where only one set of databases is set and shared by each controller, and the bitmap is used for Record the update of the database by the controller; then, the management device can set the main controller so that the main controller obtains read and write permissions to the database alone, and when performing data writing tasks to the database, the data writing location is updated to in the bitmap of the main controller; when it is determined that the main controller is faulty, the management device can set a takeover controller so that the takeover controller takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to The bitmap of the takeover controller is used to resume execution of the unfinished data writing business of the main controller based on the bitmap of the takeover controller. That is, the takeover controller only needs to synchronize the bitmap data recorded by the main controller and can use the bitmap according to the bitmap of the takeover controller. The graph data can grasp the update status of the database by the main controller, so that the unfinished data writing business of the main controller can be resumed without the need for complete synchronization of the database; and, the bitmap data generated by the main controller is recorded in On a storage device that is independent of the main controller, when the main controller fails, the takeover controller can still complete data synchronization, thus greatly improving the stability of the multi-control storage array and reducing the risk of data loss.

下面基于具体的示例对上述数据同步方法进行详细介绍。The following is a detailed introduction to the above data synchronization method based on specific examples.

1、选用多控存储系统中前两块硬盘划分8G的分区组成RAID1设备,设定RAID1设备成员盘的前512K空间为bitmap空间。主要包括以下几个步骤:1. Use the first two hard disks in the multi-control storage system to divide 8G partitions to form a RAID1 device, and set the first 512K space of the member disk of the RAID1 device as bitmap space. It mainly includes the following steps:

(1)选取多控存储系统中前两块硬盘作为RAID1设备的成员盘sdb和sdc;(1) Select the first two hard disks in the multi-control storage system as the member disks sdb and sdc of the RAID1 device;

(2)对sdb和sdc进行分区,划分出8G大小的分区空间sdb1和sdc1;(2) Partition sdb and sdc, and divide 8G partition space sdb1 and sdc1;

(3)将sdb1和sdc1组成RAID1设备,并将RAID1设备划分指定chunk大小,将bitmap位图的1bit与chunk做映射,即bitmap中1bit对应于RAID1设备中1个chunk大小;(3) Combine sdb1 and sdc1 to form a RAID1 device, divide the RAID1 device into specified chunk sizes, and map 1 bit of the bitmap bitmap to the chunk, that is, 1 bit in the bitmap corresponds to the size of 1 chunk in the RAID1 device;

(4)使用bitmap位图数据记录RAID1的数据变化,预留并设定RAID1设备成员盘sdb1和sdc1的前512K空间为bitmap空间,具备数据冗余功能。(4) Use bitmap bitmap data to record data changes in RAID1, reserve and set the first 512K space of RAID1 device member disks sdb1 and sdc1 as bitmap space, with data redundancy function.

2、为多控存储系统中每个控制器分配唯一的slot号,每个控制器建立4K大小的bitmap位图空间,bitmap编号和控制器slot号一一对应。主要包括以下几个步骤:2. Assign a unique slot number to each controller in the multi-control storage system. Each controller establishes a 4K bitmap bitmap space. The bitmap number corresponds to the controller slot number one-to-one. It mainly includes the following steps:

(1)多控存储系统中每个控制器具有唯一的slot号,如控制器1的slot为1,控制器N的slot号为N;(1) Each controller in the multi-control storage system has a unique slot number. For example, the slot number of controller 1 is 1, and the slot number of controller N is N;

(2)每个控制器都各自维护一份4K大小的位图数据,即slot号为N的控制器对应bitmapnode00N的位图数据,记录该控制器上所有的写操作及数据变化。(2) Each controller maintains a 4K-sized bitmap data, that is, the controller with slot number N corresponds to the bitmap data of bitmapnode00N, recording all write operations and data changes on the controller.

请参考图4,图4为本发明实施例所提供的一种具有冗余保护功能的RAID1设备数据分布示意图。可见,在sdb和sdc两块硬盘的sdb和sdc两个分区中,前512K空间为位图空间,且每个控制器均对应有4K大小的bitmap位图空间,bitmap编号和控制器slot号一一对应。同时,位图中的每一位与分区中的每一数据块相对应。Please refer to FIG. 4 , which is a schematic diagram of data distribution of a RAID1 device with redundancy protection function provided by an embodiment of the present invention. It can be seen that in the sdb and sdc partitions of the two hard disks, the first 512K space is the bitmap space, and each controller corresponds to a 4K-sized bitmap bitmap space. The bitmap number is the same as the controller slot number. One correspondence. At the same time, each bit in the bitmap corresponds to each data block in the partition.

3、设定控制器访问RAID1设备的读写优先级,将RAID1设备格式化为XFS文件系统,启动数据库服务。主要包括以下几个步骤:3. Set the read and write priority for the controller to access the RAID1 device, format the RAID1 device as an XFS file system, and start the database service. It mainly includes the following steps:

(1)主控制器具备RAID1设备的读写权限,其他备选控制器具备RAID设备的读权限;(1) The main controller has read and write permissions for RAID1 devices, and other alternative controllers have read and write permissions for RAID devices;

(2)将RAID1设备格式化为XFS文件系统,并将XFS文件系统挂载至控制器的系统目录下;(2) Format the RAID1 device into the XFS file system and mount the XFS file system to the system directory of the controller;

(3)将数据库文件保存在XFS文件系统目录下,启动数据库服务,主控制器可以正常进行读写,其他备选控制器可以正常读取数据库数据。(3) Save the database file in the XFS file system directory, start the database service, the main controller can read and write normally, and other alternative controllers can read the database data normally.

4、响应于接收到数据库更新的请求,主控制器数据库服务将数据写入数据库文件中,同时更新其bitmap位图数据变化。主要包括以下几个步骤:4. In response to receiving the database update request, the main controller database service writes the data into the database file and updates its bitmap bitmap data changes at the same time. It mainly includes the following steps:

(1)当主控制器接收到数据库更新的请求即写请求时,主控制器数据库服务将数据写入数据库文件中;(1) When the main controller receives a database update request, that is, a write request, the main controller database service writes the data into the database file;

(2)更新主控制器对应的bitmap00X的位图数据变化,记录写入请求。(2) Update the bitmap data changes of bitmap00X corresponding to the main controller and record the write request.

5、响应于RAID1设备任一成员盘故障,另一成员盘仍然可以正常为数据库提供服务。主要包括以下几个步骤:5. In response to the failure of any member disk of the RAID1 device, the other member disk can still provide services to the database normally. It mainly includes the following steps:

(1)当RAID1设备中任一成员盘故障,将该成员盘置为fail状态(故障状态);(1) When any member disk in the RAID1 device fails, the member disk is set to the fail state (fault state);

(2)RAID1设备中另一成员盘具有故障硬盘的完全备份数据,仍然可以继续为数据库提供服务。(2) Another member disk in the RAID1 device has complete backup data of the failed hard disk and can still continue to provide services to the database.

响应于主控制器故障,接管控制器获取RAID1设备的读写权限,将主控制器的bitmap数据拷贝至本控制器的bitmap空间,继续提供数据库服务。In response to the failure of the main controller, the takeover controller obtains the read and write permissions of the RAID1 device, copies the bitmap data of the main controller to the bitmap space of this controller, and continues to provide database services.

主要包括以下几个步骤:It mainly includes the following steps:

(1)接管控制器获取RAID1设备的读写权限,将主控制器的bitmap数据拷贝至本控制器对应的bitmap空间中,将主控制器的bitmap数据清空;(1) Take over the controller to obtain the read and write permissions of the RAID1 device, copy the bitmap data of the main controller to the corresponding bitmap space of this controller, and clear the bitmap data of the main controller;

(2)接管控制器根据bitmap位图数据,启动RAID1数据同步,将主控制器故障时未写入的数据进行恢复,执行数据同步,保证数据的一致性。(2) The takeover controller starts RAID1 data synchronization based on the bitmap bitmap data, recovers the data that was not written when the main controller failed, and performs data synchronization to ensure data consistency.

(3)接管控制器获取RAID1设备的读写权限,继续提供数据库服务。(3) Take over the controller to obtain the read and write permissions of the RAID1 device and continue to provide database services.

下面对本发明实施例提供的数据同步装置、管理设备、控制器、数据同步系统及计算机可读存储介质进行介绍,下文描述的数据同步装置、管理设备、控制器、数据同步系统及计算机可读存储介质与上文描述的数据同步方法可相互对应参照。The following is an introduction to the data synchronization device, management equipment, controller, data synchronization system and computer-readable storage medium provided by the embodiment of the present invention. The data synchronization device, management equipment, controller, data synchronization system and computer-readable storage medium described below are The media and the data synchronization method described above can be mutually referenced.

请参考图5,图5为本发明实施例所提供的一种数据同步装置的结构框图,该装置应用于管理设备,可以包括:Please refer to Figure 5. Figure 5 is a structural block diagram of a data synchronization device provided by an embodiment of the present invention. The device is applied to management equipment and may include:

存储设备设置模块501,用于在存储设备中设置数据库以及与各控制器一一对应的位图;The storage device setting module 501 is used to set the database and the bitmap corresponding to each controller in the storage device;

主控制器设置模块502,用于设置主控制器,以使主控制器单独获得数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至主控制器的位图中;The main controller setting module 502 is used to set the main controller so that the main controller independently obtains the read and write permissions of the database, and updates the data writing position to the position of the main controller when performing a data writing task to the database. in the picture;

接管控制器设置模块503,用于当确定主控制器故障时设置接管控制器,以使接管控制器接管数据库的读写权限,并将主控制器的位图中的数据同步至接管控制器的位图,以便根据接管控制器的位图恢复执行主控制器未完成的数据写入业务。The takeover controller setting module 503 is used to set the takeover controller when it is determined that the main controller fails, so that the takeover controller takes over the read and write permissions of the database, and synchronizes the data in the bitmap of the main controller to the takeover controller. bitmap, so that the unfinished data writing business of the main controller can be resumed based on the bitmap of the takeover controller.

可选地,该装置还可以包括:Optionally, the device may also include:

磁盘阵列组件模块,用于在存储系统中选择多块硬盘设备,并利用多块硬盘设备组建磁盘阵列,以使磁盘阵列至少允许一块硬盘设备损坏而不中断存储服务;将磁盘阵列设置为存储设备。The disk array component module is used to select multiple hard disk devices in the storage system and use multiple hard disk devices to form a disk array, so that the disk array can allow at least one hard disk device to be damaged without interrupting storage services; set the disk array as a storage device .

可选地,磁盘阵列组件模块,具体用于:Optionally, the disk array component module is specifically used for:

在各硬盘设备中划分出预设大小的分区空间;Divide partition space of preset size in each hard disk device;

利用各硬盘设备对应的分区空间组建磁盘阵列。Use the partition space corresponding to each hard disk device to build a disk array.

可选地,接管控制器设置模块503,还可以包括:Optionally, taking over the controller setting module 503 may also include:

数据写入业务下发模块,用于将主控制器未完成的数据写入业务下发至接管控制器,以使接管控制器在将主控制器的位图中的数据同步至接管控制器的位图之后,根据数据写入业务及接管控制器的位图确定主控制器对数据写入业务的完成进度,并根据完成进度恢复执行主控制器未完成的数据写入业务。The data writing service delivery module is used to deliver the unfinished data writing service of the main controller to the takeover controller, so that the takeover controller can synchronize the data in the bitmap of the main controller to the takeover controller. After the bitmap, the completion progress of the data writing business by the main controller is determined based on the data writing business and the bitmap of the takeover controller, and the unfinished data writing business of the main controller is resumed based on the completion progress.

可选地,该装置还可以包括:Optionally, the device may also include:

映射关系设置模块,用于将存储设备中的存储空间划分为多个数据块,并设置位图中的每一位与数据块之间的一一映射关系;The mapping relationship setting module is used to divide the storage space in the storage device into multiple data blocks and set the one-to-one mapping relationship between each bit in the bitmap and the data blocks;

映射关系下发模块,用于将记录有映射关系的映射关系信息下发至各控制器,以使主控制器根据数据写入位置对应的数据块,对主控制器的位图中的对应位进行更新。The mapping relationship delivery module is used to deliver the mapping relationship information recorded with the mapping relationship to each controller, so that the main controller can update the corresponding bits in the bitmap of the main controller according to the data block corresponding to the data writing position. Make an update.

请参考图6,图6为本发明实施例所提供的另一种数据同步装置的结构框图,该装置应用于控制器,可以包括:Please refer to Figure 6. Figure 6 is a structural block diagram of another data synchronization device provided by an embodiment of the present invention. This device is applied to a controller and may include:

主控制器模块601,用于当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向数据库执行数据写入任务时,将数据写入位置更新至存储设备中与自身对应的位图;存储设备中设置有与各控制器一一对应的位图;The main controller module 601 is used to independently obtain read and write permissions for the database in the storage device when the managed device is set as the main controller, and when performing data writing tasks to the database, update the data writing location to the storage device. The bitmap corresponding to itself in the device; the bitmap corresponding to each controller is set in the storage device;

接管模块602,用于当被管理设备设置为接管控制器时,接管数据库的读写权限,并将主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行主控制器未完成的数据写入业务。The takeover module 602 is used to take over the read and write permissions of the database when the managed device is set to take over the controller, and synchronize the data in the bitmap of the main controller to its corresponding bitmap, so that the data in the bitmap of the main controller can be synchronized according to the corresponding bitmap of the managed device. Resume the execution of the unfinished data writing service of the main controller.

可选地,接管模块602,还可以包括:Optionally, the takeover module 602 may also include:

业务恢复子模块,用于在接收到管理设备下发的主控制器未完成的数据写入业务,并且完成将主控制器的位图中的数据同步至自身对应的位图时,根据数据写入业务及自身对应的位图确定主控制器对数据写入业务的完成进度,并根据完成进度恢复执行主控制器未完成的数据写入业务。The business recovery submodule is used to receive the unfinished data writing service of the main controller issued by the management device and complete the synchronization of the data in the main controller's bitmap to its corresponding bitmap. According to the data writing The incoming business and its corresponding bitmap determine the completion progress of the data writing business by the main controller, and resume execution of the unfinished data writing business of the main controller based on the completion progress.

可选地,该装置还可以包括:Optionally, the device may also include:

清除模块,用于清除主控制器的位图中的数据。Clear module, used to clear the data in the bitmap of the main controller.

可选地,主控制器模块601,可以用于:Optionally, the main controller module 601 can be used for:

获取映射关系信息;映射关系信息记录有位图中的每一位与存储设备中的每一数据块之间的一一映射关系;根据数据写入位置对应的数据块,对自身的位图中的对应位进行更新。Obtain the mapping relationship information; the mapping relationship information records the one-to-one mapping relationship between each bit in the bitmap and each data block in the storage device; according to the data block corresponding to the data writing position, map the bitmap in its own The corresponding bit is updated.

请参考图7,图7为本发明实施例所提供的一种管理设备的结构框图,本发明实施例提供了一种管理设备10,包括处理器11和存储器12;其中,所述存储器12,用于保存计算机程序;所述处理器11,用于在执行所述计算机程序时执行前述实施例提供的数据同步方法。Please refer to Figure 7, which is a structural block diagram of a management device provided by an embodiment of the present invention. An embodiment of the present invention provides a management device 10, including a processor 11 and a memory 12; wherein, the memory 12, It is used to save the computer program; the processor 11 is used to execute the data synchronization method provided by the previous embodiment when executing the computer program.

关于上述数据同步方法的具体过程可以参考前述实施例中提供的相应内容,在此不再进行赘述。Regarding the specific process of the above data synchronization method, reference may be made to the corresponding content provided in the foregoing embodiments, which will not be described again here.

并且,所述存储器12作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,存储方式可以是短暂存储或者永久存储。Moreover, the memory 12, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the storage method can be short-term storage or permanent storage.

另外,所述管理设备10还包括电源13、通信接口14、输入输出接口15和通信总线16;其中,所述电源13用于为所述管理设备10上的各硬件设备提供工作电压;所述通信接口14能够为所述管理设备10创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本发明技术方案的任意通信协议,在此不对其进行具体限定;所述输入输出接口15,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In addition, the management device 10 also includes a power supply 13, a communication interface 14, an input and output interface 15 and a communication bus 16; wherein the power supply 13 is used to provide operating voltage for each hardware device on the management device 10; The communication interface 14 can create a data transmission channel between the management device 10 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, which is not specifically limited here; The input and output interface 15 is used to obtain external input data or output data to the external world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

请参考图8,图8为本发明实施例所提供的一种控制器的结构框图,本发明实施例提供了一种控制器20,包括处理器21和存储器22;其中,所述存储器22,用于保存计算机程序;所述处理器21,用于在执行所述计算机程序时执行前述实施例提供的数据同步方法。Please refer to Figure 8. Figure 8 is a structural block diagram of a controller provided by an embodiment of the present invention. An embodiment of the present invention provides a controller 20, including a processor 21 and a memory 22; wherein, the memory 22, It is used to save the computer program; the processor 21 is used to execute the data synchronization method provided by the previous embodiment when executing the computer program.

关于上述数据同步方法的具体过程可以参考前述实施例中提供的相应内容,在此不再进行赘述。Regarding the specific process of the above data synchronization method, reference may be made to the corresponding content provided in the foregoing embodiments, which will not be described again here.

并且,所述存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,存储方式可以是短暂存储或者永久存储。Moreover, the memory 22, as a carrier for resource storage, may be a read-only memory, a random access memory, a magnetic disk or an optical disk, and the storage method may be short-term storage or permanent storage.

另外,所述控制器20还包括电源23、通信接口24、输入输出接口25和通信总线26;其中,所述电源23用于为所述控制器20上的各硬件设备提供工作电压;所述通信接口24能够为所述控制器20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本发明技术方案的任意通信协议,在此不对其进行具体限定;所述输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In addition, the controller 20 also includes a power supply 23, a communication interface 24, an input and output interface 25 and a communication bus 26; wherein the power supply 23 is used to provide working voltage for each hardware device on the controller 20; The communication interface 24 can create a data transmission channel between the controller 20 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, which is not specifically limited here; The input and output interface 25 is used to obtain external input data or output data to the external world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.

请参考图1,图1为本发明实施例所提供的一种数据同步系统的结构框图,该装置可以包括:Please refer to Figure 1, which is a structural block diagram of a data synchronization system provided by an embodiment of the present invention. The device may include:

存储设备30,用于设置数据库以及与各控制器一一对应的位图;Storage device 30, used to set the database and bitmaps corresponding to each controller;

管理设备10,用于执行如上所述的应用于管理设备的数据同步方法;Management device 10, configured to perform the data synchronization method applied to the management device as described above;

控制器20,用于执行如上所述的应用于控制器的数据同步方法。The controller 20 is configured to execute the data synchronization method applied to the controller as described above.

由于系统部分的实施例与数据同步方法部分的实施例相互对应,因此存储介质部分的实施例请参见数据同步方法部分的实施例的描述,这里不再赘述。Since the embodiments of the system part and the embodiments of the data synchronization method part correspond to each other, for the embodiments of the storage medium part, please refer to the description of the embodiments of the data synchronization method part, which will not be described again here.

本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述任意实施例的数据同步方法的步骤。Embodiments of the present invention also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the data synchronization method of any of the above embodiments are implemented.

由于计算机可读存储介质部分的实施例与数据同步方法部分的实施例相互对应,因此存储介质部分的实施例请参见数据同步方法部分的实施例的描述,这里不再赘述。Since the embodiments of the computer-readable storage medium part correspond to the embodiments of the data synchronization method part, for the embodiments of the storage medium part, please refer to the description of the embodiments of the data synchronization method part, which will not be described again here.

说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in the specification is described in a progressive manner. Each embodiment focuses on its differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple. For relevant details, please refer to the description in the method section.

专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. In order to clearly illustrate the possible functions of hardware and software, Interchangeability, in the above description, the composition and steps of each example have been generally described according to functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered to be beyond the scope of the present invention.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination of both. Software modules may be located in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or anywhere in the field of technology. any other known form of storage media.

以上对本发明所提供的数据同步方法、装置、管理设备、控制器、系统及介质进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The data synchronization method, device, management equipment, controller, system and medium provided by the present invention have been introduced in detail above. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and the core idea of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of the claims of the present invention.

Claims (15)

1.一种数据同步方法,其特征在于,应用于管理设备,包括:1. A data synchronization method, characterized in that it is applied to management equipment, including: 在存储设备中设置数据库以及与各控制器一一对应的位图;Set the database and the bitmap corresponding to each controller in the storage device; 设置主控制器,以使所述主控制器单独获得所述数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述主控制器的位图中;Set the main controller so that the main controller independently obtains the read and write permissions of the database, and when performing a data writing task to the database, updates the data writing position to the bitmap of the main controller middle; 当确定所述主控制器故障时设置接管控制器,以使所述接管控制器接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至所述接管控制器的位图,以便根据所述接管控制器的位图恢复执行所述主控制器未完成的数据写入业务。When it is determined that the main controller fails, a takeover controller is set so that the takeover controller takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to the takeover controller. bitmap, so that the unfinished data writing service of the main controller can be resumed according to the bitmap of the takeover controller. 2.根据权利要求1所述的数据同步方法,其特征在于,在存储设备中设置数据库以及与各控制器一一对应的位图之前,还包括:2. The data synchronization method according to claim 1, characterized in that, before setting the database and the bitmap corresponding to each controller in the storage device, it also includes: 在存储系统中选择多块硬盘设备,并利用所述多块硬盘设备组建磁盘阵列,以使所述磁盘阵列至少允许一块硬盘设备损坏而不中断存储服务;Select multiple hard disk devices in the storage system, and use the multiple hard disk devices to form a disk array, so that the disk array allows at least one hard disk device to be damaged without interrupting storage services; 将所述磁盘阵列设置为所述存储设备。The disk array is configured as the storage device. 3.根据权利要求2所述的数据同步方法,其特征在于,所述利用所述多块硬盘设备组建磁盘阵列,包括:3. The data synchronization method according to claim 2, characterized in that said utilizing the plurality of hard disk devices to form a disk array includes: 在各所述硬盘设备中划分出预设大小的分区空间;Divide a partition space of a preset size in each of the hard disk devices; 利用各所述硬盘设备对应的分区空间组建所述磁盘阵列。The disk array is constructed using the partition space corresponding to each hard disk device. 4.根据权利要求1所述的数据同步方法,其特征在于,在设置接管控制器之后,还包括:4. The data synchronization method according to claim 1, characterized in that, after setting the takeover controller, it further includes: 将所述主控制器未完成的数据写入业务下发至所述接管控制器,以使所述接管控制器在将所述主控制器的位图中的数据同步至所述接管控制器的位图之后,根据所述数据写入业务及接管控制器的位图确定所述主控制器对所述数据写入业务的完成进度,并根据所述完成进度恢复执行所述主控制器未完成的数据写入业务。Send the unfinished data writing service of the main controller to the takeover controller, so that the takeover controller synchronizes the data in the bitmap of the main controller to the takeover controller. After the bitmap, determine the completion progress of the data writing service by the main controller according to the bitmap of the data writing service and the takeover controller, and resume execution of the unfinished work of the main controller according to the completion progress. data writing business. 5.根据权利要求1至4任一项所述的数据同步方法,其特征在于,还包括:5. The data synchronization method according to any one of claims 1 to 4, further comprising: 将所述存储设备中的存储空间划分为多个数据块,并设置所述位图中的每一位与所述数据块之间的一一映射关系;Divide the storage space in the storage device into multiple data blocks, and set a one-to-one mapping relationship between each bit in the bitmap and the data blocks; 将记录有所述映射关系的映射关系信息下发至各所述控制器,以使所述主控制器根据所述数据写入位置对应的数据块,对所述主控制器的位图中的对应位进行更新。The mapping relationship information recorded with the mapping relationship is delivered to each of the controllers, so that the main controller writes the data in the bitmap of the main controller according to the data block corresponding to the data writing position. The corresponding bit is updated. 6.一种数据同步方法,其特征在于,应用于控制器,所述方法包括:6. A data synchronization method, characterized in that it is applied to a controller, and the method includes: 当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述存储设备中与自身对应的位图;所述存储设备中设置有与各控制器一一对应的位图;When the managed device is set as the master controller, it independently obtains the read and write permissions of the database in the storage device, and when performing data writing tasks to the database, updates the data writing location to the storage device and itself. Corresponding bitmap; the storage device is provided with a bitmap that corresponds to each controller one-to-one; 当被所述管理设备设置为接管控制器时,接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行所述主控制器未完成的数据写入业务。When the management device is set to take over the controller, it takes over the read and write permissions of the database and synchronizes the data in the bitmap of the main controller to its own corresponding bitmap so that it can be used according to its own corresponding bitmap. Resume execution of unfinished data writing services of the main controller. 7.根据权利要求6所述的数据同步方法,其特征在于,在被所述管理设备设置为接管控制器之后,还包括:7. The data synchronization method according to claim 6, characterized in that, after being set by the management device to take over the controller, it further includes: 在接收到所述管理设备下发的所述主控制器未完成的数据写入业务,并且完成将所述主控制器的位图中的数据同步至自身对应的位图时,根据所述数据写入业务及自身对应的位图确定所述主控制器对所述数据写入业务的完成进度,并根据所述完成进度恢复执行所述主控制器未完成的数据写入业务。After receiving the unfinished data writing service of the main controller issued by the management device and completing the synchronization of the data in the bitmap of the main controller to its corresponding bitmap, according to the data The writing service and its corresponding bitmap determine the completion progress of the data writing service by the main controller, and resume execution of the unfinished data writing service by the main controller according to the completion progress. 8.根据权利要求6所述的数据同步方法,其特征在于,在将所述主控制器的位图中的数据同步至自身对应的位图之后,还包括:8. The data synchronization method according to claim 6, characterized in that, after synchronizing the data in the bitmap of the main controller to its corresponding bitmap, it further includes: 清除所述主控制器的位图中的数据。Clears the data in the host controller's bitmap. 9.根据权利要求6至8任一项所述的数据同步方法,其特征在于,所述将数据写入位置更新至所述存储设备中与自身对应的位图,包括:9. The data synchronization method according to any one of claims 6 to 8, wherein the updating of the data writing position to the bitmap corresponding to itself in the storage device includes: 获取映射关系信息;所述映射关系信息记录有所述位图中的每一位与所述存储设备中的每一数据块之间的一一映射关系;Obtain mapping relationship information; the mapping relationship information records a one-to-one mapping relationship between each bit in the bitmap and each data block in the storage device; 根据所述数据写入位置对应的数据块,对自身的位图中的对应位进行更新。According to the data block corresponding to the data writing position, the corresponding bit in its own bitmap is updated. 10.一种数据同步装置,其特征在于,应用于管理设备,包括:10. A data synchronization device, characterized in that it is applied to management equipment, including: 存储设备设置模块,用于在存储设备中设置数据库以及与各控制器一一对应的位图;The storage device setting module is used to set the database in the storage device and the bitmap corresponding to each controller; 主控制器设置模块,用于设置主控制器,以使所述主控制器单独获得所述数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述主控制器的位图中;The main controller setting module is used to set the main controller so that the main controller independently obtains the read and write permissions of the database, and when performing a data writing task to the database, updates the data writing position to In the bitmap of the main controller; 接管控制器设置模块,用于当确定所述主控制器故障时设置接管控制器,以使所述接管控制器接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至所述接管控制器的位图,以便根据所述接管控制器的位图恢复执行所述主控制器未完成的数据写入业务。A takeover controller setting module, configured to set a takeover controller when it is determined that the main controller is faulty, so that the takeover controller takes over the read and write permissions of the database and changes the bitmap in the main controller to The data is synchronized to the bitmap of the takeover controller, so that the unfinished data writing service of the main controller can be resumed according to the bitmap of the takeover controller. 11.一种数据同步装置,其特征在于,应用于控制器,包括:11. A data synchronization device, characterized in that it is applied to a controller and includes: 主控制器模块,用于当被管理设备设置为主控制器时,单独获得存储设备中的数据库的读写权限,并在向所述数据库执行数据写入任务时,将数据写入位置更新至所述存储设备中与自身对应的位图;所述存储设备中设置有与各控制器一一对应的位图;The main controller module is used to independently obtain read and write permissions for the database in the storage device when the managed device is set as the main controller, and when performing data writing tasks to the database, update the data writing location to A bitmap corresponding to itself in the storage device; a bitmap corresponding to each controller in a one-to-one manner is provided in the storage device; 接管模块,用于当被所述管理设备设置为接管控制器时,接管所述数据库的读写权限,并将所述主控制器的位图中的数据同步至自身对应的位图,以便根据自身对应的位图恢复执行所述主控制器未完成的数据写入业务。A takeover module, configured to take over the read and write permissions of the database when the management device is set to take over the controller, and synchronize the data in the bitmap of the main controller to its corresponding bitmap so that the data can be processed according to the The corresponding bitmap resumes execution of the unfinished data writing service of the main controller. 12.一种管理设备,其特征在于,包括:12. A management device, characterized in that it includes: 存储器,用于存储计算机程序;Memory, used to store computer programs; 处理器,用于执行所述计算机程序时实现如权利要求1至5任一项所述的数据同步方法。A processor, configured to implement the data synchronization method according to any one of claims 1 to 5 when executing the computer program. 13.一种控制器,其特征在于,包括:13. A controller, characterized by comprising: 存储器,用于存储计算机程序;Memory, used to store computer programs; 处理器,用于执行所述计算机程序时实现如权利要求6至9任一项所述的数据同步方法。A processor, configured to implement the data synchronization method according to any one of claims 6 to 9 when executing the computer program. 14.一种数据同步系统,其特征在于,包括:14. A data synchronization system, characterized by including: 存储设备,用于设置数据库以及与各控制器一一对应的位图;Storage device, used to set the database and the bitmap corresponding to each controller; 管理设备,用于执行如权利要求1至5任一项所述的数据同步方法;Management device, used to perform the data synchronization method according to any one of claims 1 to 5; 控制器,用于执行如权利要求6至9任一项所述的数据同步方法。A controller configured to execute the data synchronization method according to any one of claims 6 to 9. 15.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现如权利要求1至5任一项所述的数据同步方法和/或如权利要求6至9任一项所述的数据同步方法。15. A computer-readable storage medium, characterized in that computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are loaded and executed by a processor, claims 1 to 5 are implemented. The data synchronization method according to any one of claims 6 to 9.
CN202311329650.6A 2023-10-13 2023-10-13 Data synchronization method, device, management equipment, controller, system and media Pending CN117349381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311329650.6A CN117349381A (en) 2023-10-13 2023-10-13 Data synchronization method, device, management equipment, controller, system and media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311329650.6A CN117349381A (en) 2023-10-13 2023-10-13 Data synchronization method, device, management equipment, controller, system and media

Publications (1)

Publication Number Publication Date
CN117349381A true CN117349381A (en) 2024-01-05

Family

ID=89356991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311329650.6A Pending CN117349381A (en) 2023-10-13 2023-10-13 Data synchronization method, device, management equipment, controller, system and media

Country Status (1)

Country Link
CN (1) CN117349381A (en)

Similar Documents

Publication Publication Date Title
US8504765B2 (en) Method of improving efficiency of capacity of volume used for copy function and apparatus thereof
US6950915B2 (en) Data storage subsystem
US8010485B1 (en) Background movement of data between nodes in a storage cluster
US7778960B1 (en) Background movement of data between nodes in a storage cluster
US8285824B2 (en) Storage system and data replication method that refuses one or more requests for changing the first logical configuration information until the first storage apparatus and second storage apparatus are synchronized
US8209505B2 (en) Storage system and method of taking over logical unit in storage system
JP5286212B2 (en) Remote copy control method and system in storage cluster environment
CN110674539B (en) Hard disk protection device, method and system
JP2021174392A (en) Remote copy system and remote copy control method
US10846012B2 (en) Storage system for minimizing required storage capacity during remote volume replication pair duplication
JP2007304859A (en) Computer system for managing the number of writes to a storage medium and control method therefor
JP2020047215A (en) Storage system and storage control method
US10210060B2 (en) Online NVM format upgrade in a data storage system operating with active and standby memory controllers
JP2010186285A (en) Mirroring controller, storage device, and mirroring control method
JP2011028520A (en) Disk array apparatus and physical disk restoration method
CN116204137B (en) Distributed storage system, control method, device and equipment based on DPU
CN117349381A (en) Data synchronization method, device, management equipment, controller, system and media
US20230350753A1 (en) Storage system and failure handling method
CN106648473B (en) A kind of dual control RAID synchronous method and device
JP2009265973A (en) Data synchronization system, failure recovery method, and program
CN103838639A (en) Method, device and system for recovering metadata of virtual disk
JP2021033782A (en) Remote copy system
CN112328512A (en) Cache synchronization system and method applied to multi-control storage system
CN111400098A (en) Copy management method and device, electronic equipment and storage medium
JP2004102815A (en) Method for copying data between logical disks, program for copying data between logical disks, and disk controller

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination