CN112398929A - Container-based number issuing method and number issuing device - Google Patents

Container-based number issuing method and number issuing device Download PDF

Info

Publication number
CN112398929A
CN112398929A CN202011215421.8A CN202011215421A CN112398929A CN 112398929 A CN112398929 A CN 112398929A CN 202011215421 A CN202011215421 A CN 202011215421A CN 112398929 A CN112398929 A CN 112398929A
Authority
CN
China
Prior art keywords
container
events
unique
microservice
unique identification
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.)
Granted
Application number
CN202011215421.8A
Other languages
Chinese (zh)
Other versions
CN112398929B (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.)
Beijing Jinher Software Co Ltd
Original Assignee
Beijing Jinher Software 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 Beijing Jinher Software Co Ltd filed Critical Beijing Jinher Software Co Ltd
Priority to CN202011215421.8A priority Critical patent/CN112398929B/en
Publication of CN112398929A publication Critical patent/CN112398929A/en
Application granted granted Critical
Publication of CN112398929B publication Critical patent/CN112398929B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Abstract

The invention relates to a number sending method and a number sender based on a container, which comprise the steps of pre-configuring a container event in a micro-service; wherein the container events include container initiation events and container destruction events; the server of the microservice acquires the unique identification number after receiving the number sending request; and feeding back the unique identification number to a calling party. The technical scheme provided by the invention is to subscribe and process the life cycle event of the container, and obtain the random number which is not repeated in the server time and the time interval so as to ensure that the identification number generated by each container is unique and not repeated in the group of containers.

Description

