CN113419745A - Application instance number management method and device, electronic equipment and computer readable medium - Google Patents

Application instance number management method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN113419745A
CN113419745A CN202110705653.XA CN202110705653A CN113419745A CN 113419745 A CN113419745 A CN 113419745A CN 202110705653 A CN202110705653 A CN 202110705653A CN 113419745 A CN113419745 A CN 113419745A
Authority
CN
China
Prior art keywords
instance number
node machine
application
application instance
target
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
Application number
CN202110705653.XA
Other languages
Chinese (zh)
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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202110705653.XA priority Critical patent/CN113419745A/en
Publication of CN113419745A publication Critical patent/CN113419745A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses an application instance number management method and device, electronic equipment and a computer readable medium, and relates to the technical field of automatic program design. The application instance number management method comprises the following steps: establishing long connection with a node machine in the distributed cluster; responding to an application instance number acquisition request sent by the node machine through the long connection, and acquiring a target instance number from an instance pool; and sending the target instance number to the node machine, and deleting the target instance number from the instance pool. Through the steps, the automatic allocation of the application instance numbers can be realized, the situation that repeated instance numbers are generated is not needed to be worried about, the operation and maintenance cost is reduced, and the application deployment and implementation efficiency is improved.

Description

Application instance number management method and device, electronic equipment and computer readable medium
Technical Field
The invention relates to the technical field of automatic program design, in particular to an application instance number management method, an application instance number management device, electronic equipment and a computer readable medium.
Background
In an actual application scenario, there is a case that the system needs to set Value values of some configuration items (such as application instance numbers) in a configuration file to be unique, that is, the Value values of the configuration items are required to be different on each client, that is, implementation uniqueness is achieved.
In the prior art, when the serial numbers of the instances are configured, each client machine can only be logged in one by one to carry out manual configuration or script configuration. Considering that machines in a distributed cluster are numerous and environments are complex, the existing scheme brings a large amount of operations, increases operation and maintenance cost, and reduces application deployment efficiency. Moreover, when thousands of machines are faced, it is highly likely that the case numbers will be duplicated by manually configuring the case numbers, and it is highly likely that errors will occur in the program and transaction because it is not possible to confirm which machine has the problem.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for managing application instance numbers, an electronic device, and a computer readable medium, which can implement automatic allocation of application instance numbers without worrying about occurrence of repeated instance numbers, reduce operation and maintenance costs, and improve efficiency of application deployment and implementation.
To achieve the above object, according to a first aspect of the present invention, there is provided an application instance number management method.
The application example number management method is applied to a management server and comprises the following steps: establishing long connection with a node machine in the distributed cluster; responding to an application instance number acquisition request sent by the node machine through the long connection, and acquiring a target instance number from an instance pool; and sending the target instance number to the node machine, and deleting the target instance number from the instance pool.
Optionally, the instance pool includes a plurality of pages; the obtaining of the target instance number from the instance pool includes: determining the cluster identifier where the node machine is located according to the application instance number acquisition request; and acquiring an instance number from the paging corresponding to the cluster identifier, and taking the instance number as the target instance number.
Optionally, the determining, according to the application instance number obtaining request, the cluster identifier where the node machine is located includes: analyzing the cluster identifier of the node machine carried by the application instance number acquisition request from the application instance number acquisition request; or analyzing the node machine identifier carried by the application instance number acquisition request from the application instance number acquisition request, and inquiring the first database table according to the node machine identifier to acquire the cluster identifier where the node machine is located.
Optionally, the instance pool includes a plurality of pages; the obtaining of the target instance number from the instance pool includes: determining a module identifier to which an application instance of the node machine application belongs according to the application instance number acquisition request; and acquiring an instance number from the paging corresponding to the module identifier, and taking the instance number as the target instance number.
Optionally, the obtaining an instance number from a corresponding page includes: an instance number is randomly obtained from the corresponding page, or the smallest instance number is obtained from the corresponding page.
Optionally, the method further comprises: monitoring the state of the node machine; and under the condition that the node machine is monitored to be in an off-line state or the disconnection with the management server exceeds the preset time, recycling the instance number of the node machine.
Optionally, the method further comprises: and after the target instance number is pushed to the node machine, adding a corresponding relation between the target instance number and the identifier of the node machine in a second database table.
Optionally, the method further comprises: and responding to a submission request for the configuration information of the instance pool initiated by the user terminal, and storing the configuration information of the instance pool.
To achieve the above object, according to a second aspect of the present invention, there is provided an application instance number management method.
The application example number management method is applied to the node machines in the distributed cluster, and comprises the following steps: establishing a long connection with a management server; judging whether application instance number configuration information exists or not; if not, sending an application instance number acquisition request to the management server through the long connection; and after receiving the target instance number sent by the management server, generating a configuration file containing the target instance number.
Optionally, the determining whether the application instance number configuration information exists includes: querying a designated directory in the node machine; and if the configuration file of the application instance number does not exist in the specified directory or the configuration file is empty, determining that the configuration information of the application instance number does not exist.
Optionally, the application instance number obtaining request carries a node machine identifier and a cluster identifier where the node machine is located; or, the application instance number obtaining request carries the node machine identifier and the module identifier to which the applied application instance belongs.
To achieve the above object, according to a third aspect of the present invention, there is provided an application instance number management apparatus.
The application example number management device is arranged on a management server and comprises: the connection module is used for establishing long connection with the node machines in the distributed cluster; an obtaining module, configured to obtain a target instance number from an instance pool in response to an application instance number obtaining request sent by the node machine through the long connection; and the distribution module is used for sending the target instance number to the node machine and deleting the target instance number from the instance pool.
To achieve the above object, according to a fourth aspect of the present invention, there is provided an application instance number management apparatus.
The application example number management device of the invention is arranged on a node machine in a distributed cluster, and comprises: the connection module is used for establishing long connection with the management server; the application module is used for judging whether application instance number configuration information exists or not; if not, sending an application instance number acquisition request to the management server through the long connection; and the generating module is used for generating a configuration file containing the target instance number after receiving the target instance number sent by the management server.
To achieve the above object, according to a fifth aspect of the present invention, there is provided an electronic apparatus.
The electronic device of the present invention includes: one or more processors; and storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the application instance number management method of the present invention.
To achieve the above object, according to a sixth aspect of the present invention, there is provided a computer-readable medium.
The computer-readable medium of the present invention has stored thereon a computer program which, when executed by a processor, implements the application instance number management method of the present invention.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of establishing long connection with a node machine in a distributed cluster, responding to an application instance number acquisition request sent by the node machine through the long connection, acquiring a target instance number from an instance pool, sending the target instance number to the node machine, and deleting the target instance number from the instance pool, so that automatic allocation of the application instance number can be realized, the situation of repeated instance numbers does not need to be worried about, the operation and maintenance cost is reduced, and the application deployment and implementation efficiency is improved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
FIG. 2 is a schematic main flow chart of an application instance number management method according to a first embodiment of the present invention;
FIG. 3 is a schematic main flow chart of an application instance number management method according to a second embodiment of the present invention;
FIG. 4 is a schematic main flow chart of an application instance number management method according to a third embodiment of the present invention;
FIG. 5 is a schematic diagram of the main modules of an application instance number management apparatus according to a fourth embodiment of the present invention;
FIG. 6 is a schematic diagram of the main modules of an application instance number management apparatus according to a fifth embodiment of the present invention;
FIG. 7 is a block diagram of a computer system suitable for use with the electronic device to implement an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It should be noted that the embodiments and technical features of the embodiments of the present invention may be combined with each other without affecting the implementation of the present invention.
Fig. 1 illustrates an exemplary system architecture 100 of an application instance number management method or application instance number management apparatus to which embodiments of the present invention may be applied.
As shown in FIG. 1, the system architecture 100 may include node machines 101, 102, 103 in a distributed cluster, a network 104, and a management server 105. The network 104 serves to provide a medium of communication links between the node machines 101, 102, 103 and the management server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The node machines 101, 102, 103 may be various application servers. The node machines 101, 102, 103 interact with the management server 105 through the network 104 to receive or transmit messages or the like. The node machines 101, 102, 103 may have installed thereon various communication client applications, such as financial services-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, and the like.
The management server 105 may be a server that provides a management service for the node machine, for example, a management server that manages allocation, collection, and the like of application instance numbers in the node machines 101, 102, 103. For example, the background management server may process an application instance number acquisition request and the like sent by the node machine through the network, and allocate a target instance number to the node machine.
It should be noted that, the application instance number management method provided in some embodiments of the present invention is executed by the management server, and accordingly, the application implementation number management apparatus is disposed in the management server. The application instance number management method provided by the embodiment of the invention is executed by the node machine in the distributed cluster, and correspondingly, the application implementation number management device is arranged in the node machine.
It should be understood that the number of node machines, networks, and management servers in fig. 1 is merely illustrative. There may be any number of node machines, networks, and management servers, as desired for an implementation.
Fig. 2 is a schematic main flow diagram of an application instance number management method according to a first embodiment of the present invention. The method of the embodiment of the invention is executed by a management server. As shown in fig. 2, the application instance number management method according to the embodiment of the present invention includes:
step S201: long connections are established with node machines in the distributed cluster.
A long connection means that a plurality of packets can be continuously transmitted over one connection and then the connection is disconnected, and during the connection maintenance period, if no packet is transmitted, a link check packet needs to be transmitted by both sides. In this step, the management server and the node machines in the distributed cluster may establish a long connection through a three-way handshake.
In the embodiment of the invention, the long connection is established with the node machine, so that the subsequent operations of application, distribution and the like of the instance number can be directly performed through the long connection, and the resource overhead caused by frequent closing and connection establishment in the instance number management process is reduced.
Step S202: and responding to an application instance number acquisition request sent by the node machine through the long connection, and acquiring a target instance number from an instance pool.
In an alternative example, the instance pool adopts a page type storage method, specifically, the instance pool is divided into a plurality of pages, the pages are corresponding to the clusters, and application instance numbers in the same page are used for being distributed to node machines in the corresponding clusters. For example, page 1 corresponds to cluster a, the application instance number in page 1 is used to assign to the node machine in cluster a, page 2 corresponds to cluster B, and the application instance number in page 2 is used to assign to the node machine in cluster B. In this optional example, after receiving an application instance number acquisition request, the management server determines, according to the application instance number acquisition request, a cluster identifier where the node machine is located; and the management server acquires an instance number from the paging corresponding to the cluster identifier and takes the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: node machine identification and cluster identification where the node machine is located. In this optional embodiment, the determining, by the management server, the cluster identifier where the node machine is located according to the application instance number obtaining request includes: and the manager server analyzes the application example number acquisition request to analyze the cluster identifier of the node machine carried by the manager server.
In another optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: and identifying the node machine. In this optional embodiment, the determining, by the management server, the cluster identifier where the node machine is located according to the application instance number obtaining request includes: the management server analyzes the application instance number acquisition request to analyze the node machine identifier carried by the application instance number acquisition request, and queries the first database table according to the node machine identifier to acquire the cluster identifier of the node machine from the first database table. The first database table records cluster identification and other information of each node machine in the distributed cluster.
In the embodiment of the invention, the example pool adopts a page type storage mode, and pages are corresponding to the clusters, so that management such as distribution of application example numbers required by different clusters is facilitated, and the management effect of the application example numbers is improved.
In another alternative example, the instance pool is stored in a page manner, specifically, the instance pool is divided into a plurality of pages, the pages correspond to the modules to which the application instances belong, and application instance numbers in the same page are used for being distributed to node machines needing to deploy the application instances under the corresponding modules. For example, page 1 corresponds to module I, the application instance number in page 1 is used for the node machine that requires deployment of the application instance under module I, and page 2 corresponds to module II, the application instance number in page 2 is used for the node machine that requires deployment of the application instance under module II. In this optional example, after receiving an application instance number acquisition request, the management server determines, according to the application instance number acquisition request, a module identifier to which an application instance of the node machine application belongs; and the management server acquires an instance number from the paging corresponding to the module identifier and takes the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: a machine identification, and a module identification. In this optional implementation, the determining, by the management server according to the application instance number obtaining request, the module identifier to which the application instance of the node machine application belongs includes: and the management server analyzes the application instance number acquisition request to analyze the carried module identification of the application instance applied by the node machine.
Step S203: and sending the target instance number to the node machine, and deleting the target instance number from the instance pool.
After acquiring the target instance number from the instance pool in step S202, the management server sends configuration information such as the target instance number to the node machine through long connection, and deletes the target instance number from the instance pool. After receiving configuration information such as a target instance number, the node machine generates a configuration file containing the target instance number.
In the embodiment of the invention, the automatic allocation of the application instance numbers is realized through the steps, the situation that repeated instance numbers occur is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved.
Fig. 3 is a schematic main flow chart of an application instance number management method according to a second embodiment of the present invention. The method of the embodiment of the invention is executed by the node machines in the distributed cluster. As shown in fig. 3, the application instance number management method according to the embodiment of the present invention includes:
step S301: a long connection is established with the management server.
A long connection means that a plurality of packets can be continuously transmitted over one connection and then the connection is disconnected, and during the connection maintenance period, if no packet is transmitted, a link check packet needs to be transmitted by both sides. In this step, the node machines and the management server in the distributed cluster may establish a long connection through a three-way handshake.
Step S302: and judging whether the application instance number configuration information exists. If yes, ending the process; if not, go to step S303.
For example, the node machine may determine whether the application instance number configuration information exists according to the following manner: querying a designated directory in the node machine; if the configuration file of the application instance number does not exist in the specified directory or the configuration file is empty, determining that the configuration information of the application instance number does not exist; otherwise, determining that the application instance number configuration information exists.
In specific implementation, when it is determined that the node machine has the application instance number configuration information, the process may be ended, i.e., the next application instance number application step is not required to be executed. When it is determined that the node machine does not have the application instance number configuration information, steps S303 to S304 are performed next.
Step S303: and sending an application instance number acquisition request to the management server through the long connection.
In this step, the node server may send an application instance acquisition request to the management server over the previously established long connection.
In an optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a cluster in which the node machine is located. In this optional example, after receiving the application instance obtaining request, the management server parses the cluster identifier where the node machine is located from the application instance obtaining request, and then randomly obtains an application instance number from a page corresponding to the cluster identifier or obtains the smallest instance number in the current page, and takes the smallest instance number as the target instance number.
In another optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a module to which the application instance applied by the node machine belongs. In this optional embodiment, after receiving the application instance obtaining request, the management server parses the application instance number obtaining request to obtain a module identifier carried by the application instance obtaining request, and then randomly obtains an application instance number from a page corresponding to the module identifier or obtains a minimum instance number in the current page, and uses the minimum instance number as a target instance number.
Step S304: and after receiving the target instance number sent by the management server, generating a configuration file containing the target instance number.
In this step, the node server generates a configuration file containing the target instance number after receiving the target instance number. Deployment of the application instance can then proceed according to the configuration file and other desired configuration files.
In the embodiment of the invention, the automatic application and allocation of the application instance numbers are realized through the steps, the situation that repeated instance numbers occur is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved.
Fig. 4 is a schematic main flow chart of an application instance number management method according to a third embodiment of the present invention. The method of the embodiment of the invention is executed by the management server and the node machine in the distributed cluster together. As shown in fig. 4, the application instance number management method according to the embodiment of the present invention includes:
step S401: the node machine establishes a long connection with the management server.
A long connection means that a plurality of packets can be continuously transmitted over one connection and then the connection is disconnected, and during the connection maintenance period, if no packet is transmitted, a link check packet needs to be transmitted by both sides. In this step, the node machines and the management server in the distributed cluster may establish a long connection through a three-way handshake.
Step S402: the node machine determines whether application instance number configuration information exists. If yes, ending the process; if not, go to step S403.
For example, the node machine may determine whether the application instance number configuration information exists according to the following manner: the node machine inquires a specified directory in the node machine; if the configuration file of the application instance number does not exist in the specified directory or the configuration file is empty, determining that the configuration information of the application instance number does not exist; otherwise, determining that the application instance number configuration information exists.
In specific implementation, when it is determined that the node machine has the application instance number configuration information, the process may be ended, i.e., the next application instance number application step is not required to be executed. When it is determined that the node machine does not have the application instance number configuration information, step S403 is performed next.
Step S403: the node machine sends an application instance number acquisition request to the management server.
In this step, the node server may send an application instance acquisition request to the management server over the previously established long connection. In an optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a cluster in which the node machine is located. In another optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a module to which the application instance applied by the node machine belongs.
Step S404: the management server obtains a target instance number from the instance pool.
In an alternative example, the instance pool adopts a page type storage method, specifically, the instance pool is divided into a plurality of pages, the pages are corresponding to the clusters, and application instance numbers in the same page are used for being distributed to node machines in the corresponding clusters. For example, page 1 corresponds to cluster a, the application instance number in page 1 is used to assign to the node machine in cluster a, page 2 corresponds to cluster B, and the application instance number in page 2 is used to assign to the node machine in cluster B. In this optional example, after receiving an application instance number acquisition request, the management server determines, according to the application instance number acquisition request, a cluster identifier where the node machine is located; and the management server acquires an instance number from the paging corresponding to the cluster identifier and takes the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: node machine identification and cluster identification where the node machine is located. In this optional embodiment, the determining, by the management server, the cluster identifier where the node machine is located according to the application instance number obtaining request includes: and the manager server analyzes the application example number acquisition request to analyze the cluster identifier of the node machine carried by the manager server.
In another optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: and identifying the node machine. In this optional embodiment, the determining, by the management server, the cluster identifier where the node machine is located according to the application instance number obtaining request includes: the management server analyzes the application instance number acquisition request to analyze the node machine identifier carried by the application instance number acquisition request, and queries the first database table according to the node machine identifier to acquire the cluster identifier of the node machine from the first database table. The first database table records cluster identification and other information of each node machine in the distributed cluster.
In the embodiment of the invention, the example pool adopts a page type storage mode, and pages are corresponding to the clusters, so that management such as distribution of application example numbers required by different clusters is facilitated, and the management effect of the application example numbers is improved.
In another alternative example, the instance pool is stored in a page manner, specifically, the instance pool is divided into a plurality of pages, the pages correspond to the modules to which the application instances belong, and application instance numbers in the same page are used for being distributed to node machines needing to deploy the application instances under the corresponding modules. For example, page 1 corresponds to module I, the application instance number in page 1 is used for the node machine that requires deployment of the application instance under module I, and page 2 corresponds to module II, the application instance number in page 2 is used for the node machine that requires deployment of the application instance under module II. In this optional example, after receiving an application instance number acquisition request, the management server determines, according to the application instance number acquisition request, a module identifier to which an application instance of the node machine application belongs; and the management server acquires an instance number from the paging corresponding to the module identifier and takes the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: a machine identification, and a module identification. In this optional implementation, the determining, by the management server according to the application instance number obtaining request, the module identifier to which the application instance of the node machine application belongs includes: and the management server analyzes the application instance number acquisition request to analyze the carried module identification of the application instance applied by the node machine.
Step S405: and the management server sends the target instance number to the node machine and deletes the target instance number from the instance pool.
After acquiring the target instance number from the instance pool in step S404, the management server sends configuration information such as the target instance number to the node machine through the long connection, and deletes the target instance number from the instance pool.
Further, the method of the embodiment of the invention further comprises the following steps: and after the target instance number is pushed to the node machine, newly adding the corresponding relation between the target instance number and the identifier of the node machine in a second database table. In a specific implementation, the identifier of the node machine may be an IP address of the node machine or an encoding of the node machine.
Step S406: and after receiving the target instance number, the node machine generates a configuration file containing the target instance number.
In this step, the node server generates a configuration file containing the target instance number after receiving the target instance number. Deployment of the application instance can then proceed according to the configuration file and other desired configuration files.
Step S407: the management server monitors the state of the node machine.
Illustratively, the management server may monitor the status of the node machine by sending heartbeat packets to the node machine.
Step S408: and the management server carries out recovery processing on the instance number of the node machine under the condition that the node machine is monitored to be in an off-line state or the disconnection with the management server exceeds the preset time length.
When the node machine is monitored to be in an offline state or the disconnection between the node machine and the management server is monitored to exceed a preset time (such as half a year), recycling the application instance number of the node machine, which specifically comprises the following steps: and the application instance number of the node machine is put back into the instance pool, and the corresponding relation between the node machine and the application instance number in the second database table is deleted.
Further, the method of the embodiment of the invention further comprises the following steps: and responding to a submission request for the configuration information of the instance pool initiated by the user terminal, and storing the configuration information of the instance pool. In specific implementation, the instance number of the instance pool can be configured through the Web service page. For example, the number range of the corresponding instance of the configuration cluster A is 000-100; the example number range corresponding to the configuration cluster B is 200-300.
In the embodiment of the invention, the automatic application and allocation of the application instance numbers are realized through the steps, the situation that repeated instance numbers occur is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved. Furthermore, the instance pool adopts a page type storage management mode, and the pages correspond to the modules to which the applications belong, so that the problem that the machines are allocated to the wrong modules for application due to manual operation errors when the machines are initially configured and connected is greatly avoided. When the module does not need such multiple machines any more, the system can recycle the instance numbers of part of the machines, so that the safety and the stability of the recycling of the machines are ensured; in addition, by maintaining the corresponding relation between the instance number and the machine identifier, the problem that the system wrongly distributes the old configuration information to the current machine when the machine is recycled is avoided, and the used module of a certain machine layer and the related configuration content at the time can be traced back at the later stage. So as to trace the historical legacy problems and perform version backtracking.
Fig. 5 is a schematic diagram of main modules of an application instance number management apparatus according to a fourth embodiment of the present invention. The application example number management device is arranged in the management server. As shown in fig. 5, the application instance number management apparatus 500 according to the embodiment of the present invention includes: a connection module 501, an acquisition module 502, and an allocation module 503.
A connection module 501, configured to establish a long connection with a node machine in a distributed cluster.
A long connection means that a plurality of packets can be continuously transmitted over one connection and then the connection is disconnected, and during the connection maintenance period, if no packet is transmitted, a link check packet needs to be transmitted by both sides. Illustratively, the connection module 501 and the node machines in the distributed cluster may establish a long connection through a three-way handshake.
In the embodiment of the invention, the long connection is established with the node machine, so that the subsequent operations of application, distribution and the like of the instance number can be directly performed through the long connection, and the resource overhead caused by frequent closing and connection establishment in the instance number management process is reduced.
An obtaining module 502, configured to obtain a target instance number from an instance pool in response to an application instance number obtaining request sent by the node machine through the long connection.
In an alternative example, the instance pool adopts a page type storage method, specifically, the instance pool is divided into a plurality of pages, the pages are corresponding to the clusters, and application instance numbers in the same page are used for being distributed to node machines in the corresponding clusters. For example, page 1 corresponds to cluster a, the application instance number in page 1 is used to assign to the node machine in cluster a, page 2 corresponds to cluster B, and the application instance number in page 2 is used to assign to the node machine in cluster B. In this optional example, after receiving the application instance number obtaining request, the obtaining module 502 determines the cluster identifier where the node machine is located according to the application instance number obtaining request; the obtaining module 502 obtains the instance number from the page corresponding to the cluster identifier and uses the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: node machine identification and cluster identification where the node machine is located. In this optional implementation, the determining, by the obtaining module 502 according to the application instance number obtaining request, the cluster identifier where the node machine is located includes: the obtaining module 502 analyzes the application instance number obtaining request to obtain the cluster identifier of the node machine carried by the application instance number obtaining request.
In another optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: and identifying the node machine. In this optional implementation, the determining, by the obtaining module 502 according to the application instance number obtaining request, the cluster identifier where the node machine is located includes: the obtaining module 502 analyzes the application instance number obtaining request to obtain the node machine identifier carried by the application instance number obtaining request, and the obtaining module 502 queries the first database table according to the node machine identifier to obtain the cluster identifier where the node machine is located from the first database table. The first database table records cluster identification and other information of each node machine in the distributed cluster.
In the embodiment of the invention, the example pool adopts a page type storage mode, and pages are corresponding to the clusters, so that management such as distribution of application example numbers required by different clusters is facilitated, and the management effect of the application example numbers is improved.
In another alternative example, the instance pool is stored in a page manner, specifically, the instance pool is divided into a plurality of pages, the pages correspond to the modules to which the application instances belong, and application instance numbers in the same page are used for being distributed to node machines needing to deploy the application instances under the corresponding modules. For example, page 1 corresponds to module I, the application instance number in page 1 is used for the node machine that requires deployment of the application instance under module I, and page 2 corresponds to module II, the application instance number in page 2 is used for the node machine that requires deployment of the application instance under module II. In this optional example, after receiving the application instance number obtaining request, the obtaining module 502 determines, according to the application instance number obtaining request, a module identifier to which an application instance of the node machine application belongs; the obtaining module 502 obtains the instance number from the page corresponding to the module id, and uses the instance number as the target instance number.
In an optional implementation manner of the foregoing optional example, the application instance number obtaining request includes: a machine identification, and a module identification. In this optional implementation, the determining, by the obtaining module 502 according to the application instance number obtaining request, a module identifier to which an application instance of the node machine application belongs includes: the obtaining module 502 analyzes the application instance number obtaining request to obtain a module identifier of the application instance of the node machine application carried by the obtaining module.
An allocating module 503, configured to send the target instance number to the node machine, and delete the target instance number from the instance pool.
After the obtaining module obtains the target instance number from the instance pool, the allocating module 503 sends configuration information such as the target instance number to the node machine through long connection, and deletes the target instance number from the instance pool. After receiving configuration information such as a target instance number, the node machine generates a configuration file containing the target instance number.
In the embodiment of the invention, the automatic allocation of the application instance numbers is realized through the device, the situation of repeated instance numbers is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved.
Fig. 6 is a schematic diagram of main modules of an application instance number management apparatus according to a fifth embodiment of the present invention. The application instance number management device of the embodiment of the invention is arranged on the node machines in the distributed cluster. As shown in fig. 6, the application instance number management apparatus 600 according to the embodiment of the present invention includes: a connection module 601, an application module 602, and a generation module 603.
The connection module 601 is configured to establish a long connection with the management server.
A long connection means that a plurality of packets can be continuously transmitted over one connection and then the connection is disconnected, and during the connection maintenance period, if no packet is transmitted, a link check packet needs to be transmitted by both sides. Illustratively, the connection module 601 and the management server may establish a long connection through three handshakes.
The application module 602 is configured to determine whether application instance number configuration information exists.
For example, the application module 602 may determine whether the application instance number configuration information exists according to the following manner: the application module 602 queries the specified directory in the node machine; if the configuration file of the application instance number does not exist in the specified directory or the configuration file is empty, the application module 602 determines that the configuration information of the application instance number does not exist; otherwise, the application module 602 determines that application instance number configuration information exists.
The application module 602 is further configured to send an application instance number acquisition request to the management server through the long connection when it is determined that the application instance number configuration information does not exist.
In an optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a cluster in which the node machine is located. In this optional example, after receiving the application instance obtaining request, the management server parses the cluster identifier where the node machine is located from the application instance obtaining request, and then randomly obtains an application instance number from a page corresponding to the cluster identifier or obtains the smallest instance number in the current page, and takes the smallest instance number as the target instance number.
In another optional example, the application instance obtaining request includes an identifier of the node machine and an identifier of a module to which the application instance applied by the node machine belongs. In this optional embodiment, after receiving the application instance obtaining request, the management server parses the application instance number obtaining request to obtain a module identifier carried by the application instance obtaining request, and then randomly obtains an application instance number from a page corresponding to the module identifier or obtains a minimum instance number in the current page, and uses the minimum instance number as a target instance number.
The generating module 603 is configured to generate a configuration file including the target instance number after receiving the target instance number sent by the management server.
Further, when the configuration file containing the target instance number is generated by the generation module, the node machine may perform deployment of the application instance according to the configuration file and other required configuration files.
In the embodiment of the invention, the automatic application and allocation of the application instance numbers are realized through the device, the situation that repeated instance numbers occur is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with the electronic device implementing an embodiment of the present invention. The computer system illustrated in FIG. 7 is only an example and should not impose any limitations on the scope of use or functionality of embodiments of the invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a connection module, an acquisition module, and an assignment module. Where the names of these modules do not in some cases constitute a limitation on the modules themselves, for example, a connection module may also be described as a "module that establishes a long connection with a node machine in a distributed cluster".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform the following: establishing long connection with a node machine in the distributed cluster; responding to an application instance number acquisition request sent by the node machine through the long connection, and acquiring a target instance number from an instance pool; and sending the target instance number to the node machine, and deleting the target instance number from the instance pool.
As a further aspect, the present invention also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to perform the following: establishing a long connection with a management server; judging whether application instance number configuration information exists or not; if not, sending an application instance number acquisition request to the management server through the long connection; and after receiving the target instance number sent by the management server, generating a configuration file containing the target instance number.
According to the technical scheme of the embodiment of the invention, the automatic allocation of the application instance numbers is realized, the situation of repeated instance numbers is not needed to be worried about, the operation and maintenance cost is reduced, and the efficiency of application deployment and implementation is improved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (15)

