CN115333940A - Method and system for realizing configuration monitoring based on ETCD - Google Patents
Method and system for realizing configuration monitoring based on ETCD Download PDFInfo
- Publication number
- CN115333940A CN115333940A CN202210962029.2A CN202210962029A CN115333940A CN 115333940 A CN115333940 A CN 115333940A CN 202210962029 A CN202210962029 A CN 202210962029A CN 115333940 A CN115333940 A CN 115333940A
- Authority
- CN
- China
- Prior art keywords
- configuration information
- target client
- monitoring
- request
- initial configuration
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012544 monitoring process Methods 0.000 title claims abstract description 61
- 238000000034 method Methods 0.000 title claims abstract description 36
- 238000004590 computer program Methods 0.000 claims description 6
- 239000000126 substance Substances 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 8
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000008859 change Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/085—Retrieval of network configuration; Tracking network configuration history
- H04L41/0859—Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions
- H04L41/0863—Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions by rolling back to previous configuration versions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Abstract
The invention provides a method and a system for realizing configuration monitoring based on ETCD, which are applied to a web server; the method comprises the following steps: establishing long connection with a target client, and storing initial configuration information of the target client in an ETCD (electronic toll collection) of a web server; after receiving a configuration monitoring request of a target client, establishing a long polling strategy; and carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy. The invention alleviates the technical problem that the configuration monitoring method in the prior art can not be used universally across languages.
Description
Technical Field
The invention relates to the technical field of configuration monitoring, in particular to a method and a system for realizing configuration monitoring based on ETCD.
Background
The existing configuration monitoring schemes are more, and native configuration monitoring is provided through zookeeper or ETCD, for example: either the watch mechanism of Zookeeper or the lease watch mechanism of ETCD can implement snooping of configurations. However, in the prior art, the native configuration monitoring method is used, a native client is required, each language has its own client method, and cross-language universality cannot be achieved.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method and a system for implementing configuration monitoring based on an etc d, so as to alleviate the technical problem that the configuration monitoring method in the prior art cannot be used universally across languages.
In a first aspect, an embodiment of the present invention provides a method for implementing configuration monitoring based on an ETCD, which is applied to a web server; the method comprises the following steps: establishing long connection with a target client, and storing initial configuration information of the target client in an ETCD (electronic toll collection) of the web service end; after receiving a configuration monitoring request of a target client, establishing a long polling strategy; and carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy.
Further, based on the initial configuration information in the ETCD and the long polling policy, performing configuration monitoring on the target client, including: monitoring a configuration request of the target client based on the long polling strategy; the configuration request comprises current configuration information of the target client; responding to a configuration request of the target client, and judging whether the current configuration information is the same as the initial configuration information; and if the initial configuration information is different, returning the initial configuration information to the target client.
Further, determining whether the current configuration information is the same as the initial configuration information includes: and judging whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
Further, still include: responding to a configuration request of the target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period; judging whether the initial configuration information changes within the preset time period; if so, returning the changed configuration information to the target client.
In a second aspect, an embodiment of the present invention further provides a system for implementing configuration monitoring based on an etc, which is applied to a web server; the method comprises the following steps: the system comprises a first establishing module, a second establishing module and a monitoring module; the first establishing module is used for establishing long connection with the target client and storing the initial configuration information of the target client in an ETCD (electronic toll collection) of the web server; the second establishing module is used for establishing a long polling strategy after receiving a configuration monitoring request of a target client; and the monitoring module is used for carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy.
Further, the listening module includes: a monitoring unit and a judging unit; the monitoring unit is used for monitoring a configuration request of the target client based on the long polling strategy; the configuration request comprises current configuration information of the target client; the judging unit is configured to respond to a configuration request of the target client, and judge whether the current configuration information is the same as the initial configuration information; and if the initial configuration information is different, returning the initial configuration information to the target client.
Further, the determining unit is further configured to: and judging whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
Further, the determining unit is further configured to: responding to a configuration request of the target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period; judging whether the initial configuration information changes within the preset time period; if so, returning the changed configuration information to the target client.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when executing the computer program.
In a fourth aspect, the present invention further provides a computer-readable medium having non-volatile program code executable by a processor, where the program code causes the processor to execute the method according to the first aspect.
The invention provides a method and a system for realizing configuration monitoring based on ETCD, comprising the following steps: establishing long connection with a target client, and storing initial configuration information of the target client in an ETCD (electronic toll collection) of a web server; after receiving a configuration monitoring request of a target client, establishing a long polling strategy; and carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy. The method provided by the invention can realize cross-language universality in an http mode, has small modification on the client side, is more convenient, and solves the technical problem that the configuration monitoring method in the prior art cannot realize cross-language universality.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for implementing configuration monitoring based on an etc. according to an embodiment of the present invention;
fig. 2 is a schematic diagram of request return when configuration is changed according to an embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a request return when a configuration is not changed according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a system for implementing configuration monitoring based on an etc. according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a monitoring module according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
The first embodiment is as follows:
fig. 1 is a flowchart of a method for implementing configuration monitoring based on an etc. according to an embodiment of the present invention, where the method is applied to a web server. As shown in fig. 1, the method specifically includes the following steps:
and step S102, establishing long connection with the target client, and storing the initial configuration information of the target client in the ETCD of the web server.
The distributed registration service center ETCD is a distributed and consistent key-value storage system for shared configuration and service discovery, and provides functions of data TTL invalidation, data change monitoring, multi-value, directory monitoring, distributed lock atom operation and the like.
And step S104, after receiving the configuration monitoring request of the target client, establishing a long polling strategy.
And step S106, configuring and monitoring the target client based on the initial configuration information and the long polling strategy.
Specifically, monitoring a configuration request of a target client based on a long polling strategy; the configuration request comprises current configuration information of the target client;
responding to a configuration request of a target client, and judging whether the current configuration information is the same as the initial configuration information; and if not, returning the initial configuration information to the target client.
Specifically, it is determined whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
Responding to a configuration request of a target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period;
judging whether the initial configuration information changes within a preset time period; if so, returning the changed configuration information to the target client.
The invention provides a method for realizing configuration monitoring based on ETCD (electronic toll collection), which can realize cross-language universality in an http (hyper text transport protocol) manner, has small modification on a client side, is more convenient and fast, and solves the technical problem that the configuration monitoring method in the prior art cannot realize the cross-language universality.
In the embodiment of the invention, a gin framework is used for compiling the web service, the ETCD is used as the database for storing data, the web service provides configuration monitoring service for the outside, the client side and the web service side establish long connection, the service side keeps http long polling, and the requirement of each client side can be timely notified after the configuration is changed.
Specifically, after receiving a request from a client, the web server establishes a long polling policy at the web server. In order to ensure the accuracy of data monitoring, the client requests are established, then the configuration parameters transmitted by the client are compared with the configuration in the ETCD by the MD5 value, and if the MD5 values are different, the configuration value in the ETCD is directly returned to the client; if the MD5 value is the same, the request is maintained for a preset time period (for example, for 30 s), and if the configured value is changed before the time expires, the modified configured value is returned to the client as the return value of the request, as shown in fig. 2, where fig. 2 is a schematic diagram of the return of the request when the configuration is changed according to the embodiment of the present invention. After receiving the return value, the client establishes a new request again and synchronously modifies the local configuration item; if no change has occurred to the expiration. The request returns to the unchanged state, and the client establishes a new request again after receiving the return value, as shown in fig. 3, where fig. 3 is a schematic diagram of the request return when the configuration is not changed according to an embodiment of the present invention.
Example two:
fig. 4 is a schematic diagram of a system for implementing configuration monitoring based on an etc. according to an embodiment of the present invention, where the system is applied to a web server. As shown in fig. 4, the system includes: a first setup module 10, a second setup module 20 and a listening module 30.
Specifically, the first establishing module 10 is configured to establish a long connection with a target client, and store initial configuration information of the target client in the etc d of the web server.
And a second establishing module 20, configured to establish a long polling policy after receiving the configuration monitoring request of the target client.
And the monitoring module 30 is configured to monitor the configuration of the target client based on the initial configuration information and the long polling policy.
The invention provides a system for realizing configuration monitoring based on ETCD (electronic toll collection), which can realize cross-language universality in an http (hyper text transport protocol) mode, is small in modification on a client side, is more convenient and fast, and solves the technical problem that a configuration monitoring method in the prior art cannot realize the cross-language universality.
Optionally, fig. 5 is a schematic diagram of a listening module according to an embodiment of the present invention. As shown in fig. 5, the listening module 30 includes: a listening unit 31 and a judging unit 32.
Specifically, the monitoring unit 31 is configured to monitor a configuration request of a target client based on a long polling policy; the configuration request includes current configuration information for the target client.
A determining unit 32, configured to determine whether the current configuration information is the same as the initial configuration information in response to the configuration request of the target client; and if not, returning the initial configuration information to the target client.
Optionally, the determining unit 32 is further configured to: and judging whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
Optionally, the determining unit 32 is further configured to: responding to a configuration request of a target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period; judging whether the initial configuration information changes within a preset time period; if so, returning the changed configuration information to the target client.
The embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the steps of the method in the first embodiment are implemented.
Embodiments of the present invention further provide a computer-readable medium having a non-volatile program code executable by a processor, where the program code causes the processor to execute the method in the first embodiment.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for realizing configuration monitoring based on ETCD is characterized in that the method is applied to a web server; the method comprises the following steps:
establishing long connection with a target client, and storing initial configuration information of the target client in an ETCD (electronic toll collection) of the web server;
after receiving a configuration monitoring request of a target client, establishing a long polling strategy;
and carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy.
2. The method according to claim 1, wherein performing configuration listening to the target client based on the initial configuration information in the ETCD and the long polling policy comprises:
monitoring a configuration request of the target client based on the long polling strategy; the configuration request comprises current configuration information of the target client;
responding to a configuration request of the target client, and judging whether the current configuration information is the same as the initial configuration information; and if the initial configuration information is different, returning the initial configuration information to the target client.
3. The method of claim 2, wherein determining whether the current configuration information is the same as the initial configuration information comprises: and judging whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
4. The method of claim 2, further comprising:
responding to a configuration request of the target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period;
judging whether the initial configuration information changes within the preset time period; if so, returning the changed configuration information to the target client.
5. A system for realizing configuration monitoring based on ETCD is characterized by being applied to a web server; the method comprises the following steps: the system comprises a first establishing module, a second establishing module and a monitoring module; wherein, the first and the second end of the pipe are connected with each other,
the first establishing module is used for establishing long connection with a target client and storing initial configuration information of the target client in an ETCD (electronic toll collection) of the web server;
the second establishing module is used for establishing a long polling strategy after receiving a configuration monitoring request of a target client;
and the monitoring module is used for carrying out configuration monitoring on the target client based on the initial configuration information and the long polling strategy.
6. The system of claim 5, wherein the listening module comprises: a monitoring unit and a judging unit; wherein the content of the first and second substances,
the monitoring unit is used for monitoring the configuration request of the target client based on the long polling strategy; the configuration request comprises current configuration information of the target client;
the judging unit is configured to respond to a configuration request of the target client, and judge whether the current configuration information is the same as the initial configuration information; and if the initial configuration information is different, returning the initial configuration information to the target client.
7. The system of claim 6, wherein the determining unit is further configured to: and judging whether the MD5 value of the current configuration information is the same as the MD5 value of the initial configuration information.
8. The system according to claim 6, wherein the determining unit is further configured to:
responding to a configuration request of the target client, and if the current configuration information is judged to be the same as the initial configuration information, keeping the configuration request for a preset time period;
judging whether the initial configuration information changes within the preset time period; if so, returning the changed configuration information to the target client.
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 implements the steps of the method of any of the preceding claims 1 to 4 when executing the computer program.
10. A computer-readable medium having non-volatile program code executable by a processor, wherein the program code causes the processor to perform the method of any of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210962029.2A CN115333940A (en) | 2022-08-11 | 2022-08-11 | Method and system for realizing configuration monitoring based on ETCD |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210962029.2A CN115333940A (en) | 2022-08-11 | 2022-08-11 | Method and system for realizing configuration monitoring based on ETCD |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115333940A true CN115333940A (en) | 2022-11-11 |
Family
ID=83921231
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210962029.2A Pending CN115333940A (en) | 2022-08-11 | 2022-08-11 | Method and system for realizing configuration monitoring based on ETCD |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115333940A (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107947960A (en) * | 2017-10-13 | 2018-04-20 | 用友网络科技股份有限公司 | The method for pushing and system of configuration information, the method for reseptance and system of configuration information |
CN108696374A (en) * | 2017-04-10 | 2018-10-23 | 北京京东尚科信息技术有限公司 | Update the method and apparatus of client configuration |
CN113037834A (en) * | 2021-03-05 | 2021-06-25 | 中国工商银行股份有限公司 | Web page state updating method and device based on distributed instant push |
CN114584573A (en) * | 2022-03-31 | 2022-06-03 | 深圳市瑞云科技有限公司 | Node machine information synchronization method based on long polling mechanism |
-
2022
- 2022-08-11 CN CN202210962029.2A patent/CN115333940A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108696374A (en) * | 2017-04-10 | 2018-10-23 | 北京京东尚科信息技术有限公司 | Update the method and apparatus of client configuration |
CN107947960A (en) * | 2017-10-13 | 2018-04-20 | 用友网络科技股份有限公司 | The method for pushing and system of configuration information, the method for reseptance and system of configuration information |
CN113037834A (en) * | 2021-03-05 | 2021-06-25 | 中国工商银行股份有限公司 | Web page state updating method and device based on distributed instant push |
CN114584573A (en) * | 2022-03-31 | 2022-06-03 | 深圳市瑞云科技有限公司 | Node machine information synchronization method based on long polling mechanism |
Non-Patent Citations (3)
Title |
---|
朱荣鑫,刘峰: "ETCD工作笔记 架构分析、优化与最佳实践", vol. 1, 31 October 2021, 上海交通大学出版社, pages: 310 - 350 * |
钱良等: "无线通信新技术与实践", vol. 1, 上海交通大学出版社, pages: 349 - 350 * |
顽石: "etcd事件监听", pages 1 - 5, Retrieved from the Internet <URL:https://www.iteye.com/blog/wanshi-2246352> * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110263275B (en) | Method and device for accessing webpage, mobile terminal and storage medium | |
RU2453911C2 (en) | Offline execution of web based applications | |
WO2015074467A1 (en) | Data update method, apparatus, and system and storage medium | |
EP2806357A1 (en) | Method and communication device for updating a web application | |
US10257110B2 (en) | Using a template to update a stack of resources | |
US10425502B2 (en) | System and method for acquiring, processing and updating global information | |
KR20190044134A (en) | Website access method, apparatus, and website system | |
US20120131101A1 (en) | Cloud-Processing Management With A Landscape Directory | |
CN103942225A (en) | Method and system for invoking resources of Hybrid App client and client | |
CN103139279A (en) | File access method and system | |
KR20050084820A (en) | Method and apparatus for publishing and monitoring entities providing services in a distributed data processing system | |
US9529578B2 (en) | Automated service version upgrading | |
CN113407383B (en) | Main and standby system switching method and device, server and main and standby system | |
CN109936605B (en) | Method and device for loading interface data | |
CN113835836B (en) | System, method, computer device and medium for dynamic publishing container service | |
CN108989471A (en) | The management method and device of log in network system | |
EP3528474B1 (en) | Webpage advertisement anti-shielding methods and content distribution network | |
CN115333940A (en) | Method and system for realizing configuration monitoring based on ETCD | |
CN111131528B (en) | Equipment network domain determining method, server and terminal | |
CN111512612A (en) | Method for remote management of devices connected to a residential gateway | |
CN111339736B (en) | Method for adding prefix name, configuration acquisition method, device and electronic equipment | |
CN113407504B (en) | Data processing method, user space file system and storage medium | |
CN110740048B (en) | Network request processing method and device based on iOS network | |
CN112256646A (en) | Method and device for operating subdirectory of file system, electronic equipment and storage medium | |
CN112527637A (en) | Data management method, device, server and storage 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 |