Container-based number issuing method and number issuing device
Technical Field
The invention belongs to the technical field of electric power markets, and particularly relates to a container-based number issuing method and a number issuer.
Background
In a container-based microservice architecture system, a microservice is typically serviced by a set of containers at the backend to ensure high availability and uninterrupted service to the system. Each container in a group of containers is independent (the containers do not know the existence of the containers except the containers themselves), unique identification numbers are simultaneously and concurrently generated in a plurality of containers, and how to ensure that the identification numbers generated by the containers are unique and not repeated in the group of containers, the scene needs a container-based number sender.
Disclosure of Invention
In view of the above, the present invention provides a method and a device for issuing a number based on containers, so as to solve the problem that the identification number generated by each container cannot be guaranteed to be unique and non-repetitive in the group of containers in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme: a container-based numbering process comprising:
pre-configuring a container event in the micro-service; wherein the container events include container initiation events and container destruction events;
the server of the microservice acquires the unique identification number after receiving the number sending request;
and feeding back the unique identification number to a calling party.
Further, a deployment template is set in the micro-service, and the pre-configuring of the container event in the micro-service includes:
deploying the container initiation event and the container destruction event in the deployment template;
the name of the current container is passed inside the microservice.
Further, the unique identification number includes:
a timestamp of the server, a unique identification of the current container, and a random number.
Further, the random number is a unique random number.
Determining the random number as a unique random number, comprising:
determining the number of unique identification numbers generated by a single container in a time interval;
determining that the random number is uniquely used in the same time interval;
at the next time interval, the used random number is cleared.
Further, the unique identifier has a life cycle, so that the unique identifier can be recycled;
the unique identifier has a life cycle comprising:
configuring and storing a unique identifier in the container starting event;
deleting the unique identifier in the container destruction event.
Further, the name of the current container is passed to the inside of the microservice by using the environment variable.
Further, the environment variable includes at least one attribute information, and the attribute information includes:
address information, key information, and rights information.
Further, the unique identifier of the current container is obtained by the container name transmitted by the environment variable.
The embodiment of the application provides a ware of sending a number based on container, includes:
the embodiment of the application provides a ware of sending a number based on container, includes:
a configuration module for pre-configuring container events in the microservice; wherein the container events include container initiation events and container destruction events;
the acquisition module is used for acquiring the unique identification number after the server of the microservice receives the number sending request;
and the feedback module is used for feeding back the unique identification number to the calling party.
The embodiment of the application provides computer equipment, which comprises a processor and a memory connected with the processor;
the memory is used for storing a computer program used for the container-based numbering method provided by any one of the above embodiments;
the processor is used for calling and executing the computer program in the memory.
By adopting the technical scheme, the invention can achieve the following beneficial effects:
the invention provides a container-based number sending method and a number sender, which comprise the steps of pre-configuring a container event in a microservice; wherein the container events include container initiation events and container destruction events; the server of the microservice acquires the unique identification number after receiving the number sending request; and feeding back the unique identification number to a calling party. The technical scheme provided by the invention is to subscribe and process the life cycle event of the container, and obtain the random number which is not repeated in the server time and the time interval so as to ensure that the identification number generated by each container is unique and not repeated in the group of containers.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic representation of the steps of the container-based numbering process of the present invention;
fig. 2 is a schematic structural view of the container-based number sender of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be described in detail below. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the examples given herein without any inventive step, are within the scope of the present invention.
A specific container-based numbering method and apparatus provided in embodiments of the present application will now be described with reference to the accompanying drawings.
As shown in fig. 1, the container-based numbering method provided in the embodiment of the present application includes:
s101, pre-configuring a container event in the micro-service; wherein the container events include container initiation events and container destruction events;
first, in the technical solution provided by the present application, independent container event handlers (including a container start event handler and a container destroy event handler) are developed. And a deployment container event processing program, wherein the container starting and destroying event processing program is configured in a deployment template of the micro service needing to use the sender. In a microservice that requires the use of the initiator, the name of the current container is passed in (can be passed using environment variables) to the inside of the service.
S102, after receiving a number sending request, the server of the microservice acquires a unique identification number;
after deployment, a server in the micro-service acquires a unique identification number after receiving a number sending request; the unique identification number is an identification number that is guaranteed to be unique and non-repeatable in each container.
And S103, feeding back the unique identification number to the calling party.
After the unique identification number is obtained, the unique identification number is fed back to the calling party
In some embodiments, the microservice is provided with a deployment template, and the provisioning of container events in the microservice comprises:
deploying the container initiation event and the container destruction event in the deployment template;
the name of the current container is passed inside the microservice.
Specifically, independent container event handlers (including a container start event handler and a container destroy event handler) are developed; a deployment container event handler; configuring a starting and destroying event processing program of the container in a deployment template of the micro-service needing to use the sender; in a microservice that requires the use of the initiator, the name of the current container is passed in (can be passed using environment variables) to the inside of the service.
Preferably, the unique identification number includes:
a timestamp of the server, a unique identification of the current container, and a random number.
The random number is a unique random number.
Determining the random number as a unique random number, comprising:
determining the number of unique identification numbers generated by a single container in a time interval;
determining that the random number is uniquely used in the same time interval;
at the next time interval, the used random number is cleared.
In some embodiments, the unique identifier has a life cycle such that the unique identifier is recycled;
the unique identifier has a life cycle comprising:
configuring and storing a unique identifier in the container starting event;
deleting the unique identifier in the container destruction event.
Specifically, the current timestamp of the server is acquired, the unique identifier of the current container is acquired, a non-repeating random number is acquired, and then the three items of information are combined into a unique identifier. The unique identification of the container identifies the container lifecycle events that need to be subscribed to; the specific process is as follows: developing a container life cycle processing program; subscribing a container starting event and a container destroying event of the container in the configuration of the container, and distributing and storing a unique Id for the container in the starting event; when the unique container identifier is required to be used, the stored unique container identifier is taken out; the unique identifier assigned to the container is deleted in the container destruction event so that the container unique identifier can be recycled. Specifically, it is determined how many unique identification numbers are generated by a single container at most in a time interval, so that the range of random numbers is determined, and the used random numbers cannot be reused in the same time interval; and when the next time interval arrives, clearing the random numbers used in the previous time interval. For example, the time interval is 2 to 3 points, the next time interval may be 3 to 4 points, or 4 to 5 points, and the random numbers may be repeated between the time interval of 2 to 3 points and the time interval of 3 to 4 points, but the random numbers in the time interval of 2 to 3 points are not repeated, and both are unique.
Preferably, the name of the current container is passed inside the microservice using the environment variables.
Preferably, the environment variable includes at least one attribute information, and the attribute information includes:
address information, key information, and rights information.
Preferably, the unique identifier of the current container is obtained by a container name transmitted by the environment variable.
It is understood that the environment variable in the application includes various attribute information, which may include address information and key information, and the key information may be multiple, and is used for data keys used in different program data interaction processes. The attribute information of the environment variable may further include other attribute information, and the present application may further include other attribute information, which is not limited herein.
The working principle of the container-based number issuing method provided by the application is as follows: in the micro-service needing to use the sender, the name of the current container is transmitted (can be transmitted by using an environment variable) to the interior of the service; and receiving a number sending request, acquiring a current timestamp of the server, acquiring a unique identifier of a current container (acquired by a container name transmitted by an environment variable), acquiring a non-repeated random number, combining the three items of information into a unique identifier and returning the unique identifier to the calling party.
The present application provides a container-based number sender, as shown in fig. 2, including:
a configuration module 201 for pre-configuring a container event in the micro-service; wherein the container events include container initiation events and container destruction events;
an obtaining module 202, configured to obtain, by the microservice server, the unique identification number after receiving the number sending request;
and the feedback module 203 is used for feeding back the unique identification number to the calling party.
The working principle of the container-based sender provided by the application is that the configuration module 201 pre-configures a container event in a micro-service; wherein the container events include container initiation events and container destruction events; the micro-service server of the obtaining module 202 obtains the unique identification number after receiving the number sending request; the feedback module 203 feeds the unique identification number back to the calling party.
The embodiment of the application provides computer equipment, which comprises a processor and a memory connected with the processor;
the memory is used for storing a computer program used for executing the container-based number sending method provided by any one of the above embodiments;
the processor is used to call and execute the computer program in the memory.
In summary, the present invention provides a container-based number issuing method and a number issuer, which includes pre-configuring a container event in a microservice; wherein the container events include container initiation events and container destruction events; the server of the microservice acquires the unique identification number after receiving the number sending request; and feeding back the unique identification number to a calling party. The technical scheme provided by the invention is to subscribe and process the life cycle event of the container, and obtain the random number which is not repeated in the server time and the time interval so as to ensure that the identification number generated by each container is unique and not repeated in the group of containers.
It is understood that the embodiments of the method provided above correspond to the embodiments of the signal sender described above, and the corresponding specific contents may be referred to each other, which is not described herein again.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A method for container-based signaling, comprising:
pre-configuring a container event in the micro-service; wherein the container events include container initiation events and container destruction events;
the server of the microservice acquires the unique identification number after receiving the number sending request;
and feeding back the unique identification number to a calling party.
2. The method of claim 1, wherein a deployment template is provided in the microservice, and wherein pre-configuring container events in the microservice comprises:
deploying the container initiation event and the container destruction event in the deployment template;
the name of the current container is passed inside the microservice.
3. The method of claim 2, wherein the unique identification number comprises:
a timestamp of the server, a unique identification of the current container, and a random number.
4. The method of claim 3, wherein the random number is a unique random number;
determining the random number as a unique random number, comprising:
determining the number of unique identification numbers generated by a single container in a time interval;
determining that the random number is uniquely used in the same time interval;
at the next time interval, the used random number is cleared.
5. The method of claim 3, wherein the unique identifier has a life cycle such that the unique identifier is recycled;
the unique identifier has a life cycle comprising:
configuring and storing a unique identifier in the container starting event;
deleting the unique identifier in the container destruction event.
6. The method of claim 3,
the name of the current container is passed inside the microservice using the environment variables.
7. The method of claim 6,
the environment variable includes at least one attribute information, the attribute information including:
address information, key information, and rights information.
8. The method of claim 6,
the unique identification of the current container is obtained by the container name transmitted by the environment variable.
9. A container-based issuer, comprising:
a configuration module for pre-configuring container events in the microservice; wherein the container events include container initiation events and container destruction events;
the acquisition module is used for acquiring the unique identification number after the server of the microservice receives the number sending request;
and the feedback module is used for feeding back the unique identification number to the calling party.
10. A computer device, comprising: a processor, and a memory coupled to the processor;
the memory for storing a computer program for performing the container-based numbering method of any of claims 1 to 8;
the processor is used for calling and executing the computer program in the memory.
CN202011215421.8A 2020-11-04 2020-11-04 Number issuing method based on container and number issuing device Active CN112398929B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011215421.8A CN112398929B (en) 2020-11-04 2020-11-04 Number issuing method based on container and number issuing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011215421.8A CN112398929B (en) 2020-11-04 2020-11-04 Number issuing method based on container and number issuing device

