CN111884844A - Message service access method and device based on zookeeper - Google Patents

Message service access method and device based on zookeeper Download PDF

Info

Publication number
CN111884844A
CN111884844A CN202010696833.1A CN202010696833A CN111884844A CN 111884844 A CN111884844 A CN 111884844A CN 202010696833 A CN202010696833 A CN 202010696833A CN 111884844 A CN111884844 A CN 111884844A
Authority
CN
China
Prior art keywords
configuration information
message
zookeeper
message service
server
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
CN202010696833.1A
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
CCB Finetech 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 China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202010696833.1A priority Critical patent/CN111884844A/en
Publication of CN111884844A publication Critical patent/CN111884844A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Abstract

The invention provides a zookeeper-based message service access method and equipment, wherein the method comprises the following steps: acquiring a configuration information change message sent by a server; updating local configuration information according to the configuration information change message; and sending the updated configuration information to the client registered with the corresponding watch monitoring, and sending the updated configuration information to the client registered with the corresponding watch monitoring in time after the configuration information is updated by using a watch monitoring mechanism of the zookeeper so as to prevent abnormal service.

Description

Message service access method and device based on zookeeper
Technical Field
The invention relates to the technical field of computers, in particular to a zookeeper-based message service access method and equipment.
Background
In an enterprise-level message platform, besides supporting a large number of message transmission functions, the convenience of application access and the convenience of management of a server side become an important requirement.
In an enterprise-level message platform, many applications need to access the message platform through message clients, and how to organize and manage the clients and parameter configuration is a key technology for solving a large-scale extended message platform.
At present, based on the registration center to manage the configuration parameters of each client, the server allocates a message service code to each client, and loads the configuration parameters such as a queue name used by each client for connection to the registration center, and the service address is also statically written to the registration center. When the client accesses the message platform, the client uses the message service code to connect and register to the registration center to obtain the configuration information, and then establishes the connection to the message platform according to the configuration information.
However, the configuration information is statically written to the registry, and cannot be updated to the client in time after the configuration information is changed or when the server expands the capacity, which causes abnormal service.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a zookeeper-based message service access method and equipment, which can at least partially solve the problems in the prior art.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, a zookeeper-based message service access method is provided, and includes:
acquiring a configuration information change message sent by a server;
updating local configuration information according to the configuration information change message;
and sending the updated configuration information to the client registered with the corresponding watch monitor.
Further, the message service access method based on zookeeper further comprises the following steps:
acquiring a message service code sent by the client;
and sending the configuration information corresponding to the message service code to the client.
Further, the message service access method based on zookeeper further comprises the following steps:
sending a detection message to the server;
and if the message fed back by the server is not received within the preset time, the server is cancelled.
In a second aspect, there is provided a zookeeper device comprising:
the change message acquisition module is used for acquiring the configuration information change message sent by the server;
the information updating module updates the local configuration information according to the configuration information change message;
and the information sending module is used for sending the updated configuration information to the client registered with the corresponding watch monitor.
Further, the zookeeper device further comprises:
the message service code acquisition module is used for acquiring the message service code sent by the client;
and the configuration information sending module is used for sending the configuration information corresponding to the message service code to the client.
Further, the zookeeper device further comprises:
the detection module is used for sending a detection message to the server;
and the server side logout module is used for logging out the server side if the message fed back by the server side is not received within the preset time.
In a third aspect, a zookeeper-based message service access method is provided, including:
sending a message service code to the zookeeper to acquire corresponding configuration information;
comparing the configuration information with local configuration information stored in a message cache region;
and judging whether the connection with the server needs to be reestablished according to the comparison result.
In a fourth aspect, a client device is provided, comprising:
the configuration information sending module is used for sending a message service code to the zookeeper so as to acquire corresponding configuration information;
the configuration information comparison module is used for comparing the configuration information with local configuration information stored in the message cache region;
and the reestablishment judging module is used for judging whether the connection with the server needs to be reestablished or not according to the comparison result.
In a fifth aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of the above-mentioned zookeeper-based message service access method are implemented.
In a sixth aspect, a computer readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the aforementioned zookeeper-based message service access method.
The invention provides a zookeeper-based message service access method and equipment, wherein the method comprises the following steps: acquiring a configuration information change message sent by a server; updating local configuration information according to the configuration information change message; and sending the updated configuration information to the client registered with the corresponding watch monitoring, and sending the updated configuration information to the client registered with the corresponding watch monitoring in time after the configuration information is updated by using a watch monitoring mechanism of the zookeeper so as to prevent abnormal service.
In order to make the aforementioned and other objects, features and advantages of the invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. In the drawings:
FIG. 1 is a schematic diagram of an application architecture according to an embodiment of the present invention;
fig. 2 is a first flowchart of a zookeeper-based message service access method in an embodiment of the present invention;
fig. 3 is a flowchart illustrating a message service access method based on zookeeper in an embodiment of the present invention;
fig. 4 is a third flowchart of a zookeeper-based message service access method in an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a zookeeper device in an embodiment of the invention;
fig. 6 is a flowchart illustrating another message service access method based on zookeeper in an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a client device in an embodiment of the present invention;
fig. 8 is a block diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention 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, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It should be noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of this application and the above-described drawings, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Zookeeper is a sub-project of Hadoop, and is a coordination system in a distributed system, and the available services mainly include: configuration services, name services, distributed synchronization, group services, and the like.
The enterprise-level messaging platform includes: how to organize and manage the client and the parameter configuration is a key technology for solving a large-scale extended message platform.
The management of the message service side is the management of parameters needed for accessing the message service side. These parameters typically include the IP address and port of the server, the message queue name, the message exchange name, the client's reconnect policy, timeout parameter configuration, etc. These parameters are used for access by a client when accessing the message service.
The embodiment of the invention adopts the techniques of message servitization and parameter cataloging, supports the dynamic expansion of a message service cluster, shields the influence on the application, realizes the dynamic management of the message cluster and the real-time synchronization of the parameters, in addition, the real-time synchronous update of the message configuration information at a server and a client shields the influence of the change of the server on an access application system, realizes the real-time detection of the fault isolation and the recovery of the message service, and utilizes the message service load balance and the multi-machine room multi-activity deployment.
FIG. 1 is a schematic diagram of an application architecture according to an embodiment of the present invention; as shown in fig. 1, a message service cluster a and a message service cluster B for providing message services are used as message service terminals, and perform bidirectional interaction with zookeeper respectively, and a client 1 and a client 2 also perform bidirectional interaction with zookeeper, and in addition, a parameter cache region of the client also performs bidirectional interaction with zookeeper.
Fig. 2 is a first flowchart of a zookeeper-based message service access method in an embodiment of the present invention; as shown in fig. 2, the message service access method based on zookeeper is applied to a zookeeper device, and includes the following steps:
step S100: acquiring a configuration information change message sent by a server;
specifically, when the configuration information of the server is changed, the configuration information change message is actively issued to the zookeeper device, so that the zookeeper device can update.
In addition, the configuration information initially stored in the zookeeper device is also issued by the server according to the service configuration of the server.
Step S200: updating local configuration information according to the configuration information change message;
specifically, the configuration information change message includes: adding, deleting and modifying, and updating information by adopting different strategies according to different update messages.
Step S300: and sending the updated configuration information to the client registered with the corresponding watch monitor.
In particular, zookeeper provides a publish/subscribe functionality for distributed data implemented using a watch mechanism. zookeeper allows a client to register a watchdog, and when some event of a server triggers the watchdog, an event notification is sent to the client registered with the watchdog to realize the distributed notification function. The client establishes a parameter cache area to map parameter configuration. And monitoring the corresponding change events of addition, deletion and modification by using a watch, and synchronizing the data to a parameter cache region of the client in real time through a synchronization thread when the zookeeper is modified. The parameter cache area keeps consistent with zookeeper data as much as possible. The client accesses the parameter cache area through a uniform interface and judges whether the parameters change or not by self. For message sending and receiving, the judgment of whether the parameters change is carried out before the message sending or receiving is carried out each time, when the obtained new parameters are found to be inconsistent with the last parameters, the parameters need to be updated, and the message receiving or sending action is carried out after the message access environment is rebuilt if necessary.
By adopting the technical scheme, the watchdog monitoring mechanism of the zookeeper is utilized, and after the configuration information is updated, the updated configuration information is sent to the client registered with the corresponding watchdog monitoring in time, so that abnormal service is prevented.
In an optional embodiment, referring to fig. 3, the zookeeper-based message service access method further includes:
step S400: acquiring a message service code sent by the client;
in order to facilitate application configuration and shield a complex mechanism in a message platform, a server side allocates a message service code to each accessed client side in the embodiment of the invention. A message service code corresponds to a set of configurations, and a set of resources are served at the message service end correspondingly. One of the dynamic resources is the server address and port. In order to ensure high availability, a service code application has multiple groups of machines for providing message services, and the group of machines should also provide services for other message codes, so that one group of machines provides services for the message codes of one group, and the group of machines providing message services for the same group of service codes is called a message service cluster. A unique message service cluster is configured in one message service code. The application can obtain the addresses and ports of this group of service clusters when addressing using the message service code.
In addition, the configuration information of the service code includes the following:
service code: a message service code;
service name: the name of the message service code is generally named according to the message scenario, such as: changing events for public customer information;
service version: service version number, currently only 01;
a service component: message service cluster names, such as: MQP, this entry is to be consistent with the cluster name configured in the "address" entry below;
available state: available/unavailable, and when the identification is unavailable, the information of the service code cannot be downloaded;
and (3) transmitting service information: corresponding routing, queue and other information;
example name: only CN-domestic examples are supported at present in response to multi-example messages;
address: configuration of connection-related information for message services, such as: the connection address, the number of reconnections, and the failover mechanism are currently configured as url strings.
The configuration items of the service cluster are composed of the following items:
service component abbreviation: the English name of the message service cluster corresponds to the service component in the service code;
service component name: the Chinese name of the message service cluster;
the component security node: a secure node number of the message service;
the platform to which the component belongs: an application platform built correspondingly;
the communication protocol is as follows: communication protocols, which may support different communication protocols;
address: IP address and port information of the server;
step S500: and sending the configuration information corresponding to the message service code to the client.
The message service code and the zookeeper information are directly sent to the client by the server, and when the client needs to provide the message service by the server, the client firstly accesses the zookeeper according to the zookeeper information and sends the message service code to the zookeeper so as to acquire the configuration information corresponding to the message service code.
And the client accesses the corresponding server according to the configuration information to perform message service.
By adopting the technical scheme, the client can effectively access the server, and the normal operation of the message service is ensured.
In an optional embodiment, referring to fig. 4, the zookeeper-based message service access method further includes:
step S600: sending a detection message to the server;
at a message service end, when the service is started, the terminal registers in the zookeeper, and when the service is stopped, the terminal logs out the zookeeper. However, sometimes the server may not provide the service normally for some reason, the process is not stopped, and the service address in the zookeeper is not logged out, but the service is abnormal.
To solve this problem, a green light detection machine is established between the server and the zookeeper, when the green light service is unavailable, the address of the machine is logged out of the zookeeper, and when the green light service replies, the address is registered to the zookeeper.
Step S700: and if the message fed back by the server is not received within the preset time, the server is cancelled.
It should be noted that the client may obtain the address of the server through the cache mechanism, and meanwhile, the client may determine whether the address is changed, so as to determine whether to reestablish the message access environment such as connection. The connection establishment is time consuming, so when the message address changes, it should be compared which addresses are unchanged, which addresses are newly added, and which addresses are deleted, and different change strategies are adopted for the new addition, the unchanged addition and the deletion. For addresses that do not change, the connection does not need to be updated. And for the newly added address, establishing a new connection, updating the new connection into the available connection list, and for the deleted address, performing disconnection operation.
The detection of real-time isolation and recovery of the fault machine is achieved through the cooperative cooperation of the server and the client.
In an alternative embodiment, the embodiment of the present invention further supports dynamic extension of a message service cluster.
Specifically, the address of the existing service cluster may be statically configured in the "address" item of the message server, but it is not favorable for dynamic management of cluster scale, and when a machine is added or deleted, the configuration item is operated.
In the embodiment of the invention, zookeeper establishes a hierarchical node structure and supports temporary nodes. Establishing a configuration item directory node based on the service code and the message service end on the zookeeper, establishing a temporary node under an 'address' node of the message service end by the message service cluster when the application is started, and writing the address information of the message service cluster under the temporary node, thereby forming a dynamic registration mechanism. When a new machine is added into the cluster, only a new node is established under the address node, and similarly, when the machine leaves the cluster, the temporary node under the address node used by the machine pair is deleted to achieve the aim of canceling the machine.
By adopting the technical scheme, the dynamic expansion of the message service cluster is realized, and the flexibility of the message service is further improved.
In an optional embodiment, the embodiment of the present invention further supports: message service load balancing.
Specifically, for message transmission, a message service corresponds to a group of message servers, and message transmission needs to select one server for transmission, and for the case of transmitting a large number of messages, the capability of load balancing needs to be solved.
When a client calls a message platform, a service address list corresponding to a service code is obtained through the service code, then connection to the addresses is established, the connection is placed in a list, the list is randomly ordered, then a message is tried to be sent from the first connection in the list, if the message is sent successfully, the sending is completed, if the message is sent unsuccessfully, the next connection is taken down, the sending is tried unsuccessfully again, if one connection in the list is sent successfully, the sending is successful, and the sending is finished. If the last connection fails to send, the message sending fails, and a failure result is returned to the application. This strategy of random transmission ensures a balanced message transmission.
In an optional embodiment, the embodiment of the present invention further supports multi-room multi-active deployment.
For example, the message platform establishes three machine rooms of a foreign bridge, a south lake and a rice lake. Message services are deployed simultaneously in three rooms. For one message service cluster, peer message service terminals are deployed in three machine rooms simultaneously. When the message server dynamically registers the address, the message server registers the machine room deployment information of the message server to the zookeeper.
When the client sends the message and uses the service code to address, the client takes the own machine room deployment information as the addressing parameter and transmits the addressing parameter to the message platform, and the client preferentially selects the message service address of the corresponding machine room to the application according to the machine room information transmitted by the application. Therefore, the message sending end preferentially sends the message to the message server in the same computer room when sending the message. If there is no server of the corresponding room at the time of addressing, a previously configured addressing policy is used. The addressing strategy has both default polling and assigned priority. For the polling strategy, the sequential progression of (yangqiao, south lake, oryza) is specified, namely: if the address of the south lake should be found, if the address of the south lake cannot be found, the rice scented lake is found, and if the address of the rice scented lake cannot be found, the ocean bridge is addressed, and the process is carried out in a circulating mode. The priority-assigned strategy refers to addressing according to configured priorities under the condition that the corresponding service of the local machine room is not addressed, for example, the priority order of (ocean bridge, south lake and rice lake) is configured, if the application machine room is the south lake, if the address of the south lake cannot be found, the ocean bridge is preferentially addressed, and then the rice lake is addressed. The addressing policy is configured to the service code.
For such an addressing strategy, if the sender application is deployed by multiple machine rooms, interaction with the message service of the machine room is preferably selected, and if the message service of the machine room is unavailable, the message service of other machine rooms can be used. The message service capability of multiple computer rooms is provided. For an application receiving a message, a plurality of computer rooms are required to be connected simultaneously for message collection.
In an alternative embodiment, the embodiments of the present invention also support heterogeneous channel integration.
In particular, there are occasions when it is necessary to use different messaging platforms, subject to technical platform constraints. For example, in some banks, the mainframe system is not opened, and only WebphereMq can be used for message transmission on the mainframe system. Thus, the application component deployed on the large machine needs to use MQ when the component and the component on the open platform carry out message intercommunication. There are many optional platforms for message transmission between open systems, such as: qpid, kafka, rocktmq, etc. Thus, different message transmission channels are required to be used in different message scenarios. API encapsulation is carried out on qpid and WebphereMq, uniform message API supply application calling is provided, the difference of the two message middleware is shielded, and the application does not need to concern the realization of a bottom layer message transmission channel.
The API of the sending end comprises the following steps:
(1) logging in a message platform environment according to a service code to obtain a message service address;
(2) establishing connection according to the acquired message service address;
(3) sending a message using the connection;
(4) closing the connection;
the receiving end API comprises the following steps:
(1) logging in a message platform environment according to a service code to obtain a message service address;
(2) establishing connection according to the acquired message service address;
(3) receiving a message using the connection;
(4) sending a message using the connection;
the client API acquires the service address configuration corresponding to the service code from zk according to the service code, acquires the protocol type according to the front bits in the configuration url and acquires the protocol type according to different protocol types, thereby determining the type of the message channel and calling different message channels to establish corresponding connection objects. Different message channels correspond to different connection object types. Therefore, the message sending and receiving can be operated on different connection objects, and the purpose of heterogeneous channel integration is achieved.
In summary, according to the message service access method based on the zookeeper provided by the embodiment of the present invention, information is dynamically written to the zookeeper, and is updated to the client in time after being changed, and the client does not need to restart application for updating configuration. When the number of messages is increased and the server needs to expand capacity, the client can acquire a new service address in time, and when the server is abnormal, the client can be isolated and recovered in time, so that the complexity of accessing the message service by application is reduced, the internal complex mechanism of a message platform is shielded, the management efficiency of a large-scale message cluster is improved, and the load balancing capability and the capability of deploying a plurality of message service rooms are provided.
Based on the same inventive concept, embodiments of the present application further provide a zookeeper device, which may be used to implement the method described in the foregoing embodiments, as described in the following embodiments. Since the principle of the zookeeper device for solving the problem is similar to that of the method, the implementation of the zookeeper device can be referred to the implementation of the method, and repeated details are omitted. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a block diagram of a zookeeper device in an embodiment of the present invention. As shown in fig. 5, the method specifically includes: a change message acquisition module 10, an information update module 20, and an information transmission module 30.
The change message obtaining module 10 obtains a configuration information change message sent by a server;
the information updating module 20 updates the local configuration information according to the configuration information change message;
the information sending module 30 sends the updated configuration information to the client registered with the corresponding watchdog.
By adopting the technical scheme, the watchdog monitoring mechanism of the zookeeper is utilized, and after the configuration information is updated, the updated configuration information is sent to the client registered with the corresponding watchdog monitoring in time, so that abnormal service is prevented.
In an optional embodiment, the zookeeper device may further comprise: the system comprises a message service code acquisition module and a configuration information sending module.
A message service code acquisition module acquires a message service code sent by the client;
and the configuration information sending module sends the configuration information corresponding to the message service code to the client.
In an optional embodiment, the zookeeper device may further comprise: the system comprises a detection module and a server logout module.
The detection module sends a detection message to the server;
and if the server side logout module does not receive the message fed back by the server side within the preset time, logging out the server side.
The embodiment of the invention also provides a message service access method based on zookeeper, and referring to fig. 6, the application of the message service access method based on zookeeper and a client specifically comprises the following contents:
step S1000: sending a message service code to the zookeeper to acquire corresponding configuration information;
specifically, a client accesses a zookeeper through a message service code and zookeeper information which are sent to the client in advance by a server, and sends the message service code to the zookeeper so as to acquire configuration information which is fed back by the zookeeper and corresponds to the message service code; and then performs a message service according to the configuration information.
Step S2000: comparing the configuration information with local configuration information stored in a message cache region;
it should be noted that there is a possibility that the configuration information may change during the message service, and the zookeeper sends the configuration information change message to the message buffer of the client by using the watchdog mechanism of the zookeeper when the configuration information is changed.
Step S3000: judging whether the connection with the server needs to be reestablished or not according to the comparison result;
the client can obtain the address of the server through a cache mechanism, and meanwhile, the client can judge whether the address is changed or not, so that whether the message access environments such as connection and the like need to be reestablished or not is judged. The connection establishment is time consuming, so when the message address changes, it should be compared which addresses are unchanged, which addresses are newly added, and which addresses are deleted, and different change strategies are adopted for the new addition, the unchanged addition and the deletion. For addresses that do not change, the connection does not need to be updated. And for the newly added address, establishing a new connection, updating the new connection into the available connection list, and for the deleted address, performing disconnection operation.
By adopting the scheme, the watchdog monitoring mechanism of the zookeeper can be effectively utilized, after the configuration information is updated, the updated configuration information is timely sent to the parameter cache region of the client registered to the watchdog monitoring, when the client sends the message, whether the configuration information is changed compared with the configuration information of the parameter cache region is judged, and the subsequent operation is carried out according to the judgment result, so that the service abnormity caused by the fact that the configuration information is not timely updated to the client in the change of the configuration information can be prevented.
Based on the same inventive concept, the embodiments of the present application further provide a client device, which can be used to implement the methods described in the foregoing embodiments, as described in the following embodiments. As the principle of the client device to solve the problem is similar to the method, the implementation of the client device may refer to the implementation of the method, and repeated details are not repeated. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 7 is a block diagram of a client device in the embodiment of the present invention. As shown in fig. 7, the method specifically includes: a configuration information sending module 100, a configuration information comparing module 200 and a reconstruction judging module 300.
The configuration information sending module 100 sends a message service code to the zookeeper to acquire corresponding configuration information;
the configuration information comparison module 200 compares the configuration information with local configuration information stored in a message cache region;
the reestablishment judging module 300 judges whether the connection with the server needs to be reestablished according to the comparison result.
By adopting the scheme, the watchdog monitoring mechanism of the zookeeper can be effectively utilized, after the configuration information is updated, the updated configuration information is timely sent to the parameter cache region of the client registered to the watchdog monitoring, when the client sends the message, whether the configuration information is changed compared with the configuration information of the parameter cache region is judged, and the subsequent operation is carried out according to the judgment result, so that the service abnormity caused by the fact that the configuration information is not timely updated to the client in the change of the configuration information can be prevented.
The apparatuses, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or implemented by a product with certain functions. A typical implementation device is an electronic device, which may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
In a typical example, the electronic device specifically includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the steps of the aforementioned zookeeper-based message service access method when executing the program.
Referring now to FIG. 8, shown is a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present application.
As shown in fig. 8, the electronic apparatus 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate works and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM)) 603. In the RAM603, various programs and data necessary for the operation of the system 600 are also stored. The CPU601, ROM602, and RAM603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted as necessary on the storage section 608.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, an embodiment of the present invention includes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the aforementioned zookeeper-based message service access method.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. 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.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
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, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A message service access method based on zookeeper is characterized by comprising the following steps:
acquiring a configuration information change message sent by a server;
updating local configuration information according to the configuration information change message;
and sending the updated configuration information to the client registered with the corresponding watch monitor.
2. The zookeeper-based message service access method of claim 1, further comprising:
acquiring a message service code sent by the client;
and sending the configuration information corresponding to the message service code to the client.
3. The zookeeper-based message service access method of claim 1, further comprising:
sending a detection message to the server;
and if the message fed back by the server is not received within the preset time, the server is cancelled.
4. A zookeeper device, comprising:
the change message acquisition module is used for acquiring the configuration information change message sent by the server;
the information updating module updates local configuration information according to the configuration information change message;
and the information sending module is used for sending the updated configuration information to the client registered with the corresponding watch monitor.
5. The zookeeper device of claim 4, further comprising:
the message service code acquisition module is used for acquiring the message service code sent by the client;
and the configuration information sending module is used for sending the configuration information corresponding to the message service code to the client.
6. The zookeeper device of claim 4, further comprising:
the detection module is used for sending a detection message to the server;
and the server side logout module is used for logging out the server side if the message fed back by the server side is not received within the preset time.
7. A message service access method based on zookeeper is characterized by comprising the following steps:
sending a message service code to the zookeeper to acquire corresponding configuration information;
comparing the configuration information with local configuration information stored in a message cache region;
and judging whether the connection with the server needs to be reestablished according to the comparison result.
8. A client device, comprising:
the configuration information sending module is used for sending a message service code to the zookeeper so as to acquire corresponding configuration information;
the configuration information comparison module is used for comparing the configuration information with local configuration information stored in the message cache region;
and the reestablishment judging module is used for judging whether the connection with the server needs to be reestablished or not according to the comparison result.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the steps of the zookeeper-based message service access method of any of claims 1 to 3, 7.
10. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the zookeeper-based message service access method of any of claims 1 to 3, 7.
CN202010696833.1A 2020-07-20 2020-07-20 Message service access method and device based on zookeeper Pending CN111884844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010696833.1A CN111884844A (en) 2020-07-20 2020-07-20 Message service access method and device based on zookeeper

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010696833.1A CN111884844A (en) 2020-07-20 2020-07-20 Message service access method and device based on zookeeper

Publications (1)

Publication Number Publication Date
CN111884844A true CN111884844A (en) 2020-11-03

Family

ID=73156113

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010696833.1A Pending CN111884844A (en) 2020-07-20 2020-07-20 Message service access method and device based on zookeeper

Country Status (1)

Country Link
CN (1) CN111884844A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377397A (en) * 2021-05-27 2021-09-10 深圳十方融海科技有限公司 Configuration updating method and device, computer equipment and storage medium
CN114253626A (en) * 2021-11-30 2022-03-29 王建冬 Message processing method and device, electronic equipment and storage medium
WO2022095678A1 (en) * 2020-11-04 2022-05-12 华云数据控股集团有限公司 Message push method and message service system
CN114924806A (en) * 2022-04-07 2022-08-19 南京慧尔视软件科技有限公司 Dynamic synchronization method, device, equipment and medium for configuration information

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104092718A (en) * 2013-12-12 2014-10-08 腾讯数码(天津)有限公司 Distributed system and configuration information updating method in distributed system
CN107864053A (en) * 2017-10-31 2018-03-30 北京小米移动软件有限公司 Dynamic Configuration and device based on zookeeper
CN107908708A (en) * 2017-11-09 2018-04-13 北京锐安科技有限公司 A kind of method, system, equipment and the storage medium of group document synchronization
CN111371898A (en) * 2020-03-13 2020-07-03 北京锐安科技有限公司 Message monitoring method, device, equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104092718A (en) * 2013-12-12 2014-10-08 腾讯数码(天津)有限公司 Distributed system and configuration information updating method in distributed system
CN107864053A (en) * 2017-10-31 2018-03-30 北京小米移动软件有限公司 Dynamic Configuration and device based on zookeeper
CN107908708A (en) * 2017-11-09 2018-04-13 北京锐安科技有限公司 A kind of method, system, equipment and the storage medium of group document synchronization
CN111371898A (en) * 2020-03-13 2020-07-03 北京锐安科技有限公司 Message monitoring method, device, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022095678A1 (en) * 2020-11-04 2022-05-12 华云数据控股集团有限公司 Message push method and message service system
CN113377397A (en) * 2021-05-27 2021-09-10 深圳十方融海科技有限公司 Configuration updating method and device, computer equipment and storage medium
CN114253626A (en) * 2021-11-30 2022-03-29 王建冬 Message processing method and device, electronic equipment and storage medium
CN114253626B (en) * 2021-11-30 2023-10-20 王建冬 Message processing method, device, electronic equipment and storage medium
CN114924806A (en) * 2022-04-07 2022-08-19 南京慧尔视软件科技有限公司 Dynamic synchronization method, device, equipment and medium for configuration information
CN114924806B (en) * 2022-04-07 2024-03-26 南京慧尔视软件科技有限公司 Dynamic synchronization method, device, equipment and medium for configuration information

