Data processing method, device, equipment, storage medium and program product
By setting different exception file storage locations in the host and Docker containers, the problem of inability to match the core files generated by multiple Docker containers and the host is solved, improving the matching accuracy and helping developers quickly locate and repair abnormal processes.
Patent Information
- Application Number
- CN202110883037.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-02
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2041-08-02
AI Technical Summary
When multiple Docker containers are run on the host, the storage location of the core file is unified, resulting in the inability to accurately match the specific Docker container or host, reducing the matching accuracy.
By setting different exception file storage locations in the host and each Docker container, determining the target configuration parameters based on the exception signal, and placing the target exception file in a specific storage location, the core files generated by different Docker containers and hosts can be distinguished.
Improved the accuracy of matching core files with Docker containers and hosts, making it easier for developers to locate and repair abnormal processes.
Smart Images

Figure CN113535249B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device, equipment, storage medium and program product. Background Art
[0002] Docker container is an open source application container engine, which is lightweight and portable. Developers can package their applications and related dependencies into a Docker container and then publish it to the host machine. The portability of Docker effectively improves the efficiency of developers in publishing applications.
[0003] In the prior art, the essence of a Docker container is a process (Docker process), but unlike a process that runs directly on a host machine, a Docker process runs in an independent namespace belonging to a Docker container. When a Docker process crashes, the host machine will record the current running status information of the Docker process in the form of a core file and save it in the host machine directory, so that developers can find the bug that caused the Docker process to crash and fix it.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: since many Docker containers are generally run in the host machine, the core files generated by the host machine and all the Docker containers are saved in the host machine directory. Therefore, it is impossible to accurately know who specifically generates the core file, resulting in poor matching accuracy between the core file and the Docker container and between the core file and the host machine. Summary of the invention
[0005] The present application provides a data processing method, apparatus, device, storage medium and program product to solve the problem in the prior art that since many Docker containers are generally run in a host machine, the core files generated by the host machine and all Docker containers are stored in the host machine directory. Therefore, it is impossible to accurately know who specifically generated the core file, resulting in poor matching accuracy between the core file and the Docker container and between the core file and the host machine.
[0006] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to a host machine, wherein a plurality of processes are running in the host machine, and the method comprises:
[0007] When any process runs abnormally, an abnormal signal is generated and suspended, wherein the abnormal signal includes the target Docker container identifier or the host identifier, and the host runs a Docker container;
[0008] According to the abnormal signal, determine the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host machine, the target configuration parameters include the storage location of a target abnormal file, the target abnormal file is generated when an abnormality occurs during the operation of the process, the target abnormal file includes operation status information, and the storage location of the abnormal file included in the configuration parameters of the different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine;
[0009] The target abnormal file is placed in the target storage location.
[0010] In a specific implementation, the abnormal signal includes the target Docker container identifier, and determining the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host machine according to the abnormal signal includes:
[0011] According to the mapping relationship between the Docker container identifier and the configuration parameters, the target configuration parameters corresponding to the target Docker container identifier are determined from the configuration parameters of different processes.
[0012] In a specific implementation, the abnormal signal includes the host machine identifier, and determining the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host machine according to the abnormal signal includes:
[0013] The configuration parameter corresponding to the host machine identifier is determined as the target configuration parameter.
[0014] In a specific implementation, before placing the target abnormal file in the target storage location, the method further includes:
[0015] The running status information when the process runs abnormally is stored in the target abnormality file.
[0016] In a specific embodiment, the method further comprises:
[0017] When the process returns from the kernel state to the user state, detecting whether there is a hanging signal for the process;
[0018] If the process has a suspended signal, it is determined whether the signal is the abnormal signal.
[0019] In a specific implementation, the target configuration parameter further includes a naming rule for the target abnormal file, and the placing of the target abnormal file in the target storage location includes: naming the target abnormal file according to the naming rule for the target abnormal file;
[0020] The named target abnormal file is placed in the target storage location.
[0021] In a specific implementation, when any process runs abnormally, before generating an abnormal signal and suspending, the method further includes:
[0022] After starting the Docker container, setting configuration parameters for the Docker container;
[0023] The configuration parameters of the Docker container are stored in the data segment of the Docker container.
[0024] Optionally, the storage location of the target abnormal file is a namespace corresponding to the target Docker container identifier.
[0025] In a second aspect, an embodiment of the present application provides a data processing device, which is applied to a host machine, wherein multiple processes are running in the host machine, and the device includes:
[0026] A generation module, used for generating an abnormal signal and suspending when any process runs abnormally, wherein the abnormal signal includes a target Docker container identifier or a host identifier, and the host runs a Docker container;
[0027] a determination module, configured to determine, according to the abnormal signal, target configuration parameters corresponding to the process from configuration parameters of different Docker containers and configuration parameters of the host machine, wherein the target configuration parameters include a storage location of a target abnormal file, the target abnormal file is generated when an abnormality occurs during the operation of the process, the target abnormal file includes operation status information, and the storage location of the abnormal file included in the configuration parameters of the different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine;
[0028] A processing module is used to place the target abnormal file in the target storage location.
[0029] In a specific implementation, the abnormal signal includes the target Docker container identifier, and the determination module is specifically used to:
[0030] According to the mapping relationship between the Docker container identifier and the configuration parameters, the target configuration parameters corresponding to the target Docker container identifier are determined from the configuration parameters of different Docker containers and the configuration parameters of the host machine.
[0031] In a specific implementation manner, the abnormal signal includes the host machine identifier, and the determination module is specifically configured to:
[0032] The configuration parameter corresponding to the host machine identifier is determined as the target configuration parameter.
[0033] Optionally, before placing the target abnormal file in the target storage location, the processing module is further configured to:
[0034] The running status information when the process runs abnormally is stored in the target abnormality file.
[0035] Optionally, the processing module is further used to:
[0036] When the process returns from the kernel state to the user state, detecting whether there is a hanging signal for the process;
[0037] If the process has a suspended signal, it is determined whether the signal is the abnormal signal.
[0038] In a specific implementation, the processing module is specifically used to:
[0039] Naming the target abnormal file according to the naming rule of the target abnormal file;
[0040] The named target abnormal file is placed in the target storage location.
[0041] Optionally, when any process runs abnormally, before generating an abnormal signal and suspending, the processing module is further used to:
[0042] After starting the Docker container, setting configuration parameters for the Docker container;
[0043] The configuration parameters of the Docker container are stored in the data segment of the Docker container.
[0044] Optionally, the storage location of the target abnormal file is a namespace corresponding to the target Docker container identifier.
[0045] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the first aspect and the methods provided by various possible designs when executing the computer program instructions.
[0046] In a fourth aspect, an embodiment of the present application may provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the methods provided by the first aspect and various possible designs.
[0047] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, is used to implement the first aspect and the methods provided by various possible designs.
[0048] The data processing method, device, equipment, storage medium and program product provided by the embodiment of the present application, when any process runs abnormally, an abnormal signal is generated and suspended, and according to the abnormal signal, the target configuration parameters corresponding to the process are determined from the configuration parameters of different Docker containers and the configuration parameters of the host machine, and the target abnormal file is placed in the target storage location. Since the storage location of the abnormal file included in the configuration parameters of different Docker containers and the storage location of the abnormal file included in the configuration parameters of the host machine are different, the Docker container or host machine that generates the target abnormal file can be determined by the storage location of the target abnormal file, which effectively improves the matching accuracy of the target abnormal file and the Docker container and the target abnormal file and the host machine. Further, the storage location of the target abnormal file can be the namespace corresponding to the target Docker container identifier, which is conducive to developers using the Docker view to view the namespace where the target abnormal file is stored, thereby determining the Docker container where the abnormal process is located, and repairing the process according to the target abnormal file. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0050] Figure 1 A schematic diagram of an application scenario of the data processing method provided in an embodiment of the present application;
[0051] Figure 2 A flowchart of a first embodiment of a data processing method provided in an embodiment of the present application;
[0052] Figure 3 A schematic diagram of a flow chart of a second embodiment of a data processing method provided by the present invention;
[0053] Figure 4 A schematic diagram of a flow chart of a third embodiment of a data processing method provided by the present invention;
[0054] Figure 5 A schematic diagram of a flow chart of a fourth embodiment of a data processing method provided by the present invention;
[0055] Figure 6A schematic diagram of the structure of a data processing device provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0057] The above drawings show clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0059] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0060] Before introducing the embodiments of the present application, the application scenarios of the embodiments of the present application are first explained:
[0061] Docker container is an open source, lightweight, portable application container engine. Developers can package their applications and dependent packages into a portable Docker container in a unified way, and then publish it to any host machine with Docker engine installed. Docker's lightness allows application publishing to be completed in just a few seconds, effectively improving the efficiency of developers in publishing applications.
[0062] Currently, you can start a single or multiple processes directly in a Docker container, or start multiple processes in the form of a shell script. Running a program in a Docker container is the same as running a program directly on a computer, except that the Docker container does not contain a kernel, so the Docker container does not require a special virtual machine mechanism, and the Docker container process can run directly on the CPU without instruction translation. The container provides a resource isolation mechanism to ensure that there will be no resource conflicts between different Docker containers and between Docker containers and the host machine.
[0063] In the prior art, the essence of a Docker container is a process (Docker process), but unlike a process that runs directly on a host machine, a Docker process runs in a namespace belonging to a Docker container. When a Docker process crashes, the host machine will record the current running status information of the Docker process in the form of a core file and save it in a default storage location (usually a host machine directory), so that developers can find the bug that caused the Docker process to crash and fix it.
[0064] Optionally, you can set the default storage location of the generated core file through core_pattern. core_pattern is a tool that comes with the Linux system to define the rules for the kernel to generate core files.
[0065] However, core_pattern is globally valid on the host. The core files generated by the host and all Docker containers are stored in the default storage location. The host generally runs many Docker containers. Therefore, it is impossible to accurately know whether the core file in the default storage location is generated by the host or which Docker container. As a result, the matching accuracy between the core file and the Docker container and between the core file and the host is poor, and developers are unable to further analyze the reasons for abnormalities in the Docker container or the host.
[0066] In view of the above problems, the invention of the present application is as follows: In the prior art, since the core files generated by the host machine and all Docker containers are stored in the same location (such as the host directory), it is impossible to match the core file with the Docker container or the core file with the host machine, resulting in poor matching accuracy between the core file and the Docker container and the core file and the host machine. Based on this, the inventor found that if the storage location for storing each core file is set for the host machine and each Docker container, so that the core file generated by each Docker container and the host machine can be stored in each specific location, the problem that the core file cannot be accurately matched with the Docker container or the core file with the host machine in the prior art can be solved, thereby improving the matching accuracy between the core file and the Docker container and the core file and the host machine.
[0067] Exemplarily, the data processing method provided in the embodiment of the present application can be applied to Figure 1 In a schematic diagram of an application scenario shown. Figure 1 The following is a schematic diagram of an application scenario of the data processing method provided in the embodiment of the present application, which is used to solve the above technical problems. Figure 1 As shown, the application scenario may include: a host machine, and may also include multiple Docker containers running in the host machine ( Figure 1 Three Docker containers are shown, namely Docker container 1, Docker container 2, and Docker container 3), and each Docker container has multiple processes running in the host machine ( Figure 1 In the figure, three processes are shown for Docker container 1, namely process 1A, process 1B, and process 1C; three processes are shown for Docker container 2, namely process 2A, process 2B, and process 2C; three processes are shown for Docker container 3, namely process 3A, process 3B, and process 3C). The host machine directly runs multiple processes ( Figure 1 Three processes are shown in the figure, namely process X, process Y, and process Z).
[0068] The host machine may be implemented as a terminal device, such as a computer, or may be implemented as a server. In the embodiments of the present application, the server and the terminal device may be collectively referred to as electronic devices.
[0069] The technical solution of the present application is described in detail below through specific embodiments.
[0070] It should be noted that the following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
[0071] Figure 2 The following is a flow chart of the first embodiment of the data processing method provided in the present application. Figure 2 As shown, the data processing method may include the following steps:
[0072] S101. When any process runs abnormally, an abnormal signal is generated and the process is suspended.
[0073] In this step, the host machine runs a Docker container, and multiple processes are running in the host machine. Among them, the host machine can directly run a process, which is a host process; the host machine can also run a process in a Docker container, and the process in the Docker container is a Docker process.
[0074] When an abnormality occurs in a host process or a Docker process, the host generates an abnormality signal indicating that the process is abnormal, and the abnormality signal includes a target Docker container identifier or a host identifier. Exemplarily, if the process is a host process, the abnormality signal includes a host identifier; if the process is a Docker process, the abnormality signal includes a target Docker container identifier of the Docker container where the Docker process is located.
[0075] Among them, each Docker container corresponds to a Docker container identifier, the target Docker container identifier is used to indicate the Docker container identifier of the Docker container where the process generating the abnormal signal is located, and the host identifier is used to indicate that the process generating the abnormal signal is a host process.
[0076] For example, the Docker container identifier and the host machine identifier can be a string, a specific data matrix, or a specific text (for example, the Docker container identifier can be container 1, container 2, container 3; the host machine identifier can be a host machine). The specific forms of the Docker container identifier and the host machine identifier can be set according to actual conditions, and the embodiments of the present application do not impose specific restrictions on this.
[0077] S102: According to the abnormal signal, determine the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host machine.
[0078] In this step, after the host machine hangs up the exception signal, the configuration parameters corresponding to the process running abnormally can be determined from the configuration parameters of different Docker containers and the configuration parameters of the host machine according to the target Docker container identifier or the host machine identifier in the exception signal.
[0079] Among them, the host machine can set configuration parameters for each Docker container in advance, and can also set configuration parameters for the host machine in advance. The specific steps of setting the configuration parameters will be explained in detail in Example 4 and will not be repeated here.
[0080] In a specific implementation of this embodiment, when the target Docker container identifier is included in the abnormal signal, the host machine determines the target configuration parameters corresponding to the target Docker container identifier from the configuration parameters of different Docker containers and the configuration parameters of the host machine based on the mapping relationship between the Docker container identifier and the configuration parameters.
[0081] In another specific implementation of this embodiment, when the abnormal signal includes a host machine identifier, the host machine determines the configuration parameter corresponding to the host machine identifier as the target configuration parameter.
[0082] The target configuration parameters include the storage location of the target exception file, which is generated when the process runs abnormally, and includes running status information. The running status information can be the memory, thread, stack, and related information of the host machine of the process, so that developers can compare the running status information in the target exception file with the normal running status information of the process under normal conditions, thereby determining the bug that causes the process to run abnormally and repairing it.
[0083] Optionally, the target exception file can be a core file.
[0084] The storage location of the abnormal file included in the configuration parameters of different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine.
[0085] Optionally, the storage location of the target abnormal file may be a namespace corresponding to the target Docker container identifier.
[0086] S103: placing the target abnormal file in the target storage location.
[0087] In this step, after determining the target configuration parameters, the host machine may place the target abnormal file in the target storage location in the target configuration parameters.
[0088] Optionally, the host machine may store the running status information when the process runs abnormally into a target exception file before S103, thereby moving the target exception file to the target storage location; the host machine may also store the running status information when the process runs abnormally into the target exception file in the target storage location after obtaining the target storage location, and place the target exception file in the target storage location.
[0089] The data processing method provided by the embodiment of the present application generates an abnormal signal and suspends when any process runs abnormally. According to the abnormal signal, the target configuration parameters corresponding to the process are determined from the configuration parameters of different Docker containers and the configuration parameters of the host machine, and the target abnormal file is placed in the target storage location. Since the storage location of the abnormal file included in the configuration parameters of different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine, the Docker container or host machine that generates the target abnormal file can be determined by the storage location of the target abnormal file, which effectively improves the matching accuracy of the target abnormal file and the Docker container and the target abnormal file and the host machine. Further, the storage location of the target abnormal file can be the namespace corresponding to the target Docker container identifier, which is conducive to developers using the Docker view to view the namespace where the target abnormal file is stored, thereby determining the Docker container where the abnormal process is located, and repairing the process according to the target abnormal file.
[0090] Figure 3 The flowchart of the second embodiment of the data processing method provided by the present invention is as follows: Figure 3 As shown, based on the above embodiment, the target configuration parameters also include a naming rule for the target exception file, and S101 can be implemented by the following steps:
[0091] S201. Name the target abnormal file according to a naming rule of the target abnormal file.
[0092] In this step, in order to more clearly identify the process running abnormally, the target abnormal file may be named according to the naming rule.
[0093] Exemplarily, the naming rule of the target abnormal file may be process ID-process group ID, process ID-process name, process name-process group ID, etc.
[0094] S202: placing the named target abnormal file in a target storage location.
[0095] The data processing method provided in the embodiment of the present application can further accurately determine the process in which the abnormality occurs by naming the target abnormal file according to the naming rule of the target abnormal file and placing the named target abnormal file in the target storage location, thereby helping developers to quickly locate the Docker container or host machine corresponding to the process.
[0096] Figure 4 The flowchart of the third embodiment of the data processing method provided by the present invention is as follows: Figure 4 As shown, based on any of the above embodiments, the data processing method further includes:
[0097] S301. When the process returns from kernel state to user state, detect whether there is a hanging signal for the process.
[0098] In this step, since the process will return from kernel state to user state when it runs abnormally, in order to handle the abnormal process in time, the host machine can detect whether there is a hanging signal for any process when it returns from kernel state to user state.
[0099] S302: If the process has a suspended signal, determine whether the signal is an abnormal signal.
[0100] The data processing method provided in the embodiment of the present application detects whether there is a hanging signal for the process when the process returns from the kernel state to the user state. If the process has a hanging signal, it determines whether the signal is an abnormal signal, thereby effectively improving the timeliness of processing the process with abnormal operation.
[0101] Figure 5 Schematic diagram of the flow chart of the fourth embodiment of the data processing method provided by the present invention, as shown in FIG. Figure 5 As shown, based on any of the above embodiments, before S101, the data processing method further includes:
[0102] S401. After starting the Docker container, set configuration parameters for the Docker container.
[0103] In this step, configuration parameters can be set for each Docker container so that target abnormal files can be processed later according to the target configuration parameters.
[0104] Among them, after starting the Docker container, you can use core_pattern to set the configuration parameters of the started Docker container. After the setting is completed, start the next Docker container until each Docker container is set.
[0105] Optionally, the save path of the abnormal file corresponding to the started Docker container can be set through core_pattern, so that the storage location is determined according to the save path.
[0106] Exemplarily, the naming rule of the abnormal file corresponding to the started Docker container can also be set through core_pattern. The naming rule of the target abnormal file can be process ID-process group ID, process ID-process name, process name-process group ID, etc., which can be set according to actual needs. The embodiment of the present application does not impose a distance limit on this.
[0107] S402: Store the configuration parameters of the Docker container in the data segment of the Docker container.
[0108] The data processing method provided in the embodiment of the present application sets configuration parameters for the Docker container after starting the Docker container, and stores the configuration parameters of the Docker container in the data segment of the Docker container, thereby laying a foundation for storing the target abnormal file according to the target storage location in the target configuration parameters when any process operation exception occurs.
[0109] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0110] Figure 6 This is a schematic diagram of the structure of the data processing device provided in the embodiment of the present application. Figure 6 As shown, the data processing device includes:
[0111] A generating module 51 is used to generate an abnormal signal and suspend when any process runs abnormally, wherein the abnormal signal includes a target Docker container identifier or a host identifier, and the host runs a Docker container;
[0112] A determination module 52 is used to determine, according to the abnormal signal, target configuration parameters corresponding to the process from configuration parameters of different Docker containers and configuration parameters of the host machine, wherein the target configuration parameters include a storage location of a target abnormal file, the target abnormal file is generated when an abnormality occurs during the operation of the process, and the target abnormal file includes operation status information, and the storage location of the abnormal file included in the configuration parameters of different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine;
[0113] The processing module 53 is used to place the target abnormal file in the target storage location.
[0114] Further, in the determination module 52, the abnormal signal includes the target Docker container identifier, which is specifically used to:
[0115] According to the mapping relationship between the Docker container identifier and the configuration parameters, the target configuration parameters corresponding to the target Docker container identifier are determined from the configuration parameters of different processes.
[0116] Further, in the determination module 52, the abnormal signal includes a host machine identifier, which is specifically used for:
[0117] The configuration parameters corresponding to the host identifier are determined as target configuration parameters.
[0118] Based on any of the foregoing embodiments, optionally, before placing the target abnormal file in the target storage location, the processing module 53 is further configured to:
[0119] The running status information when the process runs abnormally is stored in the target exception file.
[0120] Furthermore, the processing module 53 is also used for:
[0121] When the process returns from kernel state to user state, detect whether there is a hanging signal for the process;
[0122] If the process has a pending signal, determine whether the signal is an abnormal signal.
[0123] Based on any of the foregoing embodiments, optionally, the target configuration parameters further include a naming rule for the target exception file, and the processing module 53 is specifically used to:
[0124] Name the target exception file according to the naming rule of the target exception file;
[0125] Place the named target exception file in the target storage location.
[0126] Based on any of the foregoing embodiments, optionally, when any process runs abnormally, before an abnormal signal is generated and the process is suspended, the processing module 53 is further configured to:
[0127] After starting the Docker container, set configuration parameters for the Docker container;
[0128] Store the configuration parameters of the Docker container in the data segment of the Docker container.
[0129] Optionally, the storage location of the target abnormal file is a namespace corresponding to the target Docker container identifier.
[0130] The data processing device provided in the embodiments of the present application can be used to execute the data processing method in any of the above embodiments. The implementation principle and technical effects are similar and will not be repeated here.
[0131] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0132] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7 As shown, the electronic device may include: a processor 61, a memory 62, and computer program instructions stored in the memory 62 and executable on the processor 61. When the processor 61 executes the computer program instructions, the data processing method provided in any of the aforementioned embodiments is implemented.
[0133] Optionally, the electronic device may further include an interface for interacting with other devices.
[0134] Optionally, the above-mentioned components of the electronic device may be connected via a system bus.
[0135] The memory 62 may be a separate storage unit or a storage unit integrated in the processor. The number of processors may be one or more.
[0136] It should be understood that the processor 61 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the present application can be directly embodied as being executed by a hardware processor, or can be executed by a combination of hardware and software modules in the processor.
[0137] The system bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0138] All or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0139] The electronic device provided in the embodiment of the present application can be used to execute the data processing method provided in any of the above method embodiments. Its implementation principles and technical effects are similar and will not be repeated here.
[0140] An embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the above-mentioned data processing method.
[0141] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0142] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0143] An embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When the at least one processor executes the computer program, the above-mentioned data processing method can be implemented.
[0144] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data processing method, characterized in that: Applied to a host machine, wherein a plurality of processes are running in the host machine, the method comprises: When any process runs abnormally, an abnormal signal is generated and suspended, wherein the abnormal signal includes the target Docker container identifier or the host identifier, and the host runs a Docker container; According to the abnormal signal, determine the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host machine, the target configuration parameters include the storage location of a target abnormal file, the target abnormal file is generated when an abnormality occurs during the operation of the process, the target abnormal file includes operation status information, and the storage location of the abnormal file included in the configuration parameters of the different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine; Placing the target abnormal file in a target storage location, where the storage location of the target abnormal file is a namespace corresponding to the target Docker container identifier; The abnormal signal includes the target Docker container identifier and / or the host identifier, and determining the target configuration parameters corresponding to the process from the configuration parameters of different Docker containers and the configuration parameters of the host according to the abnormal signal includes: According to the mapping relationship between the Docker container identifier and the configuration parameters, determining the target configuration parameters corresponding to the target Docker container identifier from the configuration parameters of different processes; and / or, The configuration parameter corresponding to the host machine identifier is determined as the target configuration parameter.
2. The method according to claim 1, characterized in that Before placing the target abnormal file in the target storage location, the method further includes: The running status information when the process runs abnormally is stored in the target abnormality file.
3. The method according to claim 1, characterized in that: The method further comprises: When the process returns from the kernel state to the user state, detecting whether there is a hanging signal for the process; If the process has a suspended signal, it is determined whether the signal is the abnormal signal.
4. The method according to claim 2, characterized in that: The target configuration parameter also includes a naming rule for the target abnormal file, and placing the target abnormal file in the target storage location includes: Naming the target abnormal file according to the naming rule of the target abnormal file; The named target abnormal file is placed in the target storage location.
5. The method according to claim 1, characterized in that When any process runs abnormally, before generating an abnormal signal and suspending, the method further includes: After starting the Docker container, setting configuration parameters for the Docker container; The configuration parameters of the Docker container are stored in the data segment of the Docker container.
6. A data processing device, characterized in that: Applied to a host machine, wherein a plurality of processes are running in the host machine, the device comprises: A generation module, used for generating an abnormal signal and suspending when any process runs abnormally, wherein the abnormal signal includes a target Docker container identifier or a host identifier, and the host runs a Docker container; a determination module, configured to determine, according to the abnormal signal, target configuration parameters corresponding to the process from configuration parameters of different Docker containers and configuration parameters of the host machine, wherein the target configuration parameters include a storage location of a target abnormal file, the target abnormal file is generated when an abnormality occurs during the operation of the process, the target abnormal file includes operation status information, and the storage location of the abnormal file included in the configuration parameters of the different Docker containers is different from the storage location of the abnormal file included in the configuration parameters of the host machine; A processing module, used for placing the target abnormal file in a target storage location, where the storage location of the target abnormal file is a namespace corresponding to the target Docker container identifier; The abnormal signal includes the target Docker container identifier and / or the host identifier, and the determination module is specifically used to: According to the mapping relationship between the Docker container identifier and the configuration parameters, determining the target configuration parameters corresponding to the target Docker container identifier from the configuration parameters of different processes; and / or, The configuration parameter corresponding to the host machine identifier is determined as the target configuration parameter.
7. An electronic device comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor is used to implement the data processing method according to any one of claims 1 to 5 when executing the computer program instructions.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the data processing method according to any one of claims 1 to 5 when executed by a processor.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, it is used to implement the data processing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Process monitoring method and system in virtualization environment
CN103365758A
Process fault processing method and device based on container technology
CN104915263A
Monitoring, analyzing and processing method of core dump problem in progresses
CN107357731A
Method and a system for recording process exception information in a container
CN109614290A
Information collection system, terminal equipment and remote host
CN110505177A