1. An application instance number management method is applied to a management server and comprises the following steps:
establishing long connection with a node machine in the distributed cluster;
responding to an application instance number acquisition request sent by the node machine through the long connection, and acquiring a target instance number from an instance pool;
and sending the target instance number to the node machine, and deleting the target instance number from the instance pool.
2. The method of claim 1, wherein the pool of instances comprises a plurality of pages; the obtaining of the target instance number from the instance pool includes:
determining the cluster identifier where the node machine is located according to the application instance number acquisition request; and acquiring an instance number from the paging corresponding to the cluster identifier, and taking the instance number as the target instance number.
3. The method of claim 2, wherein the determining the cluster identifier where the node machine is located according to the application instance number obtaining request comprises:
analyzing the cluster identifier of the node machine carried by the application instance number acquisition request from the application instance number acquisition request; or analyzing the node machine identifier carried by the application instance number acquisition request from the application instance number acquisition request, and inquiring the first database table according to the node machine identifier to acquire the cluster identifier where the node machine is located.
4. The method of claim 1, wherein the pool of instances comprises a plurality of pages; the obtaining of the target instance number from the instance pool includes:
determining a module identifier to which an application instance of the node machine application belongs according to the application instance number acquisition request; and acquiring an instance number from the paging corresponding to the module identifier, and taking the instance number as the target instance number.
5. The method of claim 2 or 4, wherein the obtaining the instance number from the corresponding page comprises:
an instance number is randomly obtained from the corresponding page, or the smallest instance number is obtained from the corresponding page.
6. The method of claim 1, further comprising:
monitoring the state of the node machine; and under the condition that the node machine is monitored to be in an off-line state or the disconnection with the management server exceeds the preset time, recycling the instance number of the node machine.
7. The method of claim 1, further comprising:
and after the target instance number is pushed to the node machine, adding a corresponding relation between the target instance number and the identifier of the node machine in a second database table.
8. The method of claim 1, further comprising:
and responding to a submission request for the configuration information of the instance pool initiated by the user terminal, and storing the configuration information of the instance pool.
9. An application instance number management method is applied to a node machine in a distributed cluster, and comprises the following steps:
establishing a long connection with a management server;
judging whether application instance number configuration information exists or not; if not, sending an application instance number acquisition request to the management server through the long connection;
and after receiving the target instance number sent by the management server, generating a configuration file containing the target instance number.
10. The method of claim 9, wherein the determining whether application instance number configuration information exists comprises:
querying a designated directory in the node machine; and if the configuration file of the application instance number does not exist in the specified directory or the configuration file is empty, determining that the configuration information of the application instance number does not exist.
11. The method according to claim 9, wherein the application instance number acquisition request carries a node machine identifier and a cluster identifier where the node machine is located; or, the application instance number obtaining request carries the node machine identifier and the module identifier to which the applied application instance belongs.
12. An application instance number management device, which is disposed in a management server, includes:
the connection module is used for establishing long connection with the node machines in the distributed cluster;
an obtaining module, configured to obtain a target instance number from an instance pool in response to an application instance number obtaining request sent by the node machine through the long connection;
and the distribution module is used for sending the target instance number to the node machine and deleting the target instance number from the instance pool.
13. An application instance number management device, wherein the device is disposed in a node machine in a distributed cluster, and the device comprises:
the connection module is used for establishing long connection with the management server;
the application module is used for judging whether application instance number configuration information exists or not; if not, sending an application instance number acquisition request to the management server through the long connection;
and the generating module is used for generating a configuration file containing the target instance number after receiving the target instance number sent by the management server.
14. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8, 9-11.
15. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-8, 9-11.
CN202110705653.XA 2021-06-24 2021-06-24 Application instance number management method and device, electronic equipment and computer readable medium Pending CN113419745A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110705653.XA CN113419745A (en) 2021-06-24 2021-06-24 Application instance number management method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110705653.XA CN113419745A (en) 2021-06-24 2021-06-24 Application instance number management method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN113419745A true CN113419745A (en) 2021-09-21