Similar Documents

Publication Publication Date Title
CN111884844A (en) Message service access method and device based on zookeeper
WO2020177533A1 (en) Electronic invoice identifier allocation method, and electronic ticket generating method, device and system
US8200789B2 (en) Method, system and program product for automated topology formation in dynamic distributed environments
CN112003961B (en) Resource exposure method, system, equipment and medium in kubernets
CN113572831B (en) Communication method, computer equipment and medium between Kubernetes clusters
US10798218B2 (en) Environment isolation method and device
CN112968967A (en) Block synchronization method and device
CN109783151B (en) Method and device for rule change
CN113783922A (en) Load balancing method, system and device
CN110069346B (en) Method and device for sharing resources among multiple processes and electronic equipment
CN110554927A (en) Micro-service calling method based on block chain
CN110377431B (en) Service calling method and device under multi-registry scene
CN110932876B (en) Communication system, method and device
CN111078238A (en) Centralized processing method and device for application configuration in container environment
CN113965585A (en) Multi-cloud interconnection method and device
CN114363402B (en) Shooting range interconnection method, shooting range interconnection system and electronic equipment
CN111147312B (en) Resource allocation management method and device, resource allocation cache management method and device, and allocation management system
CN115065686B (en) Configuration method, device and system of distributed load balancing system
CN116319963A (en) Service management method, system, terminal equipment and storage medium
CN116647552A (en) Service processing method and system in heterogeneous micro-service cluster, terminal and storage medium
CN114760360B (en) Request response method, request response device, electronic equipment and computer readable storage medium
CN114880717A (en) Data archiving method and device
CN115277864A (en) Route determining method and device, computer readable storage medium and terminal
CN111866041B (en) Service equipment selection method, cloud storage cluster updating method, device and storage medium
CN114172917B (en) Distributed cache system and deployment method thereof

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20220913

Address after: 25 Financial Street, Xicheng District, Beijing 100033

Applicant after: CHINA CONSTRUCTION BANK Corp.

Address before: 25 Financial Street, Xicheng District, Beijing 100033

Applicant before: CHINA CONSTRUCTION BANK Corp.

Applicant before: Jianxin Financial Science and Technology Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201103