Publications (2)

Publication Number Publication Date
CN112398929A true CN112398929A (en) 2021-02-23
CN112398929B CN112398929B (en) 2023-12-05

Family

ID=74598706

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011215421.8A Active CN112398929B (en) 2020-11-04 2020-11-04 Number issuing method based on container and number issuing device

Country Status (1)

Country Link
CN (1) CN112398929B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102006003843A1 (en) * 2005-01-26 2006-11-30 Roman Koller Random event e.g. random number, creating method for e.g. gambling machine, involves effecting establishment of succession of arriving action signals with respect to event, and assigning signals are assigned as data to produce number
US8032491B1 (en) * 2005-04-22 2011-10-04 Symantec Operating Corporation Encapsulating information in a storage format suitable for backup and restore
CN105959138A (en) * 2016-04-29 2016-09-21 深圳前海大数点科技有限公司 Micro-service dynamic disposition system and method based on cloud calculation
CN106412035A (en) * 2016-09-14 2017-02-15 联动优势电子商务有限公司 Serial number generation method and terminal
US20180088935A1 (en) * 2016-09-27 2018-03-29 Ca, Inc. Microservices application configuration based on runtime environment
CN108804545A (en) * 2018-05-18 2018-11-13 深圳市彬讯科技有限公司 Distributed globally unique ID generation methods and equipment
CN109327555A (en) * 2018-08-09 2019-02-12 北京奇虎科技有限公司 Distributed hair system, method and device
CN110119336A (en) * 2019-04-04 2019-08-13 微民保险代理有限公司 Data processing method, device, computer readable storage medium and computer equipment
CN111367615A (en) * 2018-12-26 2020-07-03 卓望数码技术(深圳)有限公司 Method, apparatus, device and storage medium facilitating container instance scheduling

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102006003843A1 (en) * 2005-01-26 2006-11-30 Roman Koller Random event e.g. random number, creating method for e.g. gambling machine, involves effecting establishment of succession of arriving action signals with respect to event, and assigning signals are assigned as data to produce number
US8032491B1 (en) * 2005-04-22 2011-10-04 Symantec Operating Corporation Encapsulating information in a storage format suitable for backup and restore
CN105959138A (en) * 2016-04-29 2016-09-21 深圳前海大数点科技有限公司 Micro-service dynamic disposition system and method based on cloud calculation
CN106412035A (en) * 2016-09-14 2017-02-15 联动优势电子商务有限公司 Serial number generation method and terminal
US20180088935A1 (en) * 2016-09-27 2018-03-29 Ca, Inc. Microservices application configuration based on runtime environment
CN108804545A (en) * 2018-05-18 2018-11-13 深圳市彬讯科技有限公司 Distributed globally unique ID generation methods and equipment
CN109327555A (en) * 2018-08-09 2019-02-12 北京奇虎科技有限公司 Distributed hair system, method and device
CN111367615A (en) * 2018-12-26 2020-07-03 卓望数码技术(深圳)有限公司 Method, apparatus, device and storage medium facilitating container instance scheduling
CN110119336A (en) * 2019-04-04 2019-08-13 微民保险代理有限公司 Data processing method, device, computer readable storage medium and computer equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JAIME CORREIA: "Nonintrusive Monitoring of Microservice-Based Systems", 《IEEE》 *
谢伟: "《中国优秀硕士学位论文全文数据库》", 基于微服务架构的开放平台消息系统的设计与实现 *