Family

ID=77717654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110705653.XA Pending CN113419745A (en) 2021-06-24 2021-06-24 Application instance number management method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN113419745A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363333A (en) * 2021-12-29 2022-04-15 胜斗士(上海)科技技术发展有限公司 Method, apparatus, device and medium for assigning machine ID in distributed system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6842789B1 (en) * 1999-10-21 2005-01-11 Sun Microsystems, Inc. Method and apparatus for assigning unique device identifiers across a distributed computing system
CN111090440A (en) * 2018-10-23 2020-05-01 阿里巴巴集团控股有限公司 Information processing method, system, device and storage medium
CN111259376A (en) * 2020-01-17 2020-06-09 中国平安人寿保险股份有限公司 Authority configuration method, device, server and storage medium
CN111736929A (en) * 2020-06-22 2020-10-02 北京百度网讯科技有限公司 Method, device and equipment for creating task instance and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6842789B1 (en) * 1999-10-21 2005-01-11 Sun Microsystems, Inc. Method and apparatus for assigning unique device identifiers across a distributed computing system
CN111090440A (en) * 2018-10-23 2020-05-01 阿里巴巴集团控股有限公司 Information processing method, system, device and storage medium
CN111259376A (en) * 2020-01-17 2020-06-09 中国平安人寿保险股份有限公司 Authority configuration method, device, server and storage medium
CN111736929A (en) * 2020-06-22 2020-10-02 北京百度网讯科技有限公司 Method, device and equipment for creating task instance and readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114363333A (en) * 2021-12-29 2022-04-15 胜斗士(上海)科技技术发展有限公司 Method, apparatus, device and medium for assigning machine ID in distributed system
CN114363333B (en) * 2021-12-29 2023-11-28 胜斗士(上海)科技技术发展有限公司 Method, apparatus, device and medium for assigning machine ID in distributed system

