System configuration method, intelligent network card, electronic device and storage medium
By configuring the main system and backup system on the smart network card, the problem of single point of failure in the existing system on chip is solved, and business maintenance and data fallback are achieved when the failure occurs, improving the reliability of the system.
Patent Information
- Application Number
- CN202211698919.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-28
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-12-28
AI Technical Summary
The existing system on chip has a single point of failure, which leads to low reliability and easily affects customer business.
By obtaining the mirror file, configuring the main system and the backup system, the main system is used for network traffic adaptation. When an upgrade event, backup event or running failure event is detected, perform the corresponding operations, including upgrading, backup and troubleshooting of the backup system and the main system.
It realizes the use of the standby system to maintain business operation when the main system fails, and data backing is realized through the standby system when the main system cannot be repaired, avoiding the single point of failure problem of the system on chip.
Smart Images

Figure CN116170312B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart network cards, and in particular to a system configuration method, a smart network card, an electronic device and a storage medium. Background Art
[0002] Smart NIC, a type of network card with programming capabilities, is also called an intelligent network adapter. In cloud computing scenarios, Smart NICs can offload virtualization components, network components, storage components and other related components to the Smart NIC, thereby eliminating the overhead brought by the component to the virtual machine, releasing computing resources and improving the performance of the virtual machine.
[0003] The operating system running on the Smart NIC is called the System on Chip. The System on Chip provides an interface for the management and maintenance of the Smart NIC, and is also the operating system platform on which each service component runs.
[0004] The current deployment method of the SoC is usually to use a physical machine to import an image file to the Smart NIC, or to connect the Smart NIC to an external solid-state drive to deploy the operating system. This deployment method results in a system with a single point of failure risk, low reliability, and easy impact on customer services. Summary of the invention
[0005] In view of this, the present invention aims to provide a system configuration method, a smart network card, an electronic device and a storage medium to solve the problem of single point failure in current on-chip systems.
[0006] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0007] A system configuration method, applied to a smart network card, comprising:
[0008] Obtaining an image file, wherein the image file includes operating data of the system;
[0009] Based on the image file, sequentially configure the primary system and the backup system; wherein the primary system is used to perform network traffic adaptation of the smart network card;
[0010] When the occurrence of a target event is detected, performing an operation corresponding to the target event on the backup system and the primary system;
[0011] The target event includes at least one of an upgrade event, a backup event, and an operation failure event.
[0012] Further, when the target event includes the upgrade event, performing the operation corresponding to the target event on the backup system and the primary system includes:
[0013] Upgrading the standby system according to the upgrade file corresponding to the upgrade event;
[0014] Conducting a test run on the upgraded backup system to determine whether the upgraded backup system is operating normally;
[0015] When the operating status is normal, the primary system is upgraded based on the upgrade file.
[0016] Furthermore, the method further comprises:
[0017] In the case where the operating state is abnormal, all data of the primary system is synchronized to the upgraded backup system to restore the backup system to the state before the upgrade.
[0018] Further, the upgrade event includes a component upgrade event and a system upgrade event; and upgrading the standby system according to the upgrade file corresponding to the upgrade event includes:
[0019] Based on the component upgrade file corresponding to the component upgrade event, performing component upgrade on the target component of the standby system;
[0020] and / or, performing a system upgrade on the standby system based on a system upgrade file corresponding to the system upgrade event;
[0021] The step of upgrading the primary system based on the upgrade file includes:
[0022] Based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the primary system;
[0023] And / or, based on the system upgrade file corresponding to the system upgrade event, performing the system upgrade on the primary system.
[0024] Further, the upgrade event includes the component upgrade event; and the component upgrade of the target component of the standby system based on the component upgrade file corresponding to the component upgrade event includes:
[0025] Based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the standby system;
[0026] Trial-run the upgraded target component to confirm whether the running status of the upgraded target component is normal;
[0027] When the upgraded target component is in normal operation, upgrading the target component of the active system and synchronizing the configuration parameters of the standby system to the active system;
[0028] In the case that the operation state of the upgraded target component is abnormal, the data of the active system is synchronized to the standby system so that the standby system is restored to the state before the component is upgraded.
[0029] Further, the upgrade event includes the component upgrade event; and the component upgrade file corresponding to the component upgrade event, performing component upgrade on the target component of the primary system, includes:
[0030] When the primary system is running, based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the primary system;
[0031] Trial-run the upgraded target component to confirm whether the running status of the upgraded target component is normal;
[0032] When the upgraded target component is in a normal operating state, upgrading the target component of the backup system and synchronizing the configuration parameters of the active system to the backup system;
[0033] When the upgraded target component is in an abnormal operating state, the backup system is switched to operate, and the data of the backup system is synchronized to the active system, so that the active system is restored to the state before the component is upgraded.
[0034] Further, in the case that the target event includes the backup event, the performing of the operation corresponding to the target event on the backup system and the primary system includes:
[0035] In response to the backup event, a backup script is started at a preset frequency within a target time; the backup script is used to instruct to back up the data of the primary root partition corresponding to the active system to the backup root partition corresponding to the backup system;
[0036] Mounting the backup root partition to a target directory so that the backup root partition can be accessed and operated by the system;
[0037] Synchronize the data increment of the primary root partition to the backup root partition;
[0038] The primary root partition is used to store the root directory files of the primary system; and the backup root partition is used to store the root directory files of the backup system.
[0039] Further, in the case where the target event includes the running fault event, the performing of the operation corresponding to the target event on the backup system and the active system includes:
[0040] Activate the backup system to maintain business operations;
[0041] Checking a primary root partition corresponding to the primary system to determine whether a fault of the primary root partition can be repaired, wherein the primary root partition stores a root directory file of the primary system;
[0042] If the primary root partition can be repaired, repair the primary root partition, synchronize the data increment of the backup system to the primary system, and enable the primary system;
[0043] In the case that the primary root partition cannot be repaired, a new primary root partition is created, all data of the backup root partition corresponding to the backup system is synchronized to the new primary root partition, and the primary system is enabled;
[0044] The new primary root partition is used to cover the primary root partition that cannot be repaired, and receives and stores data from the backup root partition; the backup root partition stores the root directory file of the backup system.
[0045] Further, configuring the primary system and the backup system in sequence based on the image file includes:
[0046] Installing the primary system and the backup system in sequence, and importing the image files respectively;
[0047] Installing a startup program to the active system and the standby system, and configuring a startup item of the startup program, wherein the startup item is used to instruct system booting of the active system and the standby system;
[0048] Test-run the main system and perform an operation status check on the main system, and after the operation status check passes, perform operation parameter configuration;
[0049] The configuration parameters obtained by performing the operation parameter configuration on the active system are synchronized to the standby system to configure the standby system.
[0050] Further, the installation startup program to the main system includes:
[0051] When the hardware system of the smart network card is a basic input and output system, installing the startup program into the primary root partition corresponding to the primary system;
[0052] In the case where the hardware system of the smart network card is a unified extensible firmware interface, creating an extensible firmware interface system partition, and installing the boot program into the extensible firmware interface system partition;
[0053] The extensible firmware interface system partition is installed with a boot loader file, and the boot loader file is used to instruct the installation of the startup program.
[0054] The present invention obtains an image file, wherein the image file includes the operating data of the system; based on the image file, the primary system and the backup system are sequentially configured; wherein the primary system is used to perform network traffic adaptation of the smart network card; when a target event is detected, operations corresponding to the target event are performed on the backup system and the primary system; wherein the target event includes at least one of an upgrade event, a backup event, and an operating failure event. By configuring the primary system and the backup system, when the primary system fails, the backup system can be used to maintain business operations, and when the primary system cannot be repaired, data rollback can be achieved through the backup system, so that the on-chip system no longer has a single point of risk.
[0055] Another object of the present invention is to provide a smart network card to solve the problem of single point failure in current on-chip systems.
[0056] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0057] An intelligent network card, applied to any of the above system configuration methods, comprising:
[0058] Primary root partition; used to store the first root directory files of the primary system;
[0059] Backup root partition; used to store the second root directory files of the backup system.
[0060] Furthermore, the smart network card further comprises: a boot partition; the boot partition is used to store boot files of the active system and the standby system, and the boot files are used to instruct the system to boot;
[0061] The boot partition includes a first boot partition and a second boot partition;
[0062] The first boot partition is used to store the kernel files of the primary system and the backup system and the boot files, and the kernel files are used to manage the core of the system;
[0063] The second boot partition is used to store startup configuration files of the active system and the standby system, and the startup configuration files are used to load configuration parameters when the system starts.
[0064] Furthermore, the smart network card further includes: a shared partition; the shared partition is used to store shared files of the primary system and the backup system;
[0065] The shared file includes at least a swap space and a home directory. The swap space is used to store some files to release physical memory when physical memory is tight, and the home directory is used to store user data.
[0066] The advantages of the smart network card and the above-mentioned system configuration method over the prior art are the same, which will not be elaborated here.
[0067] Another object of the present invention is to provide an electronic device to solve the problem of single point failure in current on-chip systems.
[0068] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0069] An electronic device, comprising:
[0070] A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned system configuration methods when executing the program.
[0071] The advantages of the electronic device and the above-mentioned system configuration method over the prior art are the same, which will not be elaborated here.
[0072] Another object of the present invention is to provide a computer-readable storage medium to solve the problem of single point failure in current on-chip systems.
[0073] To achieve the above object, the technical solution of the present invention is achieved as follows:
[0074] A computer-readable storage medium, characterized in that when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any of the system configuration methods described above.
[0075] The advantages of the computer-readable storage medium and the above-mentioned system configuration method over the prior art are the same, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] The accompanying drawings constituting a part of the present invention are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the accompanying drawings:
[0077] Figure 1 A flowchart showing the steps of a system configuration method according to the first embodiment of the present invention is shown;
[0078] Figure 2 An operation flow chart corresponding to an upgrade event of a system configuration method according to another embodiment of the present invention is shown;
[0079] Figure 3 A flowchart showing the steps of offline component upgrade of a system configuration method according to another embodiment of the present invention is shown;
[0080] Figure 4A flowchart showing the steps of online component upgrade of a system configuration method according to another embodiment of the present invention is shown;
[0081] Figure 5 A flowchart showing backup steps of a system configuration method according to another embodiment of the present invention is shown;
[0082] Figure 6 A flowchart showing operation failure processing steps of a system configuration method according to another embodiment of the present invention is shown;
[0083] Figure 7 A flow chart showing configuration steps of a system configuration method according to another embodiment of the present invention is shown;
[0084] Figure 8 The deployment flow chart of the main and backup systems of the smart network card is shown;
[0085] Fig. 9 A schematic diagram of the structure of a smart network card according to the second embodiment of the present invention is shown. DETAILED DESCRIPTION
[0086] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0087] A system configuration method, a smart network card, an electronic device, and a storage medium of the present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments.
[0088] Embodiment 1
[0089] Reference Figure 1 , Figure 1 A flowchart of a system configuration method according to an embodiment of the present invention is shown. Figure 1 As shown, including:
[0090] Step S101: Acquire an image file, wherein the image file includes operation data of the system.
[0091] Smart NIC, a network card with programming capabilities, is also called an intelligent network adapter. In cloud computing scenarios, Smart NICs can offload virtualization components, network components, storage components and other related components to Smart NICs, thereby eliminating the overhead of these components on virtual machines, releasing computing resources and improving the performance of virtual machines. At the same time, based on Smart NICs, bare metal servers can be managed on the cloud computing management platform, allowing physical machines to be provided to customers as conveniently as virtual machines without losing the consumption caused by virtualization.
[0092] The operating system running on the Smart NIC is called the System on Chip. The System on Chip provides an interface for the management and maintenance of the Smart NIC, and is also the operating system platform for each service component. Based on the System on Chip, the firmware upgrade and control plane management of the chip are realized, and multiple software development kit interfaces are provided to the outside. The commonly used System on Chip is usually the Linux operating system.
[0093] An image file is a series of operating system files that are formatted into a single file for easy downloading and use.
[0094] In the embodiment of the present invention, in order to deploy the system on chip, it is first necessary to obtain an image file storing the operating data of the system.
[0095] Then execute step S102.
[0096] Step S102: Based on the image file, sequentially configure the primary system and the backup system; wherein the primary system is used to perform network traffic adaptation of the smart network card.
[0097] The system on chip can be deployed by using the pre-boot execution environment installation deployment method.
[0098] The pre-boot execution environment is a mechanism that uses a network interface to boot smart devices. This mechanism allows smart devices to boot without relying on local data storage devices or operating systems.
[0099] First, set the startup mode of the smart network card to the pre-boot execution environment mode. After starting the smart network card, enter the kernel of the pre-boot execution environment.
[0100] The kernel refers to the core of the operating system, which can provide each program with secure access to the hardware and determine when and how long a program can operate on a certain part of the hardware.
[0101] Next, the primary system is installed on the smart network card, and the image file obtained in step S101 is imported into the primary system, and the corresponding files are imported into the primary root partition and the boot partition of the primary system.
[0102] Then, the backup system is installed on the smart network card, and the image file obtained in step S101 is imported into the backup system.
[0103] Configure the startup items of the startup program as dual-boot startup items for the active system and the standby system.
[0104] The active system is tested to check the operating status and configure the operating parameters. A configured active system is obtained. Then the data of the primary root partition of the active system is synchronized to the backup root partition of the backup system to obtain a configured backup system.
[0105] Then execute step S103.
[0106] Step S103: when the occurrence of a target event is detected, an operation corresponding to the target event is performed on the backup system and the active system.
[0107] In a specific implementation, the target event includes at least one of an upgrade event, a backup event, and an operation failure event.
[0108] Specifically, when an operational failure event is detected, the backup system is switched to maintain business operations, while the primary system is detected and repaired, and the primary system is restarted after the primary system is repaired. If the primary system cannot be repaired, the data of the backup system is synchronized to the primary system so that the data of the primary system is rolled back to the state before the failure.
[0109] Secondly, to ensure the dynamic consistency of data between the primary system and the backup system, the primary system automatically enables the backup script to execute the backup event within the target time to back up the primary system data to the backup system.
[0110] In addition, during the operation and maintenance of the smart network card after it goes online, it is inevitable that system upgrades and service component upgrades will be required due to system fault repairs, board firmware upgrades, etc.
[0111] When a system upgrade event is detected, the backup system is upgraded first and tested. If the upgraded backup system runs normally, the primary system is upgraded and the configuration parameters of the backup system are synchronized to the primary system. If the upgraded backup system runs abnormally, the data of the primary system is synchronized to the backup system, overwriting the upgraded data of the backup system, so that the backup system is rolled back to the state before the system upgrade.
[0112] When a component upgrade event is detected, the target component in the running active system can be directly upgraded online, and the upgraded target component can be tested. If it runs normally, the target component in the standby system can be upgraded, and the configuration parameters of the active system can be synchronized to the standby system so that the standby system can complete the update of the target component. If the upgraded target component runs abnormally, the data of the standby system can be synchronized to the active system, overwriting the upgraded data of the active system so that the active system can roll back to the state before the component upgrade.
[0113] Optionally, the target component in the standby system may be upgraded first. This component upgrade method may be called an offline upgrade. The upgraded target component is tested, and if it is running normally, the target component in the active system is upgraded, and the configuration parameters of the standby system are synchronized to the active system to complete the upgrade of the target component in the active system. If the upgraded target component runs abnormally, the data of the active system is synchronized to the standby system, overwriting the upgraded data of the standby system, so that the standby system is rolled back to the state before the component upgrade.
[0114] The embodiment of the present invention obtains an image file, wherein the image file includes the operating data of the system; based on the image file, the primary system and the backup system are sequentially configured; wherein the primary system is used to perform network traffic adaptation of the smart network card; when a target event is detected, operations corresponding to the target event are performed on the backup system and the primary system; wherein the target event includes at least one of an upgrade event, a backup event, and an operating failure event. By configuring the primary system and the backup system, when the primary system fails, the backup system can be used to maintain business operations, and when the primary system cannot be repaired, data rollback can be achieved through the backup system, so that the on-chip system no longer has a single point of risk.
[0115] Reference Figure 2 , Figure 2 FIG. 4 is a flowchart showing an operation corresponding to an upgrade event of a system configuration method according to another embodiment of the present invention. Figure 2 As shown, including:
[0116] Step S201: upgrading the standby system according to the upgrade file corresponding to the upgrade event;
[0117] Step S202: test-running the upgraded standby system to determine whether the upgraded standby system is operating normally;
[0118] Step S203: when the operating state is normal, upgrading the main system based on the upgrade file;
[0119] Step S204: when the operating state is abnormal, all data of the active system is synchronized to the upgraded standby system, so that the standby system is restored to the state before the upgrade.
[0120] During the operation and maintenance of the smart network card, the system-on-chip needs to be upgraded from time to time due to the increase of new business requirements, the upgrade of the system kernel, the upgrade of the system underlying library, etc. At the same time, due to fault repair, board firmware upgrade, etc., it is necessary to upgrade the service components in the system-on-chip. The upgrade of the system-on-chip is called system upgrade, and the upgrade of one or more service components is called component upgrade.
[0121] Due to the single system structure of traditional SoCs, system and / or component upgrades need to be performed when the system is down, affecting business operations. If the upgrade fails, the system and / or components can only be reinstalled, and data rollback is impossible.
[0122] In the embodiment of the present invention, due to the dual system structure of the primary system and the backup system, the primary system and the backup system can be isolated by changing the root directory command, and data can be rolled back if an upgrade failure occurs during the upgrade process.
[0123] When performing an upgrade, first obtain the upgrade file corresponding to the upgrade event. The upgrade file may be in the form of an image file, including a system upgrade file and a component upgrade file.
[0124] Import the upgrade file into the standby system to upgrade the standby system and / or target components.
[0125] Then test run the upgraded standby system to confirm the running status of the upgraded standby system. If it is running normally, import the upgrade file into the active system to upgrade the active system and / or target components, and synchronize the configuration parameters of the standby system to the active system. If the upgraded standby system runs abnormally, synchronize all the data of the active system to the standby system to restore the standby system to the state before the upgrade.
[0126] Full synchronization refers to synchronizing all data at once.
[0127] The embodiment of the present invention upgrades the backup system according to the upgrade file corresponding to the upgrade event; conducts a trial run on the upgraded backup system to determine whether the operation status of the upgraded backup system is normal; if the operation status is normal, upgrades the main system based on the upgrade file; if the operation status is abnormal, synchronizes all the data of the main system to the upgraded backup system to restore the backup system to the state before the upgrade. By preferentially performing the upgrade on the backup system, and upgrading the main system with the same configuration after the upgrade is successful, data can be rolled back at any time if problems occur during the upgrade process, thereby improving the reliability of the upgrade process.
[0128] In an optional embodiment, the upgrade event includes a component upgrade event and a system upgrade event; and upgrading the standby system according to the upgrade file corresponding to the upgrade event includes:
[0129] Based on the component upgrade file corresponding to the component upgrade event, performing component upgrade on the target component of the standby system;
[0130] and / or, performing a system upgrade on the standby system based on a system upgrade file corresponding to the system upgrade event;
[0131] The step of upgrading the primary system based on the upgrade file includes:
[0132] Based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the primary system;
[0133] And / or, based on the system upgrade file corresponding to the system upgrade event, performing the system upgrade on the primary system.
[0134] Reference Figure 3 , Figure 3 A flowchart of offline component upgrade steps of a system configuration method according to another embodiment of the present invention is shown. Figure 3 As shown, including:
[0135] Step S301: performing component upgrade on a target component of the standby system based on a component upgrade file corresponding to the component upgrade event.
[0136] In traditional service component upgrades, upgrades performed without service interruption can be called online upgrades, and upgrades performed with service interruption can be called offline upgrades.
[0137] The following is a detailed description of the offline upgrade process.
[0138] In the embodiment of the present invention, due to the dual system structure of the active system and the standby system, there is no need to interrupt the service when performing offline upgrades. The target components in the standby system need only be upgraded first while the active system is running.
[0139] First, run the primary system to carry out business operations.
[0140] Mount the backup root partition of the backup system to the target directory, and use the change root directory command to switch to the target directory to access and operate the backup root partition. Mounting refers to the process of mounting a system other than the currently running system to the target directory so that the mounted system can be accessed and operated. The target directory can be a custom directory, such as the mount directory.
[0141] The specific code is as follows:
[0142] sudo mount / dev / sda4 / mnt
[0143] sudo mount--bind / dev / mnt / dev&&
[0144] sudo mount --bind / dev / pts / mnt / dev / pts&&
[0145] sudo mount--bind / proc / mnt / proc&&
[0146] sudo mount --bind / sys / mnt / sys
[0147] sudo chroot / mnt
[0148] Then, the upgrade file corresponding to the component upgrade event is obtained. The upgrade file may be in the form of an image file.
[0149] Import the upgrade file into the standby root partition of the standby system to upgrade the target component.
[0150] The specific code is as follows:
[0151] rsync-avzuP / / mnt--exclude / proc--exclude / dev--exclude / sys--exclude / sys / pts
[0152] Then execute step S302.
[0153] Step S302: test-run the upgraded target component to confirm whether the running status of the upgraded target component is normal.
[0154] Switch the running component to the standby system after the upgrade to confirm the running status of the upgraded target component.
[0155] If the upgraded target component runs normally, step S303 is executed; if the upgraded target component runs abnormally, step S304 is executed.
[0156] Step S303: when the upgraded target component is in a normal operating state, the target component of the active system is upgraded, and the configuration parameters of the backup system are synchronized to the active system.
[0157] If the upgraded target component runs normally, it can be determined that the component upgrade is successful.
[0158] Mount the primary root partition of the active system to the target directory, and use the change root directory command to switch to the target directory to access and operate the primary root partition.
[0159] Import the upgrade file into the primary root partition of the active system to upgrade the target components of the active system, and synchronize the configuration parameters of the standby system to the active system to complete the offline component upgrade event.
[0160] The specific code is as follows:
[0161] rsync-avzh / / mnt--exclude / proc--exclude / dev--exclude / sys--exclude / sys / pts
[0162] Step S304: when the upgraded target component is in an abnormal operating state, synchronizing the data of the active system to the standby system, so that the standby system is restored to the state before the component is upgraded.
[0163] If the upgraded target component runs abnormally, it can be determined that the component upgrade has failed.
[0164] At this time, you need to switch to the active system and synchronize the data of the active system to the standby system so that the data of the standby system can be rolled back to the state before the component upgrade.
[0165] The embodiment of the present invention upgrades the target component of the backup system based on the component upgrade file corresponding to the component upgrade event; test runs the upgraded target component to confirm whether the running state of the upgraded target component is normal; if the running state of the upgraded target component is normal, upgrades the target component of the primary system and synchronizes the configuration parameters of the backup system to the primary system; if the running state of the upgraded target component is abnormal, synchronizes the data of the primary system to the backup system to restore the backup system to the state before the component upgrade. This allows data to be rolled back at any time if problems occur during the component upgrade process, thereby improving the reliability of the upgrade process.
[0166] Reference Figure 4 , Figure 4 A flowchart of online component upgrade steps of a system configuration method according to another embodiment of the present invention is shown. Figure 3 As shown, including:
[0167] Step S401: When the primary system is running, the component upgrade is performed on a target component of the primary system based on a component upgrade file corresponding to the component upgrade event.
[0168] First, when the primary system is running, an upgrade file corresponding to the component upgrade is imported into the primary system to upgrade the target component.
[0169] The upgrade file can be in the form of an image file.
[0170] Then execute step S402.
[0171] Step S402: test-run the upgraded target component to confirm whether the running status of the upgraded target component is normal.
[0172] Test-run the upgraded target component to confirm whether it is running normally.
[0173] If the upgraded target component runs normally, step S403 is executed; if the upgraded target component runs abnormally, step S404 is executed.
[0174] Step S403: when the upgraded target component is in a normal operating state, the target component of the backup system is upgraded, and the configuration parameters of the active system are synchronized to the backup system.
[0175] If the upgraded target component runs normally, it can be determined that the component upgrade is successful.
[0176] Mount the backup root partition of the backup system to the target directory, and use the change root directory command to switch to the target directory to access and operate the backup root partition. The target directory can be a custom directory, such as the mount directory.
[0177] Import the upgrade file into the standby root partition of the standby system to upgrade the target components in the standby system and synchronize the configuration parameters of the active system to the standby system.
[0178] When the business is idle, switch to the standby system to check the working status of the standby system after the component upgrade.
[0179] Step S404: when the upgraded target component is in an abnormal operating state, switch to the backup system and synchronize data of the backup system to the active system, so that the active system is restored to the state before the component is upgraded.
[0180] If the upgraded target component runs abnormally, it can be determined that the component upgrade has failed.
[0181] At this time, you need to switch to the standby system, mount the primary root partition of the active system, and synchronize the standby system data to the primary root partition of the active system to restore the data of the active system to the state before the component upgrade.
[0182] Finally, switch to the main system.
[0183] The embodiment of the present invention upgrades the target component of the main system based on the component upgrade file corresponding to the component upgrade event while the main system is running; test runs the upgraded target component to confirm whether the running state of the upgraded target component is normal; if the running state of the upgraded target component is normal, upgrades the target component of the backup system and synchronizes the configuration parameters of the main system to the backup system; if the running state of the upgraded target component is abnormal, switches to run the backup system and synchronizes the data of the backup system to the main system, so that the main system is restored to the state before the component upgrade. This allows data to be rolled back at any time if problems occur during the component upgrade process, thereby improving the reliability of the upgrade process.
[0184] Reference Figure 5 , Figure 5 A flowchart of backup steps of a system configuration method according to another embodiment of the present invention is shown. Figure 5 As shown, including:
[0185] Step S501: in response to the backup event, starting a backup script at a preset frequency within a target time; the backup script is used to instruct to back up data of the primary root partition corresponding to the active system to the backup root partition corresponding to the backup system.
[0186] In the prior art, due to the single-system structure of the smart network card, there is no backup-related technology in actual operation and maintenance. As a result, when the system on chip has configuration loss, configuration error, important file damage, or file system damage, the business of the smart network card cannot be restored in a timely and effective manner. Only heavyweight operations such as replacing the smart network card and server migration can be taken, which often consume more resources.
[0187] Therefore, in an embodiment of the present invention, a backup step process based on a primary system and a backup system is provided to implement data backup of the primary system, thereby ensuring that the business can be quickly restored by switching to the backup system when a failure occurs in the on-chip system, and using the backup system to quickly restore the primary system.
[0188] First, preset a suitable backup target time and backup frequency. The target time can be the business idle time.
[0189] Within the target time, the active system will start the backup script at a preset frequency, and the backup script is used to instruct to back up the data of the primary root partition of the active system to the backup root partition of the backup system.
[0190] After the backup script is started, first check whether the services running on the primary system are normal and whether the business is operating normally.
[0191] If the operation is normal, execute step S502.
[0192] Step S502: Mount the backup root partition to a target directory, so that the backup root partition can be accessed and operated by the system.
[0193] Mount the backup root partition of the backup system to the target directory and use the change root directory command to switch to the target directory to access and operate the backup root partition.
[0194] Mounting is the process of mounting a system other than the currently running system to a target directory so that the mounted system can be accessed and operated.
[0195] The target directory can be a custom directory, such as a mount directory.
[0196] Then execute step S503.
[0197] Step S503: Synchronize the data increment of the primary root partition to the backup root partition.
[0198] In a specific implementation, the primary root partition is used to store the root directory files of the primary system; and the backup root partition is used to store the root directory files of the backup system.
[0199] Incrementally synchronize the data of the primary root partition to the backup root partition. The synchronization tool can be the rsync tool.
[0200] Incremental synchronization refers to the synchronization method of grabbing data after the target time or target checkpoint for synchronization. The usage code is as follows:
[0201] rsync-avzuP / / mnt--exclude / proc--exclude / dev--exclude / sys--exclude / sys / pt
[0202] The embodiment of the present invention starts a backup script at a preset frequency within the target time in response to the backup event; the backup script is used to instruct to back up the data of the primary root partition corresponding to the primary system to the backup root partition corresponding to the backup system; the backup root partition is mounted to the target directory so that the backup root partition can be accessed and operated by the system; the data increment of the primary root partition is synchronized to the backup root partition; wherein the primary root partition is used to store the root directory file of the primary system; the backup root partition is used to store the root directory file of the backup system. Regular backup of the primary system data is achieved, so that when the on-chip system fails, the business can be quickly restored by switching to the backup system, and the primary system can be quickly restored by using the backup system.
[0203] Reference Figure 6 , Figure 6 A flowchart of a system configuration method for handling a running fault according to another embodiment of the present invention is shown. Figure 6 As shown, including:
[0204] Step S601: Activate the backup system to maintain business operations.
[0205] When the primary system fails, the backup system must be switched to ensure that the service is maintained.
[0206] Then, step S602 is executed. If the customer's business is busy at this time, the process can be executed during idle time to reduce the impact on the customer's business.
[0207] Step S602: Check the primary root partition corresponding to the primary system to determine whether the failure of the primary root partition can be repaired, wherein the primary root partition stores the root directory file of the primary system.
[0208] Check the primary root partition of the active system. The primary root partition stores the root directory files of the active system. You can use the fsck tool to check.
[0209] Determine whether the failure of the primary root partition is recoverable.
[0210] If the fault can be repaired, execute step S603 to repair the fault; if the fault cannot be repaired, execute step S604 to roll back the data of the primary system.
[0211] Step S603: If the primary root partition can be repaired, repair the primary root partition, synchronize the data increment of the backup system to the primary system, and enable the primary system.
[0212] If the failure of the primary root partition can be repaired, use the inspection tool to repair the failure of the primary root partition. After the repair is complete, mount the repaired primary root partition and synchronize the data increment of the backup root partition of the backup system to the primary root partition of the active system.
[0213] Finally, switch to the main system.
[0214] The incremental synchronization command is as follows:
[0215] rsync-avzuP / / mnt--exclude / proc--exclude / dev--exclude / sys--exclude / sys / pts
[0216] Step S604: when the primary root partition cannot be repaired, create a new primary root partition, synchronize all data of the backup root partition corresponding to the backup system to the new primary root partition, and enable the primary system.
[0217] In a specific implementation, the new primary root partition is used to cover the primary root partition that cannot be repaired, and receives and stores data from the backup root partition; the backup root partition stores the root directory file of the backup system.
[0218] If the failure of the primary root partition cannot be repaired, a new primary root partition is created to cover the unrepairable primary root partition.
[0219] Then mount the new primary root partition and synchronize all the data in the backup system's backup root partition to the new primary root partition.
[0220] Finally, switch to the main system.
[0221] The embodiment of the present invention enables the backup system to maintain business operation; checks the primary root partition corresponding to the primary system to determine whether the failure of the primary root partition can be repaired, and the primary root partition stores the root directory file of the primary system; if the primary root partition can be repaired, repairs the primary root partition, synchronizes the data increment of the backup system to the primary system, and enables the primary system; if the primary root partition cannot be repaired, creates a new primary root partition, synchronizes the full amount of data of the backup root partition corresponding to the backup system to the new primary root partition, and enables the primary system; wherein the new primary root partition is used to cover the primary root partition that cannot be repaired, receives and stores data from the backup root partition; the backup root partition stores the root directory file of the backup system. This allows the backup system to be switched to maintain business operation when a failure occurs, and the primary system can also be quickly restored.
[0222] Reference Figure 7 , Figure 7A flow chart showing the configuration steps of a system configuration method according to another embodiment of the present invention is shown as follows: Figure 7 As shown, including:
[0223] Step S701: installing the primary system and the backup system in sequence, and importing the image files respectively.
[0224] The pre-boot execution environment is a mechanism that uses a network interface to boot smart devices. This mechanism allows smart devices to boot without relying on local data storage devices or operating systems.
[0225] First, set the startup mode of the smart network card to the pre-boot execution environment mode. After starting the smart network card, enter the kernel of the pre-boot execution environment.
[0226] Partition the disk into a primary root partition, a backup root partition, a boot partition, and a shared partition. The primary root partition is used to store the root directory files of the primary system, the backup root partition is used to store the root directory files of the backup system, the boot partition is used to store the boot files of the primary system and the backup system, and the shared partition is used to store the files shared by the primary system and the backup system.
[0227] A boot file is a file that instructs the system to boot. System booting is the process of loading the operating system kernel into memory and starting the system.
[0228] Next, install the primary system first, import the image file, and load the corresponding files in the primary root partition and boot partition. Then install the backup system and import the image file.
[0229] Then execute step S702.
[0230] Step S702: installing a startup program to the active system and the standby system, and configuring startup items of the startup program, wherein the startup items are used to instruct system booting of the active system and the standby system.
[0231] Install the boot program to the active system and the standby system, and configure the boot program's boot items as dual-boot items for the active system and the standby system.
[0232] In a specific implementation, the boot program may be GRUB2.
[0233] Startup items refer to programs that will run in the foreground or background after the system starts. The configuration code is as follows:
[0234]
[0235] In set root=(hd0, 4), hd0 refers to the first hard disk of the corresponding system, and 4 refers to the fourth partition on the first hard disk.
[0236] Then execute step S703.
[0237] Step S703: test-run the main system and perform an operation status check on the main system. After the operation status check passes, perform operation parameter configuration.
[0238] Test run the main system with dual boot startup items loaded.
[0239] Check the operating status of the main system and configure the operating parameters if the operating status is normal.
[0240] Then execute step S704.
[0241] Step S704: Synchronize the configuration parameters obtained by performing the operation parameter configuration on the active system to the standby system, so as to configure the standby system.
[0242] Mount the backup root directory of the backup system to the target directory. The target directory can be a custom directory, such as the mount directory.
[0243] Use the synchronization tool to incrementally synchronize the data of the primary root partition of the active system and the configuration parameters of the active system to the standby system.
[0244] The synchronization tool can be rsync tool.
[0245] In an optional embodiment, the step of installing a startup program to the primary system includes:
[0246] When the hardware system of the smart network card is a basic input and output system, the startup program is installed to the primary root partition corresponding to the primary system. The configuration code is as follows:
[0247] sudo mount / dev / sda4 / mnt
[0248] sudo mount--bind / dev / mnt / dev&&
[0249] sudo mount --bind / dev / pts / mnt / dev / pts&&
[0250] sudo mount--bind / proc / mnt / proc&&
[0251] sudo mount --bind / sys / mnt / sys
[0252] sudo chroot / mnt
[0253] grub-install / dev / sda
[0254] grub-install --recheck / dev / sda
[0255] grub2-mkconfig-o / boot / grub2 / grub.cfg
[0256] When the hardware system of the smart network card is a unified extensible firmware interface, an extensible firmware interface system partition is created, and the boot program is installed to the extensible firmware interface system partition. The configuration code is as follows:
[0257] gdisk / dev / sda
[0258] mkfs.vfat / dev / sda3
[0259] mount / dev / sda3 / boot / efi
[0260] yum install grub2-efi grub2-efi-modules shim
[0261] sudo mount / dev / sda4 / mnt
[0262] sudo mount--bind / dev / mnt / dev&&
[0263] sudo mount --bind / dev / pts / mnt / dev / pts&&
[0264] sudo mount--bind / proc / mnt / proc&&
[0265] sudo mount --bind / sys / mnt / sys
[0266] sudo chroot / mnt
[0267] grub-install / dev / sda
[0268] grub-install --recheck / dev / sda
[0269] grub-install --target=x86_64-efi / dev / sda
[0270] grub-install–recheck / dev / sda
[0271] grub2-mkconfig-o / boot / efi / grub2 / grub.cf
[0272] In a specific implementation, a boot loader file is installed in the extensible firmware interface system partition, and the boot loader file is used to instruct the installation of the startup program.
[0273] The embodiment of the present invention sequentially installs the main system and the backup system, and imports the image files respectively; installs the startup program to the main system and the backup system, and configures the startup items of the startup program, the startup items are used to indicate the system boot of the main system and the backup system; runs the main system for trial operation, and performs a running status check on the main system, and after the running status check passes, performs running parameter configuration; synchronizes the configuration parameters obtained by the running parameter configuration of the main system to the backup system, so as to configure the backup system. In the event of a failure, the backup system can be switched to maintain business operations, and the main system can also be quickly restored.
[0274] The following example describes the deployment process of the active and standby systems of the Smart NIC in detail:
[0275] Reference Figure 8 , Figure 8 The deployment flow chart of the main and backup systems of the smart network card is shown in FIG. Figure 8 As shown, including:
[0276] First, set the startup mode of the smart network card to the pre-boot execution environment mode. After starting the smart network card, enter the kernel of the pre-boot execution environment.
[0277] Partition the disk into a primary root partition, a backup root partition, a boot partition, and a shared partition. The primary root partition is used to store the root directory files of the primary system, the backup root partition is used to store the root directory files of the backup system, the boot partition is used to store the boot files of the primary system and the backup system, and the shared partition is used to store the files shared by the primary system and the backup system.
[0278] First install the main system, import the image file, and load the corresponding files in the main root partition and boot partition. Then install the backup system and import the image file.
[0279] Then install the boot program to the active system and the standby system, and configure the boot program's boot items as dual-boot items for the active system and the standby system. The boot program can be GRUB2.
[0280] When the hardware system of the smart network card is a basic input / output system, the boot program is installed to the primary root partition; when the hardware system of the smart network card is a unified extensible firmware interface, an extensible firmware interface system partition is created, and the boot program is installed to the extensible firmware interface system partition.
[0281] Configure the GRUB2 boot item as a dual-boot item for the active system and the standby system.
[0282] Start the main system and check the running status of each service of the smart network card and configure the running parameters.
[0283] After the active system is configured, synchronize the data in the primary root partition to the backup root partition.
[0284] Switch to the standby system to determine the operating status of the smart network card.
[0285] Embodiment 2
[0286] Reference Fig. 9 , Fig. 9 FIG. 4 shows a schematic diagram of the structure of a smart network card according to the second embodiment of the present invention. Fig. 9 As shown, including:
[0287] Primary root partition 901; used to store the first root directory file of the primary system;
[0288] The backup root partition 902 is used to store the second root directory files of the backup system.
[0289] In an optional embodiment, the smart network card further includes: a boot partition; the boot partition is used to store boot files of the active system and the standby system, and the boot files are used to instruct the system to boot;
[0290] The boot partition includes a first boot partition and a second boot partition;
[0291] The first boot partition is used to store the kernel files of the primary system and the backup system and the boot files, and the kernel files are used to manage the core of the system;
[0292] The second boot partition is used to store startup configuration files of the active system and the standby system, and the startup configuration files are used to load configuration parameters when the system starts.
[0293] In an optional embodiment, the smart network card further includes: a shared partition; the shared partition is used to store shared files of the active system and the standby system;
[0294] The shared file includes at least a swap space and a home directory. The swap space is used to store some files to release physical memory when physical memory is tight, and the home directory is used to store user data.
[0295] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device, including:
[0296] A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the system configuration method described in any one of the first embodiments when executing the program.
[0297] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the system configuration method described in any one of Embodiment 1.
[0298] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0299] For the method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and components involved are not necessarily required by the present invention.
[0300] The above is a detailed introduction to a system configuration method, a smart network card, an electronic device and a storage medium provided by the present invention. Specific examples are used in this article 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 of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A system configuration method, characterized in that: Applied to a smart network card, the method comprises: Obtaining an image file, wherein the image file includes operating data of the system; Based on the image file, sequentially configure the primary system and the backup system; wherein the primary system is used to perform network traffic adaptation of the smart network card; When the occurrence of a target event is detected, performing an operation corresponding to the target event on the backup system and the primary system; Wherein, the target event includes at least one of an upgrade event, a backup event, and an operation failure event; In a case where the target event includes the upgrade event, the performing an operation corresponding to the target event on the backup system and the active system includes: Upgrading the backup system, and when the upgraded backup system is in normal operation, synchronizing the configuration parameters of the backup system to the primary system to upgrade the primary system; In a case where the target event includes the backup event, the performing of the operation corresponding to the target event on the backup system and the primary system includes: The primary system automatically enables the backup script to execute the backup event, and backs up the primary system data to the backup system; In a case where the target event includes the operation failure event, the performing of an operation corresponding to the target event on the backup system and the active system includes: Running the backup system, detecting and repairing faults in the primary system, and re-running the primary system after the primary system is repaired; The configuring the primary system and the backup system in sequence based on the image file includes: installing the primary system and the backup system in sequence, and importing the image files respectively; installing a startup program to the primary system and the backup system, and configuring startup items of the startup program, wherein the startup items are used to indicate system booting of the primary system and the backup system; trial-running the primary system, and performing an operation status check on the primary system, and performing operation parameter configuration after the operation status check passes; synchronizing configuration parameters obtained by performing the operation parameter configuration on the primary system to the backup system, so as to configure the backup system.
2. The method according to claim 1, characterized in that The step of upgrading the standby system, when the upgraded standby system is in a normal operating state, synchronizing the configuration parameters of the standby system to the active system to upgrade the active system, includes: Upgrading the standby system according to the upgrade file corresponding to the upgrade event; Conducting a test run on the upgraded backup system to determine whether the upgraded backup system is operating normally; When the operating status is normal, the primary system is upgraded based on the upgrade file.
3. The method according to claim 2, characterized in that The method further comprises: In the case where the operating state is abnormal, all data of the primary system is synchronized to the upgraded backup system to restore the backup system to the state before the upgrade.
4. The method according to claim 2 or 3, characterized in that: The upgrade event includes a component upgrade event and a system upgrade event; The step of upgrading the standby system according to the upgrade file corresponding to the upgrade event includes: Based on the component upgrade file corresponding to the component upgrade event, performing component upgrade on the target component of the standby system; and / or, performing a system upgrade on the standby system based on a system upgrade file corresponding to the system upgrade event; The step of upgrading the primary system based on the upgrade file includes: Based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the primary system; And / or, based on the system upgrade file corresponding to the system upgrade event, performing the system upgrade on the primary system.
5. The method according to claim 4, characterized in that The upgrade event includes the component upgrade event; and the component upgrade of the target component of the standby system based on the component upgrade file corresponding to the component upgrade event includes: Based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the standby system; Trial-run the upgraded target component to confirm whether the running status of the upgraded target component is normal; When the upgraded target component is in normal operation, upgrading the target component of the active system and synchronizing the configuration parameters of the standby system to the active system; In the case that the operation state of the upgraded target component is abnormal, the data of the active system is synchronized to the standby system so that the standby system is restored to the state before the component is upgraded.
6. The method according to claim 4, characterized in that The upgrade event includes the component upgrade event; and the component upgrade file corresponding to the component upgrade event, performing component upgrade on the target component of the primary system, includes: When the primary system is running, based on the component upgrade file corresponding to the component upgrade event, performing the component upgrade on the target component of the primary system; Trial-run the upgraded target component to confirm whether the running status of the upgraded target component is normal; When the upgraded target component is in a normal operating state, upgrading the target component of the backup system and synchronizing the configuration parameters of the active system to the backup system; When the upgraded target component is in an abnormal operating state, the backup system is switched to operate, and the data of the backup system is synchronized to the active system, so that the active system is restored to the state before the component is upgraded.
7. The method according to claim 1, characterized in that The primary system automatically enables the backup script to execute the backup event, and backs up the primary system data to the backup system, including: In response to the backup event, a backup script is started at a preset frequency within a target time; the backup script is used to instruct to back up the data of the primary root partition corresponding to the active system to the backup root partition corresponding to the backup system; Mounting the backup root partition to a target directory so that the backup root partition can be accessed and operated by the system; Synchronize the data increment of the primary root partition to the backup root partition; The primary root partition is used to store the root directory files of the primary system; and the backup root partition is used to store the root directory files of the backup system.
8. The method according to claim 1, characterized in that Running the backup system, detecting and repairing a fault in the primary system, and re-running the primary system after the primary system is repaired, includes: Activate the backup system to maintain business operations; Checking a primary root partition corresponding to the primary system to determine whether a fault of the primary root partition can be repaired, wherein the primary root partition stores a root directory file of the primary system; If the primary root partition can be repaired, repair the primary root partition, synchronize the data increment of the backup system to the primary system, and enable the primary system; In the case that the primary root partition cannot be repaired, a new primary root partition is created, all data of the backup root partition corresponding to the backup system is synchronized to the new primary root partition, and the primary system is enabled; The new primary root partition is used to cover the primary root partition that cannot be repaired, and receives and stores data from the backup root partition; the backup root partition stores the root directory file of the backup system.
9. The method according to claim 1, characterized in that: The step of installing the startup program to the primary system includes: When the hardware system of the smart network card is a basic input and output system, installing the startup program into the primary root partition corresponding to the primary system; In the case where the hardware system of the smart network card is a unified extensible firmware interface, creating an extensible firmware interface system partition, and installing the boot program into the extensible firmware interface system partition; The extensible firmware interface system partition is installed with a boot loader file, and the boot loader file is used to instruct the installation of the startup program.
10. An intelligent network card, applied to the system configuration method according to any one of claims 1 to 9, characterized in that: The smart network card includes: Primary root partition; used to store the first root directory files of the primary system; Backup root partition; used to store the second root directory files of the backup system.
11. The smart network card according to claim 10, characterized in that: The smart network card further includes: a boot partition; the boot partition is used to store boot files of the active system and the standby system, and the boot files are used to instruct the system to boot; The boot partition includes a first boot partition and a second boot partition; The first boot partition is used to store the kernel files of the primary system and the backup system and the boot files, and the kernel files are used to manage the core of the system; The second boot partition is used to store startup configuration files of the active system and the standby system, and the startup configuration files are used to load configuration parameters when the system starts.
12. The smart network card according to claim 10, characterized in that: The smart network card further includes: a shared partition; the shared partition is used to store shared files of the primary system and the backup system; The shared file includes at least a swap space and a home directory; the swap space is used to store some files to release physical memory when physical memory is tight, and the home directory is used to store user data.
13. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the system configuration method according to any one of claims 1 to 9 when executing the program.
14. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the system configuration method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Main and standby system switching method and device based on IPPBX
CN111130862A
Cluster system exception recovery processing method and device
CN111538613A