CN112243044B - Container address allocation method and device - Google Patents

Container address allocation method and device Download PDF

Info

Publication number
CN112243044B
CN112243044B CN201910639313.4A CN201910639313A CN112243044B CN 112243044 B CN112243044 B CN 112243044B CN 201910639313 A CN201910639313 A CN 201910639313A CN 112243044 B CN112243044 B CN 112243044B
Authority
CN
China
Prior art keywords
address
container
available
pool
allocated
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
Application number
CN201910639313.4A
Other languages
Chinese (zh)
Other versions
CN112243044A (en
Inventor
戴声
王兴刚
王华夏
毛茂德
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Huya Technology Co Ltd
Original Assignee
Guangzhou Huya Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangzhou Huya Technology Co Ltd filed Critical Guangzhou Huya Technology Co Ltd
Priority to CN201910639313.4A priority Critical patent/CN112243044B/en
Publication of CN112243044A publication Critical patent/CN112243044A/en
Application granted granted Critical
Publication of CN112243044B publication Critical patent/CN112243044B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5061Pools of addresses
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a container address allocation method and device, which are applied to data processing equipment, wherein the data processing equipment stores address pools corresponding to container group identifiers of different container groups in advance; the method comprises the following steps: receiving a container address allocation request sent by a container, wherein the container address allocation request comprises a container group identifier of a container group where the container is located; searching a target address pool corresponding to the container group identifier; and selecting an available address from the target address pool to be allocated to the container. Therefore, the addresses of the containers in the same container group are all from the same address pool, so that the addresses of the same container group are relatively fixed, and the address dependence configuration of the containers and the management and maintenance of the container addresses are convenient.

Description

Container address allocation method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for allocating a container address.
Background
The container (container) technology is a technology for packaging and deploying application programs and needed dependencies, class libraries, configuration files, other binary files and the like, and can enable the application programs to run smoothly when the running environments are switched.
After deployment, the container needs to be assigned an IP address to interact with other components. In some schemes, a scheme of dynamically allocating an IP address to a container is adopted, but when the container is created, upgraded and rebuilt, an action of applying the address is executed, and the adoption of a global dynamic IP address allocation mode can cause the change of the IP address of the container after each upgrade or rebuild. Resulting in components that rely heavily on the IP address of the container requiring the IP address to be reconfigured to interact with the container. In addition, because the time of applying for the address is different for each container, IP address areas among different types of containers are mutually alternated, so that the management is inconvenient, the use and maintenance complexity of the containers is improved, and the production efficiency is reduced.
Disclosure of Invention
In order to overcome at least one of the shortcomings in the prior art, one of the purposes of the present application is to provide a container address allocation method, which is applied to a data processing device, wherein the data processing device stores address pools corresponding to container group identifiers of different container groups in advance; the method comprises the following steps:
receiving a container address allocation request sent by a container, wherein the container address allocation request comprises a container group identifier of a container group where the container is located;
searching a target address pool corresponding to the container group identifier;
and selecting an available address from the target address pool to be allocated to the container.
Another object of the present invention is to provide a container address allocation device, which is applied to a data processing apparatus, wherein the data processing apparatus stores address pools corresponding to container group identifiers of different container groups in advance; the device comprises:
the request receiving module is used for receiving a container address allocation request sent by a container, wherein the container address allocation request comprises a container group identifier of a container group where the container is located;
the address pool query module is used for searching a target address pool corresponding to the container group identifier;
and the address allocation module is used for selecting an available address from the target address pool to be allocated to the container.
It is another object of the present application to provide a machine-readable storage medium storing machine-executable instructions that, when executed by one or more processors, perform the container address allocation method provided herein.
Compared with the prior art, the application has at least the following beneficial effects:
according to the container address allocation method and device, the container group identifier of the container group where the container is located is carried in the container address allocation request sent by the container, and the available address is selected for allocation in the corresponding address pool according to the container group identifier. Therefore, the addresses of the containers in the same container group are all from the same address pool, so that the addresses of the same container group are relatively fixed, and the address dependence configuration of the containers and the management and maintenance of the container addresses are convenient.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a data processing apparatus according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for assigning a container address according to an embodiment of the present disclosure;
FIG. 3 is a second flowchart of a method for assigning a container address according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a functional module of a container address allocation apparatus according to an embodiment of the present disclosure;
fig. 5 is a second schematic functional block diagram of a container address allocation apparatus according to an embodiment of the present application.
Icon: 100-a data processing device; 110-container address allocation means; 111-a request receiving module; 112-an address pool query module; 113-an address allocation module; 114-an address release module; 115-an address deletion module; 116-a capacity configuration module; 117-address pool allocation module; 120-a machine-readable storage medium; 130-processor.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of 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, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
Referring to fig. 1, fig. 1 is a schematic diagram of a data processing apparatus according to the present embodiment, where the data processing apparatus 100 includes a container address allocation device 110, a machine-readable storage medium 120, and a processor 130.
The machine-readable storage medium 120 and the processor 130 are directly or indirectly electrically connected to each other to enable transmission or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The container address assignment means 110 comprise at least one software functional module which may be stored in the machine readable storage medium 120 in the form of software or firmware (firmware) or cured in an Operating System (OS) of the data processing device 100. The processor 130 is configured to execute executable modules stored in the machine-readable storage medium 120, such as software functional modules and computer programs included in the container address assignment device 110.
The machine-readable storage medium 120 may be, but is not limited to, random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc. Wherein the machine-readable storage medium 120 is used to store a program, and the processor 130 executes the program after receiving the execution instruction.
Referring to fig. 2, fig. 2 is a schematic diagram of a method for assigning a container address according to the present embodiment, and each step of the method is explained in detail below.
Step S110, a container address allocation request sent by a container is received, wherein the container address allocation request comprises a container group identifier corresponding to a container group where the container is located.
In this embodiment, when creating a container, a container group identifier of a container group where the container is located may be added to a container parameter, where the container group may be a set of containers having similar functions or commonly implementing a certain function. The container group identification may be an identification capable of representing a unique identity of the container group throughout the operating environment, and the container group identification may be a combination of a plurality of letters and numbers.
In this embodiment, the data processing apparatus 100 may be configured with an address pool service program for performing address pool management, and the address pool service program may provide an address application interface for applying for a container address. The action of sending the container address allocation request when the container is created may be to call the address application interface, and transfer the container group identifier of the container into the container, thereby requesting the address pool service program to obtain the container address.
Taking a kubernetes container cluster management system as an example, the container group identifier can be configured in the animation Annotation information of the Pod unit, and when the container in the Pod unit is created, the container group identifier in the animation Annotation information is acquired and is transmitted to the address pool service program through the address application interface.
Step S120, searching a target address pool corresponding to the container group identifier.
In this embodiment, the data processing apparatus 100 may store address pools corresponding to different container group identifiers in advance. In step S120, the address pool service program searches the address pool corresponding to the container address allocation request as the target address pool according to the container group identifier in the container address allocation request.
And step S130, selecting an available address from the target address pool to be allocated to the container.
In this embodiment, the addresses in the address pool may have different identifications according to their allocation states. For example, when an address is a free address, the address may be identified as an available address. When an address is applied to by a container, but has not yet been formally used by the container, the address may be identified as a preempted address. But an address is applied to by the container and has been formally used by the container, the address may be identified as an assigned address.
The address pool service program may select an address identified as an available address from the target address pool to be allocated to the container sending the container address allocation request after querying the target address pool.
Based on the above design, in the solution provided in this embodiment, the addresses may be allocated to the containers in the corresponding address pools according to the container group identifier in the container address allocation request, so that the addresses allocated to the containers in the same container group are all from the same address pool, so that the addresses in the same container group are relatively fixed, and the address dependent configuration of the containers and the management and maintenance of the container addresses are facilitated.
Optionally, in step S110 of this embodiment, the container address allocation request may further include a unique identifier of the container, where the unique identifier may be an identifier capable of identifying a unique identity of the container in its container group or in the entire deployment environment, such as a universal unique identifier (Universally Unique Identifier, UUID) of the container.
In an example, referring to fig. 3, before step S130, the method for assigning a container address according to the present embodiment may further include step S210.
Step S210, querying whether there is an allocated address corresponding to the unique identifier in the target address pool.
In this embodiment, the address pool may also record a correspondence between an allocated address and a unique identifier of a container that obtains the allocated address. After determining the target address pool, the address pool service program may query the target address pool for the existence of an allocated address corresponding to the unique identifier, i.e., for whether an address has been allocated for the container.
If the assigned address corresponding to the unique identifier is found, step S220 is performed.
If no assigned address corresponding to the unique identifier is found, step S130 is executed, and step S140 is executed after step S130 is executed.
Step S220, allocating the queried allocated address to the container.
In this embodiment, if it is queried that the assigned address corresponding to the unique identifier indicates that the address is assigned to the container in step S210, the container applies for the address again, possibly for reasons such as upgrade or rebuilding, and the same address as used needs to be assigned to the container, the address pool service program assigns the queried assigned address to the container.
If in step S210 no assigned address corresponding to the unique identifier is found, indicating that no address has been assigned to the container, and that the container may be a newly created container, and a new address needs to be assigned to the container, the address pool service program executes step S130 to select an available address from the target address pool to be assigned to the container.
After step S130, step S140 is performed to identify the available address as an allocated address, and the correspondence between the allocated address and the unique identifier of the container is recorded. Thus, if the container is later reapplied for addresses for reasons such as upgrade or rebuild, the used addresses can be allocated to the container according to the unique identifier of the container.
In another example, before step S120, the address pool service program may also directly search for whether there is an allocated address corresponding to the unique identifier in all allocated addresses according to the unique identifier in the container address allocation request.
Alternatively, in this embodiment, the container may send a container address release request to the address pool service program when deleted, the container address release request including an allocated address allocated to the container.
For example, the address pool service program may also provide an address release interface that may be invoked by a container when deleted to pass the address of the container to inform the address pool service program to release the address assigned to the container.
After the address pool service program receives the container address release request, the assigned address can be identified as an available address, and the release time of the available address can be recorded.
In step S130, when the address pool service program selects an available address from the target address pool to be allocated to a container, the address pool service program selects an available address with the latest release time from the available addresses in the target address pool to be allocated to the container.
In other words, in this embodiment, the later the released available addresses are allocated to other containers for use according to the release time of each available address. Therefore, the address Chi Zhongpin frequently changes the address corresponding to the container and keeps the address within a certain range, and the management and maintenance of the container address are convenient.
Alternatively, in the present embodiment, an available address is allocated to the address pool, and the release time of the allocated available address is configured to be 0. For example, when creating an address pool or when the address pool is expanding, the release time of the available address allocated for the address pool is first configured to be 0. Since the addresses of new release time 0 are always assigned to the containers the latest, such that the priority with which these newly assigned addresses of the address pool are assigned to the containers is lowest.
Alternatively, in this embodiment, the address pool service program may periodically detect a release time of each available address in the address pool, and calculate an unused time length of each available address.
If the available addresses reaching the first preset duration threshold when not in use are detected, the total address quantity of the address pool is larger than the address quantity required by the container group corresponding to the address pool, and the address pool service program deletes the available addresses from the address pool.
Optionally, in this embodiment, the data processing apparatus 100 further records the application time of the addresses in each address pool, that is, the time of assigning the available addresses to the address pools.
The address pool service program may detect, according to the application time, an unallocated duration of the available address having a release timestamp of 0.
If the available addresses with unassigned time length reaching the second preset time length threshold are detected, the total address amount of the address pool is larger than the number of addresses required by the container group corresponding to the address pool, and the address pool service program deletes the available addresses from the address pool.
Optionally, in this embodiment, the address pool service program may receive an address pool capacity configuration instruction, and record a target address capacity of the address pool configuration carried in the address pool configuration instruction. For example, the address pool service program may also provide an address capacity configuration interface, by invoking which the target address capacity of each address pool may be configured.
The address pool service program may periodically detect a release time of each available address in the address pool and calculate an unused time period for each available address. If the available addresses reaching the first preset duration threshold value when not in use are detected, and the total number of the addresses in the address pool is larger than the target address capacity of the address pool, indicating that the address pool needs to be contracted, the address pool service program deletes the available addresses from the address pool.
Alternatively, the address pool service program may periodically detect, according to the application time, an unallocated duration of the available address having a release timestamp of 0. If the total number of addresses in the address pool is greater than the target address capacity of the address pool and if the total number of addresses in the address pool is greater than the target address capacity of the address pool, deleting the available address from the address pool.
Therefore, addresses which are not used for a long time in the address pool can be cleaned, so that the long-term occupancy rate of invalid addresses in the pool is reduced, and the overall availability of the addresses is improved.
Optionally, in this embodiment, when the address pool service program allocates an address to the container, the address pool service program may sort the addresses in the target address pool from front to back in the order of the allocated address, the pre-occupied address, the available address with a later release time, and the available address with an earlier release time, and then check whether there is an available address in the address with the earlier sorting in the current target address capacity range of the target address pool.
If so, the available address with the first rank is selected for allocation to the container.
If the address is not present, that is, the address in the current target address capacity range of the target address pool is the allocated address or the pre-occupied address, the capacity of the target address pool is full, and the address can not be continuously allocated, a notification of no available address is returned to the container.
Optionally, in this embodiment, the address pool service program may further provide management interfaces for adding, querying, etc. an address pool, and configuring the address pool managed by the address pool service program through these management interfaces.
Referring to fig. 4, the present embodiment further provides a container address allocation device 110 applied to the data processing apparatus 100 shown in fig. 1, where the data processing apparatus 100 stores address pools corresponding to container group identifiers of different container groups in advance; the container address allocation apparatus 110 may include a request receiving module 111, an address pool query module 112, and an address allocation module 113.
The request receiving module 111 is configured to receive a container address allocation request sent by a container, where the container address allocation request includes a container group identifier of a container group where the container is located.
In this embodiment, the request receiving module 111 may be used to perform step S110 shown in fig. 1, and a specific description of the request receiving module 111 may refer to a description of the step S110.
An address pool query module 112, configured to find a target address pool corresponding to the container group identifier.
In this embodiment, the address pool query module 112 may be configured to execute step S120 shown in fig. 1, and a specific description of the address pool query module 112 may refer to a description of step S120.
An address allocation module 113, configured to select an available address from the target address pool to allocate to the container.
In this embodiment, the address allocation module 113 may be used to perform step S130 shown in fig. 1, and a specific description of the address allocation module 113 may refer to a description of step S130.
Optionally, in this embodiment, the container address allocation request further includes a unique identifier of the container.
The address allocation module 113 is specifically configured to: inquiring whether an allocated address corresponding to the unique identifier exists in the target address pool; if the allocated address corresponding to the unique identifier is inquired, the inquired allocated address is allocated to the container; if the allocated address corresponding to the unique identifier is not queried, selecting an available address from the target address pool to be allocated to the container, identifying the available address as the allocated address, and recording the corresponding relation between the allocated address and the unique identifier of the container.
Optionally, in this embodiment, the request receiving module is further configured to receive a container address release request sent by a container, where the container address release request includes an allocated address allocated to the container.
Referring to fig. 5, the data processing apparatus 100 may further include an address release module 114.
The address release module 114 is configured to identify the allocated address as an available address and record a release time of the available address.
The address allocation module 113 is specifically configured to select, from available addresses in the target address pool, an available address with a latest release time to be allocated to the container.
Optionally, in one example, the data processing apparatus 100 may further include an address deletion module 115.
The address deletion module 115 is configured to detect a release time of each available address in the address pool, and calculate an unused time length of each available address; and if the available address reaching the first preset duration threshold value when not in use is detected, deleting the available address from the address pool.
Optionally, in another example, the data processing apparatus 100 may further include a capacity configuration module 116 and an address deletion module 115.
The capacity configuration module 116 is configured to receive an address pool capacity configuration instruction, and record a target address capacity of the address pool configuration carried in the address pool configuration instruction.
The address deletion module 115 is configured to detect a release time of each available address in the address pool, and calculate an unused time length of each available address; and if the available addresses reaching the first preset duration threshold value when not in use are detected, and the total number of the addresses in the address pool is larger than the target address capacity of the address pool, deleting the available addresses from the address pool.
Optionally, in this embodiment, the data processing apparatus 100 may further include an address pool allocation module 117.
The address pool allocation module 117 is configured to allocate an available address to the address pool, and configure a release time of the allocated available address to 0.
Optionally, in one example, the data processing apparatus 100 further records the application time of the address in each address pool. The data processing device 100 may further comprise an address deletion module 115.
The address deletion module 115 is configured to detect, according to the application time, an unallocated duration of an available address with a release timestamp of 0; and if the unallocated time length is detected to reach the available address of the second preset time length threshold value, deleting the available address from the address pool.
Optionally, in another example, the data processing apparatus 100 further records the application time of the address in each address pool. The data processing device 100 may further comprise a capacity configuration module 116 and an address deletion module 115.
The capacity configuration module 116 is configured to receive an address pool capacity configuration instruction, and record a target address capacity of the address pool configuration carried in the address pool configuration instruction.
The address deletion module 115 is configured to periodically detect, according to the application time, an unallocated duration of the available address with a release timestamp of 0; if the total number of addresses in the address pool is greater than the target address capacity of the address pool and if the total number of addresses in the address pool is greater than the target address capacity of the address pool, deleting the available address from the address pool.
In summary, in the method and the device for allocating a container address provided in the present application, a container group identifier of a container group where a container is located is carried in a container address allocation request sent by the container, and an available address is selected for allocation in a corresponding address pool according to the container group identifier. Therefore, the addresses of the containers in the same container group are all from the same address pool, so that the addresses of the same container group are relatively fixed, and the address dependence configuration of the containers and the management and maintenance of the container addresses are convenient.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing is merely various embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered in the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. The container address allocation method is characterized by being applied to data processing equipment, wherein the data processing equipment stores address pools corresponding to container group identifiers of different container groups in advance; the method comprises the following steps:
receiving a container address allocation request sent by a container, wherein the container address allocation request comprises a container group identifier of a container group where the container is located;
searching a target address pool corresponding to the container group identifier;
selecting an available address from the target address pool to be allocated to the container; wherein the container address allocation request further includes a unique identification of the container; before selecting an available address from the pool of target addresses for allocation to the container, the method further comprises:
inquiring whether an allocated address corresponding to the unique identifier exists in the target address pool;
if the allocated address corresponding to the unique identifier is inquired, the inquired allocated address is allocated to the container;
if the allocated address corresponding to the unique identifier is not queried, selecting an available address from the target address pool to be allocated to the container, identifying the available address as the allocated address, and recording the corresponding relation between the allocated address and the unique identifier of the container;
receiving a container address release request sent by a container, wherein the container address release request comprises an allocated address allocated to the container;
identifying the allocated address as an available address, and recording the release time of the available address;
the step of selecting an available address from the pool of target addresses for allocation to the container comprises:
and selecting an available address with the latest release time from the available addresses in the target address pool to be allocated to the container.
2. The method according to claim 1, wherein the method further comprises:
detecting the release time of each available address in the address pool, and calculating the unused time length of each available address;
and if the available address reaching the first preset duration threshold value when not in use is detected, deleting the available address from the address pool.
3. The method according to claim 1, wherein the method further comprises:
receiving an address pool capacity configuration instruction, and recording the target address capacity of the address pool configuration carried in the address pool configuration instruction;
detecting the release time of each available address in the address pool, and calculating the unused time length of each available address;
and if the available addresses reaching the first preset duration threshold value when not in use are detected, and the total number of the addresses in the address pool is larger than the target address capacity of the address pool, deleting the available addresses from the address pool.
4. The method according to claim 1, wherein the method further comprises:
an available address is allocated to the address pool, and a release time of the allocated available address is configured to be 0.
5. The method of claim 4, wherein the data processing device further records the application time of the addresses in each address pool; the method further comprises the steps of:
detecting unassigned time length of the available address with the release time stamp of 0 according to the application time;
and if the unallocated time length is detected to reach the available address of the second preset time length threshold value, deleting the available address from the address pool.
6. The method of claim 4, wherein the data processing device further records the application time of the addresses in each address pool; the method further comprises the steps of:
receiving an address pool capacity configuration instruction, and recording the target address capacity of the address pool configuration carried in the address pool configuration instruction;
according to the application time, periodically detecting unassigned time length of the available address with the release time stamp of 0;
if the total number of addresses in the address pool is greater than the target address capacity of the address pool and if the total number of addresses in the address pool is greater than the target address capacity of the address pool, deleting the available address from the address pool.
7. The container address allocation device is characterized by being applied to data processing equipment, wherein the data processing equipment stores address pools corresponding to container group identifiers of different container groups in advance; the device comprises:
the request receiving module is used for receiving a container address allocation request sent by a container, wherein the container address allocation request comprises a container group identifier of a container group where the container is located;
the address pool query module is used for searching a target address pool corresponding to the container group identifier;
an address allocation module, configured to select an available address from the target address pool to allocate to the container; wherein the container address allocation request further includes a unique identification of the container;
the address allocation module is specifically configured to: inquiring whether an allocated address corresponding to the unique identifier exists in the target address pool; if the allocated address corresponding to the unique identifier is inquired, the inquired allocated address is allocated to the container; if the allocated address corresponding to the unique identifier is not queried, selecting an available address from the target address pool to be allocated to the container, identifying the available address as the allocated address, and recording the corresponding relation between the allocated address and the unique identifier of the container;
the request receiving module is further configured to receive a container address release request sent by a container, where the container address release request includes an allocated address allocated to the container;
the apparatus further comprises:
the address release module is used for marking the allocated address as an available address and recording the release time of the available address;
the address allocation module is specifically configured to select, from available addresses in the target address pool, an available address with a latest release time to allocate to the container.
8. The apparatus of claim 7, wherein the apparatus further comprises:
the address deleting module is used for detecting the release time of each available address in the address pool and calculating the unused time length of each available address; and if the available address reaching the first preset duration threshold value when not in use is detected, deleting the available address from the address pool.
9. The apparatus of claim 8, wherein the apparatus further comprises:
and the address pool allocation module is used for allocating available addresses to the address pool and configuring the release time of the allocated available addresses to be 0.
10. The apparatus of claim 7, wherein the data processing device further records the application time of the addresses in each address pool; the apparatus further comprises:
the address deleting module is used for detecting unassigned duration of the available address with the release time stamp of 0 according to the application time; and if the unallocated time length is detected to reach the available address of the second preset time length threshold value, deleting the available address from the address pool.
11. A machine-readable storage medium storing machine-executable instructions which, when executed by one or more processors, perform the method of any of claims 1-6.
CN201910639313.4A 2019-07-16 2019-07-16 Container address allocation method and device Active CN112243044B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910639313.4A CN112243044B (en) 2019-07-16 2019-07-16 Container address allocation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910639313.4A CN112243044B (en) 2019-07-16 2019-07-16 Container address allocation method and device

Publications (2)

Publication Number Publication Date
CN112243044A CN112243044A (en) 2021-01-19
CN112243044B true CN112243044B (en) 2023-05-19

Family

ID=74166514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910639313.4A Active CN112243044B (en) 2019-07-16 2019-07-16 Container address allocation method and device

Country Status (1)

Country Link
CN (1) CN112243044B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113766043B (en) * 2021-05-11 2024-02-23 腾讯科技(深圳)有限公司 Method, device, computer equipment and storage medium for configuring target container
CN113626054A (en) * 2021-08-16 2021-11-09 聚好看科技股份有限公司 Business service updating method and device
CN114070822B (en) * 2021-11-17 2022-10-14 江苏博云科技股份有限公司 Kubernetes Overlay IP address management method
CN114500464B (en) * 2021-12-13 2023-12-12 天翼物联科技有限公司 Container static IP distribution method, system, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102238239A (en) * 2010-04-21 2011-11-09 电信科学技术研究院 IP address allocation method and device
CN107566541A (en) * 2017-08-03 2018-01-09 携程旅游信息技术(上海)有限公司 Capacitor network resource allocation methods, system, storage medium and electronic equipment
CN107580083A (en) * 2017-09-20 2018-01-12 北京京东尚科信息技术有限公司 A kind of method and system of container IP address distribution
CN108833163A (en) * 2018-06-13 2018-11-16 平安科技(深圳)有限公司 Creation method, device, computer equipment and the storage medium of Linux virtual server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7623547B2 (en) * 2004-12-13 2009-11-24 Bt Ins, Inc. Internet protocol address management system and method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102238239A (en) * 2010-04-21 2011-11-09 电信科学技术研究院 IP address allocation method and device
CN107566541A (en) * 2017-08-03 2018-01-09 携程旅游信息技术(上海)有限公司 Capacitor network resource allocation methods, system, storage medium and electronic equipment
CN107580083A (en) * 2017-09-20 2018-01-12 北京京东尚科信息技术有限公司 A kind of method and system of container IP address distribution
CN108833163A (en) * 2018-06-13 2018-11-16 平安科技(深圳)有限公司 Creation method, device, computer equipment and the storage medium of Linux virtual server

Also Published As

Publication number Publication date
CN112243044A (en) 2021-01-19

Similar Documents

Publication Publication Date Title
CN112243044B (en) Container address allocation method and device
CN107229555B (en) Identification generation method and device
CN108717379B (en) Electronic device, distributed task scheduling method and storage medium
CN107844274B (en) Hardware resource management method, device and terminal based on super-fusion storage system
CN107590033B (en) Method, device and system for creating DOCKER container
US10909029B2 (en) Managing memory in a computer system
KR102100323B1 (en) Method and server for the service of machine learning platform
US10282120B2 (en) Method, apparatus and system for inserting disk
CN113037794B (en) Method, device and system for computing resource allocation scheduling
CN107656695B (en) Data storage and deletion method and device and distributed storage system
JP2005108216A (en) Method and apparatus for dynamic memory management within an object-oriented program
CN108616424B (en) Resource scheduling method, computer equipment and system
CN106383668B (en) Information storage method, storage management equipment and client
CN115242752B (en) Address allocation method, device, equipment and medium of battery management system
CN110457114B (en) Application cluster deployment method and device
CN108008913B (en) Management node-based capacity expansion method and device and storage system
CN114745358A (en) IP address management method, system and controller in load balancing service
CN112269661A (en) Partition migration method and device based on Kafka cluster
CN109005071B (en) Decision deployment method and scheduling equipment
CN110968406B (en) Method, device, storage medium and processor for processing task
CN104618414A (en) Implementation method of distributed service, service agent device and distributed system
US20180018129A1 (en) Storage monitoring system and monitoring method therefor
CN112948501B (en) Data analysis method, device and system
CN111600771B (en) Network resource detection system and method
CN111491040B (en) IP distribution method and IP distribution device

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