Method, device, equipment and readable medium for synchronizing database of dual-control storage array
By using RAID1 devices and XFS file systems in dual-control storage arrays, combined with the access permission conversion of the primary and secondary controllers, the complexity and consistency of database synchronization problems are solved, and high reliability and stability of database information are achieved.
Patent Information
- Application Number
- CN202111064289.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-10
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-09-10
AI Technical Summary
The existing dual-control storage array database synchronization technology has problems such as split-brain, data timeout synchronization, implementation complexity, and inconsistency between the primary and backup databases. Especially when network jitters or primary controller failure occurs, database information is easily lost.
By selecting two hard disks in the storage array as coffer disks, partitions are divided into preset sizes to form a RAID1 device and formatted as an XFS file system. The access priority and read and write permissions of the primary and secondary controllers are set. The primary controller is In the event of a failure, the backup controller is switched to continue providing database services.
It effectively ensures the consistency of the primary and secondary databases, prevents the loss of database information, simplifies the database synchronization process, and improves the reliability and stability of the system.
Smart Images

Figure CN113805807B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and more specifically to a method, device, equipment and readable medium for synchronizing a dual-control storage array database. Background Art
[0002] With the explosive growth of data and the development of storage technology, dual-control storage arrays have gradually become a storage method to improve data reliability and have been widely used. Dual-control storage arrays are composed of a master controller and a backup controller. Existing dual-control storage arrays are usually managed by a web system for storage resources. The database (DB) stores storage resource information such as users, hard disks, storage pools, and logical volumes in the storage array. It is a very important information source for dual-control storage arrays to achieve data recovery and master-slave switching.
[0003] In the existing database synchronization technology, by dividing the designated area in the system disk of the main controller and the standby controller for storing database files, the database information is updated on the main controller and periodically synchronized to the standby controller. Since the system disks between the two controllers are isolated, it is necessary to achieve database information synchronization through additional means such as network transmission. When the network jitters, it is easy to cause problems such as brain split and data timeout synchronization. In addition, when the main controller fails (such as abnormal power failure or downtime), if the database synchronization is being performed, it will cause inconsistency between the database contents of the main controller and the standby controller. Therefore, the existing database synchronization technology has problems such as complex implementation, inconsistency between the main and standby databases, and loss of database information. Summary of the invention
[0004] In view of this, the purpose of the embodiments of the present invention is to propose a method, device, equipment and readable medium for synchronizing a dual-control storage array database. By using the technical solution of the present invention, the consistency of the primary and standby databases can be effectively guaranteed and the loss of database information can be prevented.
[0005] Based on the above purpose, the present invention provides a method for synchronizing a dual-control storage array database, comprising the following steps:
[0006] Select two hard disks in the storage array as coffer disks, and divide the coffer disks into partitions of a preset size;
[0007] The partitions of preset size in the coffer disk are organized into a RAID1 (Redundant Arrays of Independent Disks Level 1, disk data mirroring to achieve data redundancy) device, and formatted into an XFS (X File System, a high-performance log file system) file system;
[0008] Set the priority and read / write permissions for the primary and standby controllers to access the coffer disk;
[0009] The main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk;
[0010] In response to receiving the request for database update, the master controller database service writes the data into the database file;
[0011] In response to the failure of the primary controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0012] According to an embodiment of the present invention, selecting two hard disks in a storage array as coffer disks and dividing the coffer disks into partitions of a preset size includes:
[0013] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0014] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0015] Use the partitioning tool in any controller to partition the hard disk in slot 1 and create a 4G partition space / dev / sdc1.
[0016] According to one embodiment of the present invention, partitions of preset sizes in a coffer disk are organized into a RAID1 device and formatted into an XFS file system, including:
[0017] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0018] Use the command in either controller to format the RAID1 device as XFS file system.
[0019] According to one embodiment of the present invention, setting the priority and read / write permissions of the main controller and the standby controller for accessing the coffer disk includes:
[0020] In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions;
[0021] In response to the failure or absence of the primary controller, the standby controller has read and write permissions for the coffer disk.
[0022] According to an embodiment of the present invention, in response to a failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk and mounts the XFS file system to the system directory, and starting the database service includes:
[0023] In response to a failure of the primary controller, marking the standby controller as a new primary controller;
[0024] The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory;
[0025] The new master controller reads the database file and starts the database service.
[0026] Another aspect of the embodiments of the present invention further provides a device for synchronizing a dual-control storage array database, the device comprising:
[0027] A partitioning module, the partitioning module is configured to select two hard disks in the storage array as coffer disks, and divide the coffer disks into partitions of a preset size;
[0028] A conversion module, the conversion module is configured to form a RAID1 device with partitions of a preset size in the coffer disk and format it into an XFS file system;
[0029] A setting module, the setting module is configured to set the priority and read and write permissions of the main controller and the standby controller to access the coffer disk;
[0030] Mounting module, the mounting module is configured as the main controller to mount the XFS file system to the system directory and start the database service, and save the generated database file to the safe disk;
[0031] A writing module, wherein the writing module is configured to respond to receiving a request for database update, and the main controller database service writes data into the database file;
[0032] The startup module is configured to respond to a failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0033] According to one embodiment of the present invention, the partitioning module is further configured as follows:
[0034] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0035] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0036] Use the partitioning tool in any controller to partition the hard disk in slot 1 and create a 4G partition space / dev / sdc1.
[0037] According to one embodiment of the present invention, the conversion module is further configured to:
[0038] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0039] Use the command in either controller to format the RAID1 device as XFS file system.
[0040] Another aspect of the embodiments of the present invention further provides a computer device, the computer device comprising:
[0041] at least one processor; and
[0042] The memory stores computer instructions that can be executed on the processor, and the instructions are executed by the processor to implement the steps of the method described above.
[0043] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the method described above are implemented.
[0044] The present invention has the following beneficial technical effects: the method for synchronizing a database of a dual-control storage array provided by the technical solution of the present invention selects two hard disks in the storage array as safe disks, and divides the safe disks into partitions of a preset size; the partitions of the preset size in the safe disks form a RAID1 device, and format it into an XFS file system; the priority and read-write permissions of the main controller and the standby controller for accessing the safe disk are set; the main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk; in response to receiving a request for database update, the main controller database service writes data to the database file; in response to a failure of the main controller, the standby controller obtains the read-write permissions of the safe disk, mounts the XFS file system to the system directory, and starts the database service. The technical solution can effectively ensure the consistency of the main and standby databases and prevent the loss of database information. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these drawings without paying creative work.
[0046] Figure 1 A schematic flow chart of a method for synchronizing a dual-control storage array database according to an embodiment of the present invention;
[0047] Figure 2A schematic diagram of a dual-control storage array database synchronization device according to an embodiment of the present invention;
[0048] Figure 3 is a schematic diagram of a computer device according to an embodiment of the present invention;
[0049] Figure 4 FIG. 1 is a schematic diagram of a computer-readable storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention are further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0051] Based on the above purpose, a first aspect of an embodiment of the present invention provides an embodiment of a method for synchronizing a database of a dual-controller storage array. Figure 1 Shown is a schematic flow chart of the method.
[0052] like Figure 1 As shown in , the method may include the following steps:
[0053] S1 selects two hard disks in the storage array as coffer disks, and divides the coffer disks into partitions of a preset size.
[0054] Select the hard disks in slot 0 and slot 1 of the dual-controller storage array as coffer disks. Use the partitioning tool in either controller to partition the hard disk in slot 0 to create a 4G partition space / dev / sdb1. Use the partitioning tool in either controller to partition the hard disk in slot 1 to create a 4G partition space / dev / sdc1.
[0055] S2 organizes the partitions of preset sizes in the coffer disk into a RAID1 device and formats it as the XFS file system.
[0056] Use a command in any controller to form the partitions / dev / sdb1 and / dev / sdc1 of the two coffer disks into a RAID1 device, which has data redundancy capability, and then use a command in any controller to format the RAID1 device into an XFS file system.
[0057] S3 sets the priority and read / write permissions for the primary and standby controllers to access the coffer disk.
[0058] When both the active and standby controllers are normal, the active controller has read and write permissions for the coffer disk and can perform read and write operations. The standby controller has read-only permissions and cannot perform write operations. When the active controller fails or is not in place, the standby controller has read and write permissions for the coffer disk and can perform read and write operations.
[0059] The S4 master controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the coffer disk.
[0060] When both controllers are normal, the master controller has the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, starts the database service, generates database files, stores the database files in the XFS file system, and finally saves them to the coffer disk. The master controller provides database services.
[0061] S5 In response to receiving the request for database update, the main controller database service writes the data into the database file.
[0062] The main controller receives a request to update the database, and the database service performs read and write operations on the database file. When there is a write operation on the database file, the data is written to the safe disk.
[0063] S6 In response to the failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0064] When the main controller fails for some reason such as power failure or downtime, the standby controller is marked as the main controller. At this time, the standby controller has the read and write permissions of the coffer disk. The standby controller imports the RAID1 device composed of the coffer disk and mounts the XFS file system to the system directory. The standby controller reads the database file, starts the database service, and continues to provide database services. The standby controller responds to the latest database request and performs database update operations.
[0065] The purpose of the present invention is to propose a database synchronization method for a dual-control storage array. By selecting two shared hard disks in the array as coffer disks and storing database files in the coffer disks, the synchronization of the primary and standby databases can be achieved without additional synchronization operations. At the same time, when the primary and standby switches, the standby controller has the access rights to the database files in the coffer disk and takes over the database service. The method has the advantages of simple implementation, effective guarantee of consistency of the primary and standby databases, and prevention of database information loss.
[0066] The technical solution of the present invention can effectively ensure the consistency of the primary and backup databases and prevent the loss of database information.
[0067] In a preferred embodiment of the present invention, selecting two hard disks in a storage array as coffer disks, and dividing the coffer disks into partitions of a preset size comprises:
[0068] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0069] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0070] In any controller, a partitioning tool is used to partition the hard disk in slot 1 to create a 4G partition space / dev / sdc1. In other embodiments, hard disks in any two slots can be selected as coffer disks, and the partition space can also be selected based on actual needs.
[0071] In a preferred embodiment of the present invention, partitions of preset sizes in the coffer disk are organized into a RAID1 device and formatted into an XFS file system, including:
[0072] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0073] Use the command in either controller to format the RAID1 device as XFS file system.
[0074] In a preferred embodiment of the present invention, setting the priority and read / write permissions of the main controller and the standby controller for accessing the coffer disk includes:
[0075] In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions;
[0076] In response to the failure or absence of the primary controller, the standby controller has read and write permissions for the coffer disk.
[0077] In a preferred embodiment of the present invention, in response to a failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk and mounts the XFS file system to the system directory, and starting the database service includes:
[0078] In response to a failure of the primary controller, marking the standby controller as a new primary controller;
[0079] The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory;
[0080] The new master controller reads the database file and starts the database service.
[0081] The technical solution of the present invention can effectively ensure the consistency of the primary and backup databases and prevent the loss of database information.
[0082] It should be noted that a person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. The above-mentioned computer program embodiment can achieve the same or similar effect as any of the above-mentioned method embodiments corresponding thereto.
[0083] In addition, the method disclosed in the embodiment of the present invention can also be implemented as a computer program executed by a CPU, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the CPU, the above functions defined in the method disclosed in the embodiment of the present invention are performed.
[0084] Based on the above purpose, a second aspect of the embodiment of the present invention provides a device for synchronizing a database of a dual-control storage array, such as Figure 2 As shown, the device 200 includes:
[0085] A partitioning module 201, wherein the partitioning module 201 is configured to select two hard disks in the storage array as coffer disks, and to partition the coffer disks into partitions of a preset size;
[0086] The conversion module 202 is configured to form a RAID1 device with partitions of a preset size in the coffer disk and format it into an XFS file system;
[0087] Setting module 203, the setting module 203 is configured to set the priority and read and write permissions of the main controller and the standby controller to access the coffer disk;
[0088] Mounting module 204, the mounting module 204 is configured as a main controller to mount the XFS file system to the system directory and start the database service, and save the generated database file to the safe disk;
[0089] The writing module 205 is configured to respond to receiving a request for database update, and the main controller database service writes data into the database file;
[0090] The startup module 206 is configured to respond to the failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0091] In a preferred embodiment of the present invention, the division module 201 is further configured as follows:
[0092] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0093] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0094] Use the partitioning tool in any controller to partition the hard disk in slot 1 and create a 4G partition space / dev / sdc1.
[0095] In a preferred embodiment of the present invention, the conversion module is further configured to:
[0096] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0097] Use the command in either controller to format the RAID1 device as XFS file system.
[0098] Based on the above purpose, a third aspect of an embodiment of the present invention provides a computer device. Figure 3 FIG. 2 is a schematic diagram of an embodiment of a computer device provided by the present invention. Figure 3 As shown, the embodiment of the present invention includes the following apparatus: at least one processor 21; and a memory 22, the memory 22 stores computer instructions 23 that can be run on the processor, and when the instructions are executed by the processor, the following method is implemented:
[0099] Select two hard disks in the storage array as coffer disks, and divide the coffer disks into partitions of a preset size;
[0100] Organize the partitions of preset size in the coffer disk into a RAID1 device and format it as the XFS file system;
[0101] Set the priority and read / write permissions for the primary and standby controllers to access the coffer disk;
[0102] The main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk;
[0103] In response to receiving the request for database update, the master controller database service writes the data into the database file;
[0104] In response to the failure of the primary controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0105] In a preferred embodiment of the present invention, selecting two hard disks in a storage array as coffer disks, and dividing the coffer disks into partitions of a preset size comprises:
[0106] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0107] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0108] Use the partitioning tool in any controller to partition the hard disk in slot 1 and create a 4G partition space / dev / sdc1.
[0109] In a preferred embodiment of the present invention, partitions of preset sizes in the coffer disk are organized into a RAID1 device and formatted into an XFS file system, including:
[0110] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0111] Use the command in either controller to format the RAID1 device as XFS file system.
[0112] In a preferred embodiment of the present invention, setting the priority and read / write permissions of the main controller and the standby controller for accessing the coffer disk includes:
[0113] In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions;
[0114] In response to the failure or absence of the primary controller, the standby controller has read and write permissions for the coffer disk.
[0115] In a preferred embodiment of the present invention, in response to a failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk and mounts the XFS file system to the system directory, and starting the database service includes:
[0116] In response to a failure of the primary controller, marking the standby controller as a new primary controller;
[0117] The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory;
[0118] The new master controller reads the database file and starts the database service.
[0119] Based on the above purpose, a fourth aspect of an embodiment of the present invention provides a computer-readable storage medium. Figure 4 FIG. 2 is a schematic diagram of an embodiment of a computer-readable storage medium provided by the present invention. Figure 4 As shown, the computer readable storage medium 31 stores a computer program 32 that performs the following method when executed by a processor:
[0120] Select two hard disks in the storage array as coffer disks, and divide the coffer disks into partitions of a preset size;
[0121] Organize the partitions of preset size in the coffer disk into a RAID1 device and format it as the XFS file system;
[0122] Set the priority and read / write permissions for the primary and standby controllers to access the coffer disk;
[0123] The main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk;
[0124] In response to receiving the request for database update, the master controller database service writes the data into the database file;
[0125] In response to the failure of the primary controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service.
[0126] In a preferred embodiment of the present invention, selecting two hard disks in a storage array as coffer disks, and dividing the coffer disks into partitions of a preset size comprises:
[0127] Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks;
[0128] Use the partitioning tool in any controller to partition the hard disk in slot 0 and create a 4G partition space / dev / sdb1;
[0129] Use the partitioning tool in any controller to partition the hard disk in slot 1 and create a 4G partition space / dev / sdc1.
[0130] In a preferred embodiment of the present invention, partitions of preset sizes in the coffer disk are organized into a RAID1 device and formatted into an XFS file system, including:
[0131] Use the command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device;
[0132] Use the command in either controller to format the RAID1 device as XFS file system.
[0133] In a preferred embodiment of the present invention, setting the priority and read / write permissions of the main controller and the standby controller for accessing the coffer disk includes:
[0134] In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions;
[0135] In response to the failure or absence of the primary controller, the standby controller has read and write permissions for the coffer disk.
[0136] In a preferred embodiment of the present invention, in response to a failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk and mounts the XFS file system to the system directory, and starting the database service includes:
[0137] In response to a failure of the primary controller, marking the standby controller as a new primary controller;
[0138] The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory;
[0139] The new master controller reads the database file and starts the database service.
[0140] In addition, the method disclosed in the embodiment of the present invention can also be implemented as a computer program executed by a processor, and the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the above functions defined in the method disclosed in the embodiment of the present invention are performed.
[0141] In addition, the above method steps and system units may also be implemented using a controller and a computer-readable storage medium for storing a computer program that enables the controller to implement the above steps or unit functions.
[0142] It will also be appreciated by those skilled in the art that various exemplary logic blocks, modules, circuits and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software or a combination of the two. In order to clearly illustrate this interchangeability of hardware and software, a general description has been given to the functions of various schematic components, blocks, modules, circuits and steps. Whether this function is implemented as software or hardware depends on specific applications and the design constraints imposed on the entire system. Those skilled in the art can implement the function in various ways for each specific application, but this implementation decision should not be interpreted as causing a departure from the disclosed scope of the embodiments of the present invention.
[0143] In one or more exemplary designs, the function can be implemented in hardware, software, firmware or any combination thereof. If implemented in software, the function can be stored on a computer-readable medium or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include computer storage media and communication media, and the communication media include any media that helps to transfer a computer program from one location to another. The storage medium can be any available medium that can be accessed by a general or special computer. As an example and not limiting, the computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage devices, disk storage devices or other magnetic storage devices, or any other medium that can be used to carry or store the required program code in the form of an instruction or data structure and can be accessed by a general or special computer or a general or special processor. In addition, any connection can be appropriately referred to as a computer-readable medium. For example, if a coaxial cable, optical fiber cable, twisted pair, digital subscriber line (DSL) or wireless technologies such as infrared, radio and microwaves are used to send software from a website, server or other remote source, the above-mentioned coaxial cable, optical fiber cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwaves are all included in the definition of the medium. As used herein, disk and disc include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk, Blu-ray disc, wherein disks usually reproduce data magnetically, while optical discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0144] The above are exemplary embodiments disclosed in the present invention, but it should be noted that various changes and modifications may be made without departing from the scope disclosed in the embodiments of the present invention as defined in the claims. The functions, steps and / or actions of the method claims according to the disclosed embodiments described herein do not need to be performed in any particular order. In addition, although the elements disclosed in the embodiments of the present invention may be described or required in individual form, they may also be understood as multiple unless explicitly limited to the singular.
[0145] It should be understood that, as used herein, the singular forms "a", "an" are intended to include the plural forms as well, unless the context clearly supports an exception. It should also be understood that, as used herein, "and / or" refers to any and all possible combinations including one or more of the associated listed items.
[0146] The serial numbers of the embodiments disclosed in the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0147] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0148] A person skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the disclosure of the embodiments of the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and there are many other changes in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of simplicity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.
Claims
1. A method for synchronizing a dual-control storage array database, characterized in that: The following steps are involved: Selecting two hard disks in the storage array as coffer disks, and dividing the coffer disks into partitions of a preset size; Partitions of preset sizes in the coffer disk are organized into a RAID1 device, and formatted into an XFS file system; Setting the priority and read / write permissions of the main controller and the standby controller for accessing the coffer disk; The main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk; In response to receiving a request for database update, the master controller database service writes data into a database file; In response to the failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, and starts the database service; The method of forming a RAID1 device with partitions of a preset size in the coffer disk and formatting the device as an XFS file system includes: using a command in any controller to form a RAID1 device with partitions / dev / sdb1 and / dev / sdc1 of the coffer disk; and using a command in any controller to format the RAID1 device as an XFS file system. Selecting two hard disks in a storage array as coffer disks and dividing the coffer disks into partitions of a preset size includes: Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks; Use a partitioning tool in any controller to partition the hard disk in slot 0 to create a 4G partition space / dev / sdb1; Use a partitioning tool in any controller to partition the hard disk in slot 1 to create a 4G partition space / dev / sdc1; Setting the priority and read / write permissions of the main controller and the standby controller to access the coffer disk includes: In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions; In response to the main controller failing or being absent, the standby controller has read and write permissions for the coffer disk; The main controller mounts the XFS file system to the system directory and starts the database service, and saves the generated database file to the safe disk, including: When both controllers are normal, the master controller has the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, starts the database service, generates a database file, stores the database file in the XFS file system, and finally saves it to the coffer disk, and the master controller provides database services; In response to receiving the request for database update, the main controller database service writes data into the database file, including: The main controller receives a request to update the database, and the database service performs read and write operations on the database file. When there is a write operation on the database file, the data is written to the safe disk; In response to the failure of the main controller, the standby controller obtains the read and write permissions of the coffer disk and mounts the XFS file system to the system directory. Starting the database service includes: In response to a failure of the primary controller, marking the standby controller as a new primary controller; The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory; The new main controller reads the database file and starts the database service.
2. A device for synchronizing a dual-control storage array database, characterized in that: The device comprises: A partitioning module, wherein the partitioning module is configured to select two hard disks in the storage array as coffer disks and divide the coffer disks into partitions of a preset size; A conversion module, wherein the conversion module is configured to form a RAID1 device with partitions of a preset size in the coffer disk and format it into an XFS file system; A setting module, the setting module is configured to set the priority and read and write permissions of the main controller and the standby controller to access the coffer disk; A mounting module, wherein the mounting module is configured for the main controller to mount the XFS file system to a system directory and start a database service, and to save a generated database file to the safe disk; A writing module, wherein the writing module is configured to respond to receiving a request for database update, and the main controller database service writes data into a database file; A startup module, wherein the startup module is configured to, in response to a failure of the main controller, cause the standby controller to obtain read and write permissions for the coffer disk, mount the XFS file system to a system directory, and start a database service; The conversion module is further configured to use a command in any controller to combine the partitions / dev / sdb1 and / dev / sdc1 of the coffer disk into a RAID1 device; and use a command in any controller to format the RAID1 device into an XFS file system; The partitioning module is further configured as: Select the hard disks in slots 0 and 1 of the dual-controller storage array as coffer disks; Use a partitioning tool in any controller to partition the hard disk in slot 0 to create a 4G partition space / dev / sdb1; Use a partitioning tool in any controller to partition the hard disk in slot 1 to create a 4G partition space / dev / sdc1; The setting module is further used for: In response to the main controller and the standby controller not failing, the main controller has read and write permissions for the coffer disk, and the standby controller has read-only permissions; In response to the main controller failing or being absent, the standby controller has read and write permissions for the coffer disk; The mounting module is further used for: When both controllers are normal, the master controller has the read and write permissions of the coffer disk, mounts the XFS file system to the system directory, starts the database service, generates a database file, stores the database file in the XFS file system, and finally saves it to the coffer disk, and the master controller provides database services; The writing module is further used for: The main controller receives a request to update the database, and the database service performs read and write operations on the database file. When there is a write operation on the database file, the data is written to the safe disk; The startup module is further used for: In response to a failure of the primary controller, marking the standby controller as a new primary controller; The new master controller imports the RAID1 composed of the coffer disks and mounts the XFS file system to the system directory; The new main controller reads the database file and starts the database service.
3. A computer device, characterized in that: include: at least one processor; as well as A memory storing computer instructions executable on the processor, wherein the instructions implement the steps of the method according to any one of claim 1 when executed by the processor.
4. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 are implemented.