Also Published As

Publication number Publication date
CN112398929B (en) 2023-12-05

Similar Documents

Publication Publication Date Title
CN100511156C (en) Apparatus for compulsively terminating thread blocked on input/output operation and method for the same
CN113220431B (en) Cross-cloud distributed data task scheduling method, device and storage medium
EP3489825A1 (en) Method, apparatus and computer readable storage medium for processing service
CN110611707B (en) Task scheduling method and device
CN107343018B (en) Application service arranging method and system of PaaS cloud platform
CN110830608B (en) Global unique identifier generation method, device, equipment and storage medium
CN101719079A (en) Method and device for processing tasks
EP3660665A1 (en) Business processing method, apparatus, device and system using the same, and readable storage medium of the same
CN109309712A (en) Data transmission method, server and the storage medium called based on interface asynchronous
CN104809816A (en) Express fetching processing method, express fetching executing method, express fetching method, device and system
CN110890987A (en) Method, device, equipment and system for automatically creating cluster
CN111881209A (en) Data synchronization method and device for heterogeneous database, electronic equipment and medium
CN111026794A (en) Data management method, device, equipment and medium based on data source
CN108520401B (en) User list management method, device, platform and storage medium
CN107844566B (en) Dump control method and system
CN112398929B (en) Number issuing method based on container and number issuing device
CN102902574A (en) Cooperative processing method and device of multiple information flow nodes
CN113220480B (en) Distributed data task cross-cloud scheduling system and method
CN112416980B (en) Data service processing method, device and equipment
CN112540839A (en) Information changing method, device, electronic equipment and storage medium
CN112613298A (en) Data verification method, system, computer program product and electronic equipment
CN103078860A (en) Digital media content distribution method and system
CN110674139B (en) Information processing method, system, resource management system and storage medium
CN112702270B (en) Node calling method, system and storage medium based on event distribution mechanism
CN108170407B (en) Method and device for acquiring target data

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