CN111124761B - Equipment restarting method, device, equipment and medium - Google Patents
Equipment restarting method, device, equipment and medium Download PDFInfo
- Publication number
- CN111124761B CN111124761B CN201911386419.4A CN201911386419A CN111124761B CN 111124761 B CN111124761 B CN 111124761B CN 201911386419 A CN201911386419 A CN 201911386419A CN 111124761 B CN111124761 B CN 111124761B
- Authority
- CN
- China
- Prior art keywords
- service
- bmc
- restarting
- interrupt
- gpio
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1438—Restarting or rejuvenating
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1417—Boot up procedures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
本申请公开了一种设备重启方法、装置、设备及介质,该方法包括:触发针对设备的重启命令,并向BMC发送所述重启命令;当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断,然后通过相应的中断服务向上层应用发送清理启动信号;当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作,然后重启所述设备。本申请通过BMC触发GPIO中断,使得可以通过中断服务向上层应用发送清理启动信号,由此达到了快速清理系统的效果,避免了现有技术中需要在重启过程中反复进行轮询的情况,减少了对系统资源的占用,具有较高的实时性。
The present application discloses a device restarting method, device, device and medium. The method includes: triggering a restarting command for a device, and sending the restarting command to a BMC; when the BMC receives the restarting command, Described BMC triggers the GPIO in the CPU to interrupt, and then sends clearing start signal to upper-layer application by corresponding interrupt service; When described upper-layer application receives described clearing and starting signal, then executes the system cleaning operation before restarting, and then restarts described equipment . The present application triggers the GPIO interrupt through the BMC, so that a clearing start signal can be sent to the upper-layer application through the interrupt service, thereby achieving the effect of quickly clearing the system, avoiding the need for repeated polling during the restarting process in the prior art, reducing the need for In order to occupy the system resources, it has high real-time performance.
Description
技术领域technical field
本申请涉及计算机技术领域,特别涉及一种设备重启方法、装置、设备及介质。The present application relates to the field of computer technologies, and in particular, to a device restarting method, apparatus, device, and medium.
背景技术Background technique
目前,机器设备在重启时,如果不检测是否有服务正在运行或者有磁盘正在被访问,此时重启将很容易导致机器重启后服务异常或者磁盘损坏。为此,现有技术中出现了一种方式来防止此问题的发生,即轮询BMC(即Baseboard Management Controller,基板管理控制器)的状态,一旦发现BMC状态处于重启状态,则立即中断所有服务并停止所有磁盘写入的操作。At present, when a machine is restarted, if it does not detect whether a service is running or a disk is being accessed, restarting at this time will easily lead to abnormal service or disk damage after the machine is restarted. Therefore, there is a way to prevent this problem in the prior art, that is, polling the status of the BMC (that is, the Baseboard Management Controller, baseboard management controller), and once it is found that the BMC status is in the restarting state, all services are immediately interrupted and stop all disk writes.
然而,上述设备重启方式存在以下几个问题,一是轮询方式一直会占用系统资源;二是轮询方式实时性不高,需要延长关机等待时间,降低了用户体验。However, the above-mentioned device restarting method has the following problems. First, the polling method will always occupy system resources; second, the polling method is not real-time, and needs to prolong the shutdown waiting time, which reduces the user experience.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请的目的在于提供一种设备重启方法、装置、设备及介质,能够减少对系统资源的占用,并且具有较高的实时性。其具体方案如下:In view of this, the purpose of the present application is to provide a device restarting method, apparatus, device and medium, which can reduce the occupation of system resources and have high real-time performance. Its specific plan is as follows:
第一方面,本申请公开了一种设备重启方法,包括:In a first aspect, the present application discloses a device restarting method, including:
触发针对设备的重启命令,并向BMC发送所述重启命令;Trigger a restart command for the device, and send the restart command to the BMC;
当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断,然后通过相应的中断服务向上层应用发送清理启动信号;When the BMC receives the restart command, the GPIO interrupt in the CPU is triggered by the BMC, and then a clean-up start signal is sent to the upper-layer application through the corresponding interrupt service;
当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作,然后重启所述设备。When the upper-layer application receives the cleanup start signal, it performs a system cleanup operation before restarting, and then restarts the device.
可选的,所述通过所述BMC触发CPU中的GPIO中断,包括:Optionally, the GPIO interrupt in the CPU is triggered by the BMC, including:
通过所述BMC发送高电平至GPIO,并等待第一预设时长;Send a high level to GPIO through the BMC, and wait for the first preset duration;
当所述CPU接收到所述GPIO输出的所述GPIO高电平,则通过所述CPU触发相应的GPIO中断。When the CPU receives the GPIO high level output by the GPIO, a corresponding GPIO interrupt is triggered by the CPU.
可选的,所述通过相应的中断服务向上层应用发送清理启动信号,包括:Optionally, the sending a cleanup start signal to the upper-layer application through the corresponding interrupt service includes:
通过相应的中断服务向上层用户态检测程序发送清理启动信号。Send a cleanup start signal to the upper user mode detection program through the corresponding interrupt service.
可选的,所述执行重启前的系统清理操作,包括:Optionally, the performing the system cleaning operation before restarting includes:
执行重启前的中断服务操作以及停止磁盘写入操作。Perform out-of-service operations and stop disk write operations before restarting.
可选的,所述执行重启前的中断服务操作以及停止磁盘写入操作,包括:Optionally, the performing the interrupting service operation and stopping the disk writing operation before restarting includes:
对当前所述设备中的所有存在的session进行清空;Clear all existing sessions in the current device;
针对当前所述设备中的正在进行的写入请求返回失败提示;A failure prompt is returned for the current write request in the device;
将当前所述设备中的所有目录均设置为只读模式;Set all directories in the current device to read-only mode;
将当前位于所述设备的缓存中的全部数据强制写入磁盘;forcibly write all data currently in the cache of the device to disk;
关闭所述设备中的nfs服务、samba服务、fuse服务、对象服务、块服务和负载均衡服务;Close the nfs service, samba service, fuse service, object service, block service and load balancing service in the device;
关闭所述设备中的存储服务;其中,所述存储服务包括所述设备的存储管理模块、非元数据存储模块和元数据存储模块的存储服务。The storage service in the device is closed; wherein, the storage service includes the storage management module, the non-metadata storage module and the storage service of the metadata storage module of the device.
可选的,所述重启所述设备,包括:Optionally, the restarting the device includes:
等待第二预设时长,然后重启所述设备。Wait a second preset period of time and then restart the device.
可选的,所述触发针对设备的重启命令之后,还包括:Optionally, after triggering the restart command for the device, the method further includes:
控制所述上层应用进入阻塞状态,以等待所述中断服务发送的所述清理启动信号。The upper-layer application is controlled to enter a blocking state to wait for the cleanup start signal sent by the interrupt service.
第二方面,本申请公开了一种设备重启装置,包括:In a second aspect, the present application discloses a device restarting device, comprising:
重启触发模块,用于触发针对设备的重启命令,并向BMC发送所述重启命令;a restart triggering module, configured to trigger a restart command for the device, and send the restart command to the BMC;
中断触发模块,用于当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断;Interrupt triggering module, for when the BMC receives the restart command, then triggers the GPIO interrupt in the CPU through the BMC;
清理启动模块,用于在所述GPIO中断被触发之后,通过相应的中断服务向上层应用发送清理启动信号;a clean-up start module, configured to send a clean-up start signal to an upper-layer application through a corresponding interrupt service after the GPIO interrupt is triggered;
清理执行模块,用于当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作;a cleanup execution module, configured to perform a system cleanup operation before restarting when the upper-layer application receives the cleanup start signal;
设备重启模块,用于在所述系统清理操作完成之后,重启所述设备。A device restarting module, configured to restart the device after the system cleaning operation is completed.
第三方面,本申请公开了一种电子设备,包括:In a third aspect, the present application discloses an electronic device, comprising:
存储器,用于保存计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序,以实现前述公开的设备重启方法。The processor is configured to execute the computer program to implement the device restarting method disclosed above.
第四方面,本申请公开了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现前述公开的设备重启方法。In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the device restarting method disclosed above is implemented.
本申请中,在触发针对设备的重启命令之后,向BMC发送该重启命令,然后通过BMC来触发GPIO中断,接着通过中断服务向上层应用发送清理启动信号,这样,当上层应用接收到上述清理启动信号,将可以立刻在设备正式重启之前执行系统清理操作。可见,本申请通过BMC触发GPIO中断,使得可以通过中断服务向上层应用发送清理启动信号,由此达到了快速清理系统的效果,避免了现有技术中需要在重启过程中反复进行轮询的情况,减少了对系统资源的占用,具有较高的实时性。In the present application, after triggering the restart command for the device, send the restart command to the BMC, then trigger the GPIO interrupt through the BMC, and then send a clean-up start signal to the upper-layer application through the interrupt service. In this way, when the upper-layer application receives the above-mentioned clean-up start signal, it will be possible to perform system cleanup operations immediately before the device is officially restarted. It can be seen that the present application triggers a GPIO interrupt through the BMC, so that a clearing start signal can be sent to the upper-layer application through the interrupt service, thereby achieving the effect of quickly clearing the system and avoiding the need to repeatedly poll during the restart process in the prior art. , which reduces the occupation of system resources and has high real-time performance.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only It is an embodiment of the present application. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without any creative effort.
图1为本申请公开的一种设备重启方法流程图;FIG. 1 is a flowchart of a method for restarting a device disclosed in the application;
图2为本申请公开的一种具体的设备重启方法流程图;2 is a flowchart of a specific device restarting method disclosed in the application;
图3为本申请公开的一种设备重启方案的应用示意图;3 is an application schematic diagram of a device restarting solution disclosed in the present application;
图4为本申请公开的一种具体的设备重启方法流程图;4 is a flowchart of a specific device restarting method disclosed in the application;
图5为本申请公开的一种设备重启装置结构示意图;5 is a schematic structural diagram of a device restarting device disclosed in the application;
图6为本申请公开的一种电子设备的结构图。FIG. 6 is a structural diagram of an electronic device disclosed in this application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
目前,机器设备在重启时,如果不检测是否有服务正在运行或者有磁盘正在被访问,此时重启将很容易导致机器重启后服务异常或者磁盘损坏。为此,现有技术中出现了一种方式来防止此问题的发生,即轮询BMC的状态,一旦发现BMC状态处于重启状态,则立即中断所有服务并停止所有磁盘写入的操作。然而,上述设备重启方式存在以下几个问题,一是轮询方式一直会占用系统资源;二是轮询方式实时性不高,需要延长关机等待时间,降低了用户体验。为此,本申请提供了一种新的设备重启方案,能够减少对系统资源的占用,并且具有较高的实时性。At present, when a machine is restarted, if it does not detect whether a service is running or a disk is being accessed, restarting at this time will easily lead to abnormal service or disk damage after the machine is restarted. Therefore, there is a way to prevent this problem in the prior art, that is, polling the state of the BMC, and once it is found that the state of the BMC is in the restarting state, all services are immediately interrupted and all disk writing operations are stopped. However, the above-mentioned device restarting method has the following problems. First, the polling method will always occupy system resources; second, the polling method is not real-time, and needs to prolong the shutdown waiting time, which reduces the user experience. Therefore, the present application provides a new device restarting solution, which can reduce the occupation of system resources and has high real-time performance.
参见图1所示,本申请实施例公开了一种设备重启方法,包括:Referring to FIG. 1 , an embodiment of the present application discloses a device restarting method, including:
步骤S11:触发针对设备的重启命令,并向BMC发送所述重启命令。Step S11: Trigger a restart command for the device, and send the restart command to the BMC.
可以理解的是,本实施例中的所述设备是指设置了BMC的设备,包括但不限于服务器设备。It can be understood that, the device in this embodiment refers to a device with a BMC set, including but not limited to a server device.
在一种具体实施方式中,可以通过用户手动触发的方式来触发针对设备的重启命令,即本实施例中的重启过程具体可以是由用户来触发的重启过程。In a specific implementation manner, the restart command for the device may be triggered manually by the user, that is, the restart process in this embodiment may specifically be a restart process triggered by the user.
在另一种具体实施方式中,也可以由后台开启事件监听线程,通过上述事件监听线程来监听当前系统是否产生了目标事件,如果是,则触发所述重启命令。其中,所述目标事件可以是由用户预先设置的事件,当然也可以是由特定应用程序设置的事件。In another specific implementation manner, an event monitoring thread may also be started in the background, and the above event monitoring thread is used to monitor whether the current system generates a target event, and if so, the restart command is triggered. Wherein, the target event may be an event preset by the user, or may of course be an event set by a specific application program.
步骤S12:当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断,然后通过相应的中断服务向上层应用发送清理启动信号。Step S12: When the BMC receives the restart command, the BMC triggers a GPIO interrupt in the CPU through the BMC, and then sends a cleanup start signal to an upper-layer application through a corresponding interrupt service.
本实施例中,BMC接收到重启命令之后,触发GPIO中断(GPIO,即General-purposeinput/output),通用输入/输出口),在此基础上,便进一步生成用于启动系统清理操作的清理启动信号,并通过中断服务将该清理启动信号发送给上层应用。其中,上层应用是指位于应用层上的应用程序,而CPU则是位于内核层,BMC则位于硬件层。In this embodiment, after receiving the restart command, the BMC triggers a GPIO interrupt (GPIO, that is, General-purpose input/output, general-purpose input/output port), and on this basis, further generates a cleanup startup for starting the system cleanup operation. signal, and send the cleanup start signal to the upper-layer application through the interrupt service. Among them, the upper-layer application refers to the application program located on the application layer, the CPU is located at the kernel layer, and the BMC is located at the hardware layer.
另外,需要指出的是,本实施例在所述触发针对设备的重启命令之后,还可以包括:控制所述上层应用进入阻塞状态,以等待所述中断服务发送的所述清理启动信号。也即,本实施例在重启命令被触发之后,便令上层应用进入阻塞状态,以便等待所述中断服务发送的清理启动信号。In addition, it should be noted that, after triggering the restart command for the device in this embodiment, the method may further include: controlling the upper-layer application to enter a blocking state to wait for the cleanup start signal sent by the interrupt service. That is, in this embodiment, after the restart command is triggered, the upper-layer application is made to enter the blocking state, so as to wait for the cleanup start signal sent by the interrupt service.
步骤S13:当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作,然后重启所述设备。Step S13: When the upper-layer application receives the cleanup start signal, it performs a system cleanup operation before restarting, and then restarts the device.
本实施例中,当上层应用接收到BMC发送的清理启动信号时,立即展开重启前的系统清理操作。当清理完毕之后,便可重启设备。In this embodiment, when the upper-layer application receives the cleanup start signal sent by the BMC, it immediately starts the system cleanup operation before the restart. When the cleaning is complete, you can restart the device.
本申请实施例中,在触发针对设备的重启命令之后,向BMC发送该重启命令,然后通过BMC来触发GPIO中断,接着通过中断服务向上层应用发送清理启动信号,这样,当上层应用接收到上述清理启动信号,将可以立刻在设备正式重启之前执行系统清理操作。可见,本申请实施例通过BMC触发GPIO中断,使得可以通过中断服务向上层应用发送清理启动信号,由此达到了快速清理系统的效果,避免了现有技术中需要在重启过程中反复进行轮询的情况,减少了对系统资源的占用,具有较高的实时性。进一步的,本实施例中的设备重启方案,还具备较高的可靠性和安全性。In the embodiment of the present application, after triggering the restart command for the device, the restart command is sent to the BMC, and then the GPIO interrupt is triggered through the BMC, and then the cleanup start signal is sent to the upper-layer application through the interrupt service. In this way, when the upper-layer application receives the above Clearing the boot signal will allow you to perform system cleanup operations immediately before the device is officially restarted. It can be seen that the embodiment of the present application triggers the GPIO interrupt through the BMC, so that a clean-up start signal can be sent to the upper-layer application through the interrupt service, thereby achieving the effect of quickly cleaning the system and avoiding the need for repeated polling during the restart process in the prior art It reduces the occupation of system resources and has high real-time performance. Further, the device restarting solution in this embodiment also has high reliability and security.
参见图2所示,本申请实施例公开了一种具体的设备重启方法,包括:Referring to FIG. 2 , an embodiment of the present application discloses a specific device restarting method, including:
步骤S21:触发针对设备的重启命令,并向BMC发送所述重启命令。Step S21: Trigger a restart command for the device, and send the restart command to the BMC.
步骤S22:当所述BMC接收到所述重启命令,则通过所述BMC发送高电平至GPIO,并等待第一预设时长。Step S22: When the BMC receives the restart command, it sends a high level to the GPIO through the BMC, and waits for a first preset duration.
也即,本申请实施例中,BMC接收到重启命令之后,可以通过BMC触发一个高电平,然后将该高电平发送至GPIO,并等待第一预设时长。That is, in the embodiment of the present application, after the BMC receives the restart command, it can trigger a high level through the BMC, then send the high level to the GPIO, and wait for the first preset time period.
可以理解的是,上述第一预设时长可以基于实际的应用需要来进行设置。具体的,在所述通过所述BMC发送高电平至GPIO,并等待第一预设时长之前,还可以包括:通过第一参数配置接口,配置数值为10秒的所述第一预设时长。如此一来,BMC接收到重启命令之后,向GPIO发送一个高电平并等待10秒钟的时间。其中,上述第一参数配置接口可以是在人机交互界面创建的接口,用于获取用户输入的时间数值以作为所述第一预设时长。It can be understood that, the above-mentioned first preset duration may be set based on actual application requirements. Specifically, before the sending a high level to the GPIO through the BMC and waiting for the first preset duration, the method may further include: through a first parameter configuration interface, configuring the first preset duration with a value of 10 seconds . In this way, after the BMC receives the restart command, it sends a high level to the GPIO and waits for 10 seconds. Wherein, the above-mentioned first parameter configuration interface may be an interface created on a human-computer interaction interface, and is used to obtain a time value input by a user as the first preset time length.
步骤S23:当所述CPU接收到所述GPIO输出的所述GPIO高电平,则通过所述CPU触发相应的GPIO中断,然后通过相应的中断服务向上层应用发送清理启动信号。Step S23: When the CPU receives the GPIO high level output by the GPIO, triggers a corresponding GPIO interrupt through the CPU, and then sends a cleanup start signal to an upper-layer application through a corresponding interrupt service.
需要指出的是,当BMC向GPIO发送了一个高电平后,GPIO会输出相应的GPIO高电平。当CPU接收到上述GPIO高电平后,触发相应的GPIO中断,并进入驱动的中断服务,然后通过该中断服务向上层应用发送用于触发系统清理操作的清理启动信号。具体的,CPU触发GPIO中断后,由GPIO中断驱动来捕获上述GPIO中断,然后通过GPIO中断驱动向上层应用发送清理启动信号。It should be pointed out that when the BMC sends a high level to the GPIO, the GPIO will output the corresponding GPIO high level. When the CPU receives the above-mentioned GPIO high level, it triggers the corresponding GPIO interrupt and enters the driver's interrupt service, and then sends a clean-up start signal to the upper-layer application for triggering the system clean-up operation through the interrupt service. Specifically, after the CPU triggers the GPIO interrupt, the GPIO interrupt driver captures the above-mentioned GPIO interrupt, and then sends a cleanup start signal to the upper-layer application through the GPIO interrupt driver.
图3示出了一种设备重启方案的应用示意图,图3中,当BMC接收到重启命令后,触发GPIO高电平,然后触发GPIO中断,接着由GPIO中断驱动来捕获上述GPIO中断并向上层应用发送清理启动信号。Figure 3 shows a schematic diagram of the application of a device restart scheme. In Figure 3, when the BMC receives the restart command, it triggers the GPIO high level, then triggers the GPIO interrupt, and then is driven by the GPIO interrupt to capture the above GPIO interrupt and send it to the upper layer The application sends a cleanup start signal.
步骤S24:当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作,然后等待第二预设时长,接着重启所述设备。Step S24: When the upper-layer application receives the cleanup start signal, it performs a system cleanup operation before restarting, waits for a second preset time period, and then restarts the device.
与所述第一预设时长类似,本实施例中的第二预设时长也是可以基于实际的应用需要来进行具体设置。具体的,本实施例在所述等待第二预设时长,然后重启所述设备之前,还可以包括:通过第二参数配置接口,配置数值为10秒的所述第二预设时长。其中,上述第二参数配置接口可以是在人机交互界面创建的接口,用于获取用户输入的时间数值以作为所述第二预设时长。可以理解的是,通过设置上述第二预设时长,可以使得设备在重启过程中有更加充分的时间做系统清理操作,具有更强的可维护性。Similar to the first preset duration, the second preset duration in this embodiment can also be specifically set based on actual application needs. Specifically, in this embodiment, before the waiting for the second preset duration and then restarting the device, the method may further include: configuring the second preset duration with a value of 10 seconds through a second parameter configuration interface. Wherein, the above-mentioned second parameter configuration interface may be an interface created on a human-computer interaction interface, and is used to obtain a time value input by a user as the second preset duration. It can be understood that by setting the above-mentioned second preset duration, the device can have more sufficient time to perform the system cleaning operation during the restarting process, and has stronger maintainability.
参见图4所示,本申请实施例公开了一种具体的设备重启方法,包括:Referring to FIG. 4 , an embodiment of the present application discloses a specific device restarting method, including:
步骤S31:触发针对设备的重启命令,并向BMC发送所述重启命令。Step S31: Trigger a restart command for the device, and send the restart command to the BMC.
步骤S32:当所述BMC接收到所述重启命令,则通过所述BMC发送高电平至GPIO,并等待10秒。Step S32: When the BMC receives the restart command, it sends a high level to the GPIO through the BMC, and waits for 10 seconds.
步骤S33:当所述CPU接收到所述GPIO输出的所述GPIO高电平,则通过所述CPU触发相应的GPIO中断,然后通过相应的中断服务向上层用户态检测程序发送清理启动信号。Step S33: When the CPU receives the GPIO high level output by the GPIO, the CPU triggers a corresponding GPIO interrupt, and then sends a cleanup start signal to the upper-layer user mode detection program through a corresponding interrupt service.
步骤S34:当所述上层用户态检测程序接收到所述清理启动信号,则执行重启前的中断服务操作以及停止磁盘写入操作,然后等待10秒,接着重启所述设备。Step S34: When the upper-layer user mode detection program receives the cleanup start signal, it executes the interrupt service operation and stops the disk writing operation before restarting, waits for 10 seconds, and then restarts the device.
也即,本实施例通过中断服务向上层用户态检测程序发送清理启动信号,当上层用户态检测程序获取到上述清理启动信号之后,便可立即中断所有服务和停止所有磁盘的写入操作,然后等待10秒,接着重启机器即可。That is, in this embodiment, a clean-up start signal is sent to the upper-layer user-mode detection program by interrupting the service, and after the upper-layer user-mode detection program obtains the above-mentioned clean-up start signal, it can immediately interrupt all services and stop all disk write operations, and then Wait 10 seconds, then restart the machine.
其中,所述执行重启前的中断服务操作以及停止磁盘写入操作,具体可以依次包括以下步骤:Wherein, performing the interrupting service operation before restarting and stopping the disk writing operation may specifically include the following steps in sequence:
对当前所述设备中的所有存在的session进行清空;Clear all existing sessions in the current device;
针对当前所述设备中的正在进行的写入请求返回失败提示;A failure prompt is returned for the current write request in the device;
将当前所述设备中的所有目录均设置为只读模式;Set all directories in the current device to read-only mode;
将当前位于所述设备的缓存中的全部数据强制写入磁盘;forcibly write all data currently in the cache of the device to disk;
关闭所述设备中的nfs服务、samba服务、fuse服务、对象服务、块服务和负载均衡服务;Close the nfs service, samba service, fuse service, object service, block service and load balancing service in the device;
关闭所述设备中的存储服务;其中,所述存储服务包括所述设备的存储管理模块、非元数据存储模块和元数据存储模块的存储服务。The storage service in the device is closed; wherein, the storage service includes the storage management module, the non-metadata storage module and the storage service of the metadata storage module of the device.
本实施例中,通过上述具体的清理操作,能够确保系统的鲁棒性,防止读写磁盘时由于断电导致磁盘写入数据异常、甚至是磁盘损坏等问题。In this embodiment, through the above-mentioned specific cleaning operations, the robustness of the system can be ensured, and problems such as abnormal data written to the disk due to power failure during reading and writing of the disk, or even damage to the disk can be prevented.
参见图5所示,本申请实施例还相应公开了一种设备重启装置,包括:Referring to FIG. 5 , an embodiment of the present application also discloses a device restarting device, including:
重启触发模块11,用于触发针对设备的重启命令,并向BMC发送所述重启命令;A
中断触发模块12,用于当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断;Interrupt
清理启动模块13,用于在所述GPIO中断被触发之后,通过相应的中断服务向上层应用发送清理启动信号;The clean-
清理执行模块14,用于当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作;a
设备重启模块15,用于在所述系统清理操作完成之后,重启所述设备。The
本申请实施例中,在触发针对设备的重启命令之后,向BMC发送该重启命令,然后通过BMC来触发GPIO中断,接着通过中断服务向上层应用发送清理启动信号,这样,当上层应用接收到上述清理启动信号,将可以立刻在设备正式重启之前执行系统清理操作。可见,本申请实施例通过BMC触发GPIO中断,使得可以通过中断服务向上层应用发送清理启动信号,由此达到了快速清理系统的效果,避免了现有技术中需要在重启过程中反复进行轮询的情况,减少了对系统资源的占用,具有较高的实时性。In the embodiment of the present application, after triggering the restart command for the device, the restart command is sent to the BMC, and then the GPIO interrupt is triggered through the BMC, and then the cleanup start signal is sent to the upper-layer application through the interrupt service. In this way, when the upper-layer application receives the above Clearing the boot signal will allow you to perform system cleanup operations immediately before the device is officially restarted. It can be seen that the embodiment of the present application triggers the GPIO interrupt through the BMC, so that a clean-up start signal can be sent to the upper-layer application through the interrupt service, thereby achieving the effect of quickly cleaning the system and avoiding the need for repeated polling during the restart process in the prior art It reduces the occupation of system resources and has high real-time performance.
在一些具体实施例中,所述中断触发模块12,包括:In some specific embodiments, the interrupt triggering
高电平发送单元,用于通过所述BMC发送高电平至GPIO,并等待第一预设时长;a high-level sending unit, configured to send a high-level to the GPIO through the BMC, and wait for a first preset duration;
中断触发单元,用于当所述CPU接收到所述GPIO输出的所述GPIO高电平,则通过所述CPU触发相应的GPIO中断。An interrupt triggering unit, configured to trigger a corresponding GPIO interrupt through the CPU when the CPU receives the GPIO high level output by the GPIO.
在一些具体实施例中,所述设备重启装置,还包括:In some specific embodiments, the device restarting apparatus further includes:
第一参数配置模块,用于在通过所述BMC发送高电平至GPIO,并等待第一预设时长之前,通过第一参数配置接口,配置数值为10秒的所述第一预设时长。The first parameter configuration module is configured to configure the first preset duration of 10 seconds through the first parameter configuration interface before sending a high level to the GPIO through the BMC and waiting for the first preset duration.
在一些具体实施例中,所述清理启动模块13,具体用于在所述GPIO中断被触发之后,通过相应的中断服务向上层用户态检测程序发送清理启动信号。In some specific embodiments, the clean-
在一些具体实施例中,所述清理执行模块14,具体用于执行重启前的中断服务操作以及停止磁盘写入操作。In some specific embodiments, the
在一些具体实施例中,所述设备重启模块15,用于在所述系统清理操作完成之后,等待第二预设时长,然后重启所述设备。In some specific embodiments, the
在一些具体实施例中,所述设备重启装置,还包括:In some specific embodiments, the device restarting apparatus further includes:
第二参数配置模块,用于通过第二参数配置接口,配置数值为10秒的所述第二预设时长。The second parameter configuration module is configured to configure the second preset duration with a value of 10 seconds through the second parameter configuration interface.
在一些具体实施例中,所述设备重启装置,还包括:In some specific embodiments, the device restarting apparatus further includes:
阻塞控制模块,用于控制所述上层应用进入阻塞状态,以等待所述中断服务发送的所述清理启动信号。A blocking control module, configured to control the upper-layer application to enter a blocking state to wait for the cleanup start signal sent by the interrupt service.
进一步的,参见图6所示,本申请实施例还公开了一种电子设备20,包括处理器21和存储器22;其中:Further, as shown in FIG. 6 , an embodiment of the present application further discloses an
存储器22,用于保存计算机程序;memory 22 for storing computer programs;
处理器21,用于执行所述计算机程序,以实现以下步骤:The processor 21 is configured to execute the computer program to realize the following steps:
触发针对设备的重启命令,并向BMC发送所述重启命令;当所述BMC接收到所述重启命令,则通过所述BMC触发CPU中的GPIO中断,然后通过相应的中断服务向上层应用发送清理启动信号;当所述上层应用接收到所述清理启动信号,则执行重启前的系统清理操作,然后重启所述设备。Trigger a restart command for the device, and send the restart command to the BMC; when the BMC receives the restart command, trigger the GPIO interrupt in the CPU through the BMC, and then send a cleanup to the upper-layer application through the corresponding interrupt service A startup signal; when the upper-layer application receives the cleanup startup signal, it performs a system cleanup operation before restarting, and then restarts the device.
本申请实施例中,在触发针对设备的重启命令之后,向BMC发送该重启命令,然后通过BMC来触发GPIO中断,接着通过中断服务向上层应用发送清理启动信号,这样,当上层应用接收到上述清理启动信号,将可以立刻在设备正式重启之前执行系统清理操作。可见,本申请实施例通过BMC触发GPIO中断,使得可以通过中断服务向上层应用发送清理启动信号,由此达到了快速清理系统的效果,避免了现有技术中需要在重启过程中反复进行轮询的情况,减少了对系统资源的占用,具有较高的实时性。In the embodiment of the present application, after triggering the restart command for the device, the restart command is sent to the BMC, and then the GPIO interrupt is triggered through the BMC, and then the cleanup start signal is sent to the upper-layer application through the interrupt service. In this way, when the upper-layer application receives the above Clearing the boot signal will allow you to perform system cleanup operations immediately before the device is officially restarted. It can be seen that the embodiment of the present application triggers the GPIO interrupt through the BMC, so that a clean-up start signal can be sent to the upper-layer application through the interrupt service, thereby achieving the effect of quickly cleaning the system and avoiding the need for repeated polling during the restart process in the prior art It reduces the occupation of system resources and has high real-time performance.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:通过所述BMC发送高电平至GPIO,并等待第一预设时长;当所述CPU接收到所述GPIO输出的所述GPIO高电平,则通过所述CPU触发相应的GPIO中断。In some specific implementation manners, the processor 21 executes a computer program, which can specifically implement: sending a high level to the GPIO through the BMC, and waiting for a first preset duration; when the CPU receives the GPIO output If the GPIO is at a high level, the corresponding GPIO interrupt is triggered by the CPU.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:通过第一参数配置接口,配置数值为10秒的所述第一预设时长。In some specific implementation manners, by executing a computer program, the processor 21 can specifically implement: through a first parameter configuration interface, configure the first preset duration with a value of 10 seconds.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:通过相应的中断服务向上层用户态检测程序发送清理启动信号。In some specific implementation manners, the processor 21 can specifically implement by executing a computer program: sending a cleanup start signal to an upper-layer user-mode detection program through a corresponding interrupt service.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:执行重启前的中断服务操作以及停止磁盘写入操作。In some specific implementation manners, the processor 21 can specifically implement, by executing a computer program, the interrupt service operation before the restart and the stop of the disk writing operation.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:等待第二预设时长,然后重启所述设备。In some specific implementation manners, by executing a computer program, the processor 21 can specifically implement: waiting for a second preset time period, and then restarting the device.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:通过第二参数配置接口,配置数值为10秒的所述第二预设时长。In some specific implementation manners, by executing a computer program, the processor 21 can specifically implement: configuring the second preset duration with a value of 10 seconds through a second parameter configuration interface.
在一些具体实施方式中,所述处理器21通过执行计算机程序,具体可以实现:控制所述上层应用进入阻塞状态,以等待所述中断服务发送的所述清理启动信号。In some specific implementation manners, by executing a computer program, the processor 21 can specifically implement: controlling the upper-layer application to enter a blocking state to wait for the cleanup start signal sent by the interrupt service.
参见图6所示,本实施例中的电子设备20,还可以进一步包括电源23、通信接口24、输入输出接口25和通信总线26。Referring to FIG. 6 , the
电源23用于为电子设备20上的各硬件设备提供工作电压;通信接口24能够为电子设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。The power supply 23 is used to provide working voltage for each hardware device on the
另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源包括操作系统221、用于实现上述方法的计算机程序222及其他类型的数据223等,存储方式可以是短暂存储或者永久存储。In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon include an operating system 221, a computer program 222 for implementing the above method, and other types of data 223 etc., the storage method can be short-term storage or permanent storage.
其中,操作系统221用于管理与控制电子设备20上的各硬件设备以及计算机程序222,以实现处理器21对存储器22中数据223的运算与处理。计算机程序222除了包括能够用于完成前述任一实施例公开的由电子设备20执行的设备重启方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。数据223可以包括电子设备20收集到的其他类型的数据。The operating system 221 is used to manage and control various hardware devices and computer programs 222 on the
进一步的,本申请还公开了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现前述实施例公开的设备重启方法。Further, the present application also discloses a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the device restarting method disclosed in the foregoing embodiments is implemented.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
以上对本申请所提供的一种设备重启方法、装置、设备及介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。A device restarting method, device, device and medium provided by the present application have been described in detail above. The principles and implementations of the present application are described with specific examples in this paper. The descriptions of the above embodiments are only used to help understanding The method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation and application scope. In summary, the content of this specification should not be It is construed as a limitation of this application.
Claims (8)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911386419.4A CN111124761B (en) | 2019-12-29 | 2019-12-29 | Equipment restarting method, device, equipment and medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911386419.4A CN111124761B (en) | 2019-12-29 | 2019-12-29 | Equipment restarting method, device, equipment and medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111124761A CN111124761A (en) | 2020-05-08 |
| CN111124761B true CN111124761B (en) | 2022-04-22 |
Family
ID=70504413
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911386419.4A Active CN111124761B (en) | 2019-12-29 | 2019-12-29 | Equipment restarting method, device, equipment and medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111124761B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112905377B (en) * | 2021-02-10 | 2022-09-20 | 山东英信计算机技术有限公司 | A method, system and medium for avoiding BMC crash |
| CN114064234B (en) * | 2021-09-26 | 2022-11-18 | 荣耀终端有限公司 | Method and device for repairing WMI service |
| CN114090309B (en) * | 2021-10-19 | 2023-04-07 | 荣耀终端有限公司 | Method and device for repairing WMI service |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102567177A (en) * | 2010-12-25 | 2012-07-11 | 鸿富锦精密工业(深圳)有限公司 | System and method for detecting error of computer system |
| CN104850414A (en) * | 2014-02-14 | 2015-08-19 | 可牛网络技术(北京)有限公司 | Cleaning method and cleaning apparatus of application process, and mobile terminal |
| CN107179911A (en) * | 2017-05-19 | 2017-09-19 | 郑州云海信息技术有限公司 | A kind of method and apparatus for restarting management engine |
| CN108733466A (en) * | 2017-04-19 | 2018-11-02 | 北京京东尚科信息技术有限公司 | Restart the method, apparatus and equipment of the application system example in distributed system |
| CN110362430A (en) * | 2019-07-19 | 2019-10-22 | 苏州浪潮智能科技有限公司 | A kind of method being restarted automatically, system and the storage medium of server |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9146797B2 (en) * | 2013-08-09 | 2015-09-29 | American Megatrends, Inc. | Method for ensuring remediation of hung multiplexer bus channels |
-
2019
- 2019-12-29 CN CN201911386419.4A patent/CN111124761B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102567177A (en) * | 2010-12-25 | 2012-07-11 | 鸿富锦精密工业(深圳)有限公司 | System and method for detecting error of computer system |
| CN104850414A (en) * | 2014-02-14 | 2015-08-19 | 可牛网络技术(北京)有限公司 | Cleaning method and cleaning apparatus of application process, and mobile terminal |
| CN108733466A (en) * | 2017-04-19 | 2018-11-02 | 北京京东尚科信息技术有限公司 | Restart the method, apparatus and equipment of the application system example in distributed system |
| CN107179911A (en) * | 2017-05-19 | 2017-09-19 | 郑州云海信息技术有限公司 | A kind of method and apparatus for restarting management engine |
| CN110362430A (en) * | 2019-07-19 | 2019-10-22 | 苏州浪潮智能科技有限公司 | A kind of method being restarted automatically, system and the storage medium of server |
Non-Patent Citations (1)
| Title |
|---|
| 基于ARM的BMC设计与实现;何毅平;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;20161215;第2016卷(第12期);全文 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111124761A (en) | 2020-05-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111124761B (en) | Equipment restarting method, device, equipment and medium | |
| CN105204979A (en) | Recording method of Android logs and mobile terminal | |
| CN115658113A (en) | Server self-starting method, device, readable storage medium and electronic equipment | |
| CN102891762B (en) | The system and method for network data continuously | |
| CN107608828A (en) | Method, system, device and the storage medium that data center's power down recovers automatically | |
| CN115951949A (en) | Method, device and computing device for recovering configuration parameters of BIOS | |
| CN114184885A (en) | Fault detection method, device and storage medium | |
| CN109960638A (en) | BMC startup reason recording method, system, device and readable storage medium | |
| CN115033462B (en) | Storage server startup detection method, system, device, equipment and storage medium | |
| CN111090546B (en) | Method, device and equipment for restarting operating system and readable storage medium | |
| CN110505246B (en) | Client network communication detection method, device and storage medium | |
| CN117032881B (en) | Method, device and storage medium for detecting and recovering abnormality of virtual machine | |
| CN110365538B (en) | Port state control method, device, equipment and computer readable storage medium | |
| CN111475339A (en) | BIOS firmware updating method, device, equipment and storage medium | |
| CN114281422B (en) | A cloud computer control method, device, and medium | |
| CN110362430A (en) | A kind of method being restarted automatically, system and the storage medium of server | |
| CN112463174B (en) | Method, device, equipment and storage medium for remotely unloading server | |
| CN110413092B (en) | Method and equipment for preventing automatic system startup after RTC (real time clock) is cleared | |
| CN113391940A (en) | Method and system for consolidating system service by breaking limit of watchdog | |
| CN111400113A (en) | Complete machine self-checking method, device and system of computer system | |
| CN114936043B (en) | Method, device, equipment and storage medium for starting pooled heterogeneous resources | |
| CN114327010B (en) | System control method, device and medium | |
| CN114489994A (en) | Small program life cycle management and control method, system, electronic device and storage medium | |
| CN118605910A (en) | QGA plug-in update method, device, medium, and equipment | |
| CN118708506A (en) | A channel control method, controller, computer device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |