CN109086119A - A kind of method of quick detection container operating status - Google Patents
A kind of method of quick detection container operating status Download PDFInfo
- Publication number
- CN109086119A CN109086119A CN201810851961.1A CN201810851961A CN109086119A CN 109086119 A CN109086119 A CN 109086119A CN 201810851961 A CN201810851961 A CN 201810851961A CN 109086119 A CN109086119 A CN 109086119A
- Authority
- CN
- China
- Prior art keywords
- container
- host
- port
- csport
- lfp
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 24
- 238000000034 method Methods 0.000 claims description 69
- 235000010384 tocopherol Nutrition 0.000 claims description 7
- 235000019731 tricalcium phosphate Nutrition 0.000 claims description 7
- 230000000875 corresponding Effects 0.000 claims description 3
- 238000011112 process operation Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000004883 computer application Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
Abstract
The present invention provides a kind of methods of quick detection container operating status, including the container on collector, configuration sharing library, host and the host.A kind of method of quick detection container operating status by judging whether the particular port of some host receives request, and has the specific character string that a length very little whether is returned when response, to judge whether a container is currently running.Since this port response mode bears very little, collector can be quickly obtained the status information of a large amount of containers, and system also can meet the demand of monitoring system with all container states in the shorter a large amount of hosts of interval timing acquiring.A kind of method of quick detection container operating status can be quickly obtained different hosts machine upper container operating status, can satisfy fast, the low in resources consumption demand of acquisition speed, be particularly suitable for obtaining each container state in distributed system on a large amount of hosts.
Description
Technical field
The present invention relates to quick detection container operating statuses a kind of under computer application field more particularly to linux system
Method.
Background technique
In linux system, container (Container) can provide the virtualization of lightweight, so as to isolated process and resource.
By that will service or application program is encapsulated into container, (SuSE) Linux OS can allow application program just as in independent machine
It is run on device the same.Current container technology has obtained wide application.But in a distributed system, numerous container fortune
How row judges that the operating status of each container becomes a kind of basic on different hosts (for physical machine or virtual machine)
Demand.The typical scheme of current container technology is serviced using Docker.Docker, which is provided, checks container operating status
Method, such as docker ps order show that current host upper container is operation or exits.But when there are many container, certain
When a collector needs to inquire each container state, at this moment needs to be logged on on the host with ssh mode first, then look into
The operating status of the container is ask, state outcome is finally being sent to collector by network.This mode efficiency is very low, and
A kind of process in very cost source.When host and more container number, collection process can load higher, and acquisition interval must be drawn
Length is.Another method is one finger daemon of operation on every host.It is ordered by the finger daemon by docker
Order or API, periodically inquire each container operating status of this host, then by network this host upper container state
It is sent to collector.Although this method efficiency increases, need to develop finger daemon, and finger daemon still needs
Container state is obtained using docker order or efficiency is not high enough.
Summary of the invention
The invention solves the above technical problems, provide a kind of method of quick detection container operating status.
In order to solve the above technical problems, the technical solution adopted by the present invention is that: a kind of quick detection container operating status
Method, including the container on collector, configuration sharing library, host and the host, the collector, the configuration sharing
By group of switches at physical network, the collector is used to be quickly obtained the operating status of the container for library, the host;
The host is the physical machine or virtual machine for carrying the container operation;The configuration sharing library is can be described
The database of host and collector access, the specific detection method is as follows:
(1) include a specific monitoring process when making the container mirror image of the container, and refer in starting script
The fixed monitoring process is foreground process, referred to as LFP foreground process;The LFP foreground process only listens to an agreement
The port TCP/IP, referred to as CSPort container state port, CSPort container state port are the containers that user specifies
Interior fixed port, the container do not have to CSPort container state port and provide practical specific business service;
(2) network request of any access CSPort container state port, the LFP foreground process all return to one
The response character string of agreement, referred to as REPSTR;
(3) using the active service process in the container as the subprocess of the LFP foreground process, with background process
Form operation, referred to as SBP background process;
(4) the LFP foreground process timing detects whether the SBP background process is currently running, if the backstage the SBP
Process exception exits, then restarts the SBP background process;If the SBP background process can not start success,
The LFP foreground process, which is understood, itself to be terminated to run, and leads to the container closure and be in exit state;
(5) the container mirror image based on the step (1) to the step (4) creation, uses on the host
When the container mirror image creates some specific container instance, it is described for being randomly assigned an idle port on the host
CSPort container state port in the container is passed through the host by the mapped port of CSPort container state port
On the idle port be exposed to the external world, exposed outside port is known as the port Pub_CSPort, i.e., outside access
The request of the CSPort container state port of the container is converted to the end Pub_CSPort for accessing the host
Mouthful;
(6) after some described container instance is completed in creation on the host, the host net where the container
Network address HostIP, Container Name and the port Pub_CSPort externally exposed are sent to the configuration sharing library, go forward side by side
Row saves;When the corresponding host deletes the container, the configuration sharing library is notified to delete the record;
(7) collector, which passes through, traverses all records in configuration sharing library, the host network that every is recorded
The location port HostIP:Pub_CSPort issues TCP/IP access request, and the collector is according to access request as a result, carrying out such as
Lower judgement:
A. if the result that request obtains is agreement REPSTR character string, illustrate the institute of container described in target in record
It states LFP foreground process to be currently running, shows that the container is in normal operating condition;
B. if request has obtained response result, but it is not due up REPSTR character string, shows the end Pub_CSPort
Mouth is seized by other processes on the host, and the container is in and exits state;
C. if request to obtain is the error message that can not be accessed, show that the LFP foreground process exits, at this time target
The container is in the state of exiting.
The mode that the configuration sharing library is kept records of is unlimited, can use traditional database, can also use NoSQL number
It include the host network address HostIP, the Container Name and the port Pub_CSPort in every record according to library.
The advantages and positive effects of the present invention are: a kind of method of quick detection container operating status, passes through judgement
Whether the particular port of some host receives request, and has the specific character that a length very little whether is returned when response
String, to judge whether a container is currently running.Since this port response mode bears very little, collector can be quickly obtained
The status information of a large amount of containers, system also can be full with all container states in the shorter a large amount of hosts of interval timing acquiring
The foot demand of monitoring system.A kind of method of quick detection container operating status can be quickly obtained different hosts machine upper container fortune
Row state can satisfy fast, the low in resources consumption demand of acquisition speed, be particularly suitable for obtaining a large amount of hosts in distributed system
On each container state.
Detailed description of the invention
Fig. 1 is a kind of structural schematic diagram of quick detection container operating status;
Fig. 2 is a kind of method flow diagram of quick detection container operating status.
Specific embodiment
Specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
As shown in Figs. 1-2, a kind of method of quick detection container operating status, including collector, configuration sharing library, host
Container on machine and the host.The collector, the configuration sharing library, the host are by group of switches at physics
Network, the collector are used to be quickly obtained the operating status of the container;The host is for carrying the container fortune
Capable physical machine or virtual machine;The configuration sharing library is the data that can be accessed by the host and the collector
Library, the specific detection method is as follows:
(1) include a specific monitoring process when making the container mirror image of the container, and refer in starting script
The fixed monitoring process is foreground process, referred to as LFP foreground process;The LFP foreground process only listens to an agreement
The port TCP/IP, referred to as CSPort container state port, CSPort container state port are the containers that user specifies
Interior fixed port, the container do not have to CSPort container state port and provide practical specific business service;
(2) network request of any access CSPort container state port, the LFP foreground process all return to one
The response character string of agreement, referred to as REPSTR;
(3) using the service processes in the container as the subprocess of the LFP foreground process, in the form of background process
Operation, referred to as SBP background process;
(4) the LFP foreground process timing detects whether the SBP background process is currently running, if the backstage the SBP
Process exception exits, then restarts the SBP background process;If the SBP background process can not start success,
The LFP foreground process terminates, and leads to the container closure and be in exit state;
(5) the container mirror image based on the step (1) to the step (4) creation, uses on the host
When the container mirror image creates some container instance, it is described for being randomly assigned an idle port on the host
CSPort container state port in the container is passed through the host by the mapped port of CSPort container state port
On the idle port be exposed to the external world, exposed outside port is known as the port Pub_CSPort, i.e., outside access
The request of the CSPort container state port of the container is converted to the end Pub_CSPort for accessing the host
Mouthful;
(6) after some described container instance is completed in creation on the host, the host net where the container
Network address HostIP, Container Name and the port Pub_CSPort externally exposed are sent to the configuration sharing library, go forward side by side
Row saves;When the corresponding host deletes the container, the configuration sharing library is notified to delete the record;
(7) collector, which passes through, traverses all records in configuration sharing library, the host network that every is recorded
The location port HostIP:Pub_CSPort issues TCP/IP access request, and the collector is according to access request as a result, carrying out such as
Lower judgement:
A. if the result that request obtains is agreement REPSTR character string, illustrate the institute of container described in target in record
It states LFP foreground process to be currently running, shows that the container is in normal operating condition;
B. if request has obtained response result, but it is not due up REPSTR character string, shows the end Pub_CSPort
Mouth is seized by other processes on the host, and the container is in and exits state;
C. if request to obtain is the error message that can not be accessed, show that the LFP foreground process exits, at this time target
The container is in the state of exiting.
The mode that the configuration sharing library is kept records of is unlimited, can use traditional database, can also use NoSQL number
It include the host network address HostIP, the Container Name and the port Pub_CSPort in every record according to library.
A kind of preferred forms of the method for quick detection container operating status, including collector, configuration sharing library, place
Container on host and host.Detection method is as follows:
1. collector, configuration sharing library, host are by group of switches at physical network;
2. make some container mirror image, start and specify a specific LFP foreground process in script, which listens to end
Mouth 50000, which is CSPort container state port;
3. any network access request to the port, LFP foreground process returns to " Container OK " character string, as
REPSTR response character string;
4.LFP foreground process starts the SBP background process of practical offer business service in the form of subprocess;
5.LFP foreground process timing detection SBP background process whether there is, for example detection in every 10 seconds is primary.If it find that
The process is not present, then restarting SBP background process.If repeatedly no start successfully, for example starts 10 times in one minute and do not have
There is success, then LFP foreground process itself terminates to run, then container is out of service;
6. creating some container instance using the mirror image on host based on the container mirror image of step 2-5 creation.When creation
Being randomly assigned an idle port on host using container technique, the port Pub_CSPort, is CSPort container state port
Mapped port.Container Docker technology itself provides the function of mapped port.Such as the operational order that docker is provided are as follows:
docker run–d–name container_name–p Pub_CSPort:CSPort container_image
7. container instance creation after the completion of, host own net address HostIP, Container Name and externally exposure
The port Pub_CSPort is sent to configuration sharing library, and is saved.When host deletes the container, notice configuration sharing library is deleted
Except the record;
8. configuration sharing library uses the key assignments storage system of High Availabitity, such as etcd software to provide service;
9. collector passes through the traversal all records in configuration sharing library.The address HostIP:Pub_CSPort that every is recorded
Issue TCP/IP access request.Collector is according to access request as a result, making the following judgment:
A. if the result that request obtains is " Container OK ", container normal operation;
B. if request has obtained as a result, still not " Container OK ", container is in and exits state;
C. if request does not succeed, return is denied access, then container is in and exits state;
A kind of method of quick detection container operating status, by judging whether the particular port of some host receives to ask
It asks, and has the specific character string for whether returning to a length very little when response, to judge whether a container is currently running.By
Very little is born in this port response mode, collector can be quickly obtained the status information of a large amount of containers, and system also can be with
All container states in the shorter a large amount of hosts of interval timing acquiring, meet the demand of monitoring system.A kind of quickly detection
The method of container operating status can be quickly obtained different hosts machine upper container operating status, can satisfy that acquisition speed is fast, resource
Low demand is consumed, is particularly suitable for obtaining each container state in distributed system on a large amount of hosts.
The embodiments of the present invention have been described in detail above, but content is only the preferred embodiment of the present invention,
It should not be considered as limiting the scope of the invention.All changes and improvements made in accordance with the scope of the present invention, should all
It still belongs within this patent covering scope.
Claims (2)
1. a kind of method of quick detection container operating status, it is characterised in that: including collector, configuration sharing library, host
With the container on the host, the collector, the configuration sharing library, the host are by group of switches at Physical Network
Network, the collector are used to be quickly obtained the operating status of the container;The host is for carrying the container operation
Physical machine or virtual machine;The configuration sharing library is the database that can be accessed by the host and the collector,
The specific detection method is as follows:
(1) include a specific monitoring process when making the container mirror image of the container, and specify institute in starting script
Stating monitoring process is foreground process, referred to as LFP foreground process;The LFP foreground process is the TCP/IP for listening to an agreement
Port, referred to as CSPort container state port, CSPort container state port are fixed in the container that user specifies
Port, the container do not have to CSPort container state port and provide practical specific business service;
(2) network request of any access CSPort container state port, the LFP foreground process all return to an agreement
Response character string, referred to as REPSTR;
(3) using the active service process in the container as the subprocess of the LFP foreground process, in the form of background process
Operation, referred to as SBP background process;
(4) the LFP foreground process timing detects whether the SBP background process is currently running, if the SBP background process
Exception exits, then restarts the SBP background process;It is described if the SBP background process can not start success
LFP foreground process, which is understood, itself to be terminated to run, and leads to the container closure and be in exit state;
(5) the container mirror image based on the step (1) to the step (4) creation, using described on the host
When container mirror image creates some specific container instance, it is described for being randomly assigned an idle port on the host
CSPort container state port in the container is passed through the host by the mapped port of CSPort container state port
On the idle port be exposed to the external world, exposed outside port is known as the port Pub_CSPort, i.e., outside access
The request of the CSPort container state port of the container is converted to the end Pub_CSPort for accessing the host
Mouthful;
(6) after some described container instance is completed in creation on the host, the host network where the container
Location HostIP, Container Name and the port Pub_CSPort externally exposed are sent to the configuration sharing library, and are protected
It deposits;When the corresponding host deletes the container, the configuration sharing library is notified to delete the record;
(7) collector is by traversing all records in configuration sharing library, to the host network address of every record
The port HostIP:Pub_CSPort issues TCP/IP access request, and the collector is according to access request as a result, carrying out as follows
Judgement:
A. if the obtained result of request is agreement REPSTR character string, illustrate the described of container described in target in record
LFP foreground process is currently running, and shows that the container is in normal operating condition;
B. if request has obtained response result, but it is not due up REPSTR character string, shows the port Pub_CSPort quilt
Other processes are seized on the host, and the container is in and exits state;
C. if request to obtain is the error message that can not be accessed, show that the LFP foreground process exits, at this time described in target
Container is in the state of exiting.
2. a kind of method of quick detection container operating status according to claim 1, it is characterised in that: described share is matched
It is unlimited to set the mode that library is kept records of, traditional database can be used, NoSQL database can also be used, wrapped in every record
Containing the host network address HostIP, the Container Name and the port Pub_CSPort.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810851961.1A CN109086119A (en) | 2018-07-30 | 2018-07-30 | A kind of method of quick detection container operating status |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810851961.1A CN109086119A (en) | 2018-07-30 | 2018-07-30 | A kind of method of quick detection container operating status |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109086119A true CN109086119A (en) | 2018-12-25 |
Family
ID=64833418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810851961.1A Pending CN109086119A (en) | 2018-07-30 | 2018-07-30 | A kind of method of quick detection container operating status |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109086119A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110413436A (en) * | 2019-07-18 | 2019-11-05 | 腾讯科技(深圳)有限公司 | A kind of fault handling method and device |
CN110806922A (en) * | 2019-10-14 | 2020-02-18 | 广州微算互联信息技术有限公司 | Script execution method, device, equipment and storage medium |
CN113296872A (en) * | 2020-04-13 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Container state query method, device, equipment, storage medium and system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103220161A (en) * | 2012-01-18 | 2013-07-24 | 深圳市腾讯计算机系统有限公司 | Method and device for detecting server status |
CN104899126A (en) * | 2015-06-12 | 2015-09-09 | 北京奇虎科技有限公司 | Method, device and system for performing local real-time monitoring on containers in host |
CN104950757A (en) * | 2015-06-12 | 2015-09-30 | 北京奇虎科技有限公司 | Container monitoring method and system |
CN106020930A (en) * | 2016-05-13 | 2016-10-12 | 深圳市中润四方信息技术有限公司 | Application container based application management method and system |
US20160342786A1 (en) * | 2015-05-18 | 2016-11-24 | Amir Gerebe | Method and apparatus for applying application context security controls for software containers |
CN106341438A (en) * | 2015-07-10 | 2017-01-18 | 阿里巴巴集团控股有限公司 | Request processing method and device |
CN107294785A (en) * | 2017-07-11 | 2017-10-24 | 上海帝联信息科技股份有限公司 | The automatic deployment method and device, computer-readable recording medium of CDN node service |
CN107423112A (en) * | 2017-06-28 | 2017-12-01 | 郑州云海信息技术有限公司 | A kind of Docker container states real-time synchronization method |
-
2018
- 2018-07-30 CN CN201810851961.1A patent/CN109086119A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103220161A (en) * | 2012-01-18 | 2013-07-24 | 深圳市腾讯计算机系统有限公司 | Method and device for detecting server status |
US20160342786A1 (en) * | 2015-05-18 | 2016-11-24 | Amir Gerebe | Method and apparatus for applying application context security controls for software containers |
CN104899126A (en) * | 2015-06-12 | 2015-09-09 | 北京奇虎科技有限公司 | Method, device and system for performing local real-time monitoring on containers in host |
CN104950757A (en) * | 2015-06-12 | 2015-09-30 | 北京奇虎科技有限公司 | Container monitoring method and system |
CN106341438A (en) * | 2015-07-10 | 2017-01-18 | 阿里巴巴集团控股有限公司 | Request processing method and device |
CN106020930A (en) * | 2016-05-13 | 2016-10-12 | 深圳市中润四方信息技术有限公司 | Application container based application management method and system |
CN107423112A (en) * | 2017-06-28 | 2017-12-01 | 郑州云海信息技术有限公司 | A kind of Docker container states real-time synchronization method |
CN107294785A (en) * | 2017-07-11 | 2017-10-24 | 上海帝联信息科技股份有限公司 | The automatic deployment method and device, computer-readable recording medium of CDN node service |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110413436A (en) * | 2019-07-18 | 2019-11-05 | 腾讯科技(深圳)有限公司 | A kind of fault handling method and device |
CN110413436B (en) * | 2019-07-18 | 2021-11-23 | 腾讯科技(深圳)有限公司 | Fault processing method and device |
CN110806922A (en) * | 2019-10-14 | 2020-02-18 | 广州微算互联信息技术有限公司 | Script execution method, device, equipment and storage medium |
CN110806922B (en) * | 2019-10-14 | 2022-06-21 | 广州微算互联信息技术有限公司 | Script execution method, device, equipment and storage medium |
CN113296872A (en) * | 2020-04-13 | 2021-08-24 | 阿里巴巴集团控股有限公司 | Container state query method, device, equipment, storage medium and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109086119A (en) | A kind of method of quick detection container operating status | |
US5483468A (en) | System and method for concurrent recording and displaying of system performance data | |
US5684945A (en) | System and method for maintaining performance data in a data processing system | |
US7840725B2 (en) | Capture of data in a computer network | |
CN108920153B (en) | Docker container dynamic scheduling method based on load prediction | |
CN107885576A (en) | A kind of virtual machine HA method in private clound based on OpenStack | |
JPH06208472A (en) | Method for process control and system therefor | |
WO2017041649A1 (en) | Application deployment method and device | |
CN111338773A (en) | Distributed timed task scheduling method, scheduling system and server cluster | |
WO2022021856A1 (en) | Method and apparatus for online migration of multi-disk virtual machine into different storage pools | |
CN105681426B (en) | Heterogeneous system | |
CN108196940A (en) | Delete the method and relevant device of container | |
CN109558260A (en) | Kubernetes troubleshooting system, method, equipment and medium | |
CN107528871A (en) | Data analysis in storage system | |
US9727394B2 (en) | Establishing causality order of computer trace records | |
WO2021143590A1 (en) | Distributed container image construction scheduling system and method | |
CN109992352A (en) | Data transmission method, device, electronic equipment and read/write memory medium | |
CN106919338B (en) | A kind of Flash storage access processing method and system suitable for software definition storage | |
CN112199178A (en) | Cloud service dynamic scheduling method and system based on lightweight container | |
CN106550002A (en) | A kind of paas clouds mandatory system and method | |
CN109995617A (en) | Automated testing method, device, equipment and the storage medium of Host Administration characteristic | |
CN113746641B (en) | ODX protocol processing method based on distributed storage | |
Liu et al. | Design and Implementation of Computer Hardware Monitoring System Based on Cloud Computing | |
CN113973049B (en) | Method for managing and deploying bit stream of FPGA (field programmable Gate array) cluster | |
CN110198266B (en) | Real-time data stream processing method and system |
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 |