Similar Documents

Publication Publication Date Title
CN106850830B (en) Service request processing method, device and system and related server
CN113742031B (en) Node state information acquisition method and device, electronic equipment and readable storage medium
EP2838228A1 (en) Alarm correlation analysis method, apparatus, and system
CN107729176B (en) Disaster recovery method and disaster recovery system for configuration file management system
CN111460129A (en) Method and device for generating identification, electronic equipment and storage medium
CN113495921A (en) Routing method and device of database cluster
CN104144098A (en) Information pushing method and system and pushing server equipment
CN105554099A (en) Method and device for balancing load of acquisition servers
CN111127181A (en) Voucher bookkeeping method and device
CN112052227A (en) Data change log processing method and device and electronic equipment
CN111767157A (en) Request processing method and device based on service grid
CN115617511A (en) Resource data processing method and device, electronic equipment and storage medium
CN111190960A (en) Method, device, equipment and medium for transmitting distributed files
CN113419745A (en) Application instance number management method and device, electronic equipment and computer readable medium
CN113760482B (en) Task processing method, device and system
CN111131367B (en) Distributed access service processing method and device
CN109526032B (en) Method and device for modifying network slice example
CN113904871B (en) Access method of network slice, PCF entity, terminal and communication system
CN114070889A (en) Configuration method, traffic forwarding method, device, storage medium, and program product
CN114070824A (en) Registration method, registration cloud service, medium, and program product for internet of things device
CN113010363B (en) Container monitoring method under swarm clusters and shared service cloud platform
CN114528095A (en) Cluster data processing method and device, electronic equipment and storage medium
CN105187244A (en) Access management system of digital communication equipment supporting multiple management modes
CN107124293B (en) Protocol management method and system of distributed network system
CN112035243A (en) Data query method, device, terminal and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination