CN117675899A - Proxy service system, message forwarding method, electronic device, and storage medium - Google Patents

Proxy service system, message forwarding method, electronic device, and storage medium Download PDF

Info

Publication number
CN117675899A
CN117675899A CN202311340708.7A CN202311340708A CN117675899A CN 117675899 A CN117675899 A CN 117675899A CN 202311340708 A CN202311340708 A CN 202311340708A CN 117675899 A CN117675899 A CN 117675899A
Authority
CN
China
Prior art keywords
service
target
message
proxy
target service
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
CN202311340708.7A
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.)
Beijing Qingyun Science And Technology Co ltd
Original Assignee
Beijing Qingyun Science And Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Qingyun Science And Technology Co ltd filed Critical Beijing Qingyun Science And Technology Co ltd
Priority to CN202311340708.7A priority Critical patent/CN117675899A/en
Publication of CN117675899A publication Critical patent/CN117675899A/en
Pending legal-status Critical Current

Links

Landscapes

  • Computer And Data Communications (AREA)

Abstract

The invention discloses a proxy service system, a message forwarding method, electronic equipment and a storage medium, wherein the system comprises the following components: the agent deployment module is used for configuring agent services for each region according to a preset configuration file; the service discovery module is used for inquiring target service information according to the proxy service; and the message forwarding module is used for forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format and feeding back the reply message after the target service processes the request message to the requester. The target service for automatically forwarding the request message of the requester to the target area is realized through the proxy service configured in each area, and all configuration work of the proxy service can be maintained through a unified preset configuration file, so that the deployment efficiency and the automation degree of the proxy service are improved; the service discovery module can automatically and quickly find the target service information, and improves the development efficiency of the collaboration function between the cross-region services.

Description

Proxy service system, message forwarding method, electronic device, and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a proxy service system, a message forwarding method, an electronic device, and a storage medium.
Background
Cloud platforms have a number of basic services, including virtual resource scheduling systems, billing services, cloud management services, and the like, that require a message channel to establish message communication between "zones" and "cross zones".
In the prior art, for message communication between different services (regions or cross regions) of a cloud platform, a "fixed configuration TCP/IP proxy service" is often adopted for forwarding, that is, which services need to communicate with each other, the forwarding ports are correspondingly and one-to-one configured, or one-to-one subscribed and long connection is established, and if necessary, a network access control policy (such as a black-and-white list) is released. The message forwarding mode has the following defects:
(1) Deployment efficiency is low. Under the conditions of multi-area and multi-service deployment requirements, a great deal of manpower and time are required to be spent for configuration work, for example, M areas zones are provided, N services are required to be deployed in each area, namely, N configurations are required to be carried out in each area, at least M is required to be required in total, and the configuration quantity is very large;
(2) The degree of automation is low. When new products are online, namely new services, manual intervention is needed for configuration work, a large amount of configuration work is needed when the number of zones is large, the operation and maintenance efficiency is low, and the error rate is high;
(3) Development efficiency is low and standardization is difficult. The collaboration function between the cross-zone services is difficult to realize, is easy to make mistakes, and can not transmit the request to the cross-zone target service in an automatic discovery mode.
Disclosure of Invention
The invention provides a proxy service system, a message forwarding method, electronic equipment and a storage medium, which are used for solving the problems of low deployment efficiency, low automation degree and low development efficiency in the existing message forwarding method, wherein a proxy deployment module is used for configuring proxy services for all areas according to preset configuration files, and a service discovery module and a message forwarding module are used for realizing target services for automatically forwarding request messages of a requester to target areas, and all configuration works of the proxy services can be maintained through one unified preset configuration file, so that the deployment efficiency and the automation degree of the proxy services are improved; meanwhile, the service automatic discovery mechanism of the service discovery module is utilized to automatically and rapidly find the target service information, so that the development efficiency of the collaboration function between the cross-region services is improved, a large amount of configuration work is reduced, and the message forwarding capability is more accurate and reliable.
According to an aspect of the present invention, there is provided a proxy service system, the system comprising:
the agent deployment module is used for configuring agent services for each region according to a preset configuration file;
the service discovery module is used for inquiring target service information according to the proxy service;
and the message forwarding module is used for forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format and feeding back the reply message after the target service processes the request message to the requester.
According to another aspect of the present invention, there is provided a message forwarding method applied to a proxy service system, the method comprising:
receiving a request message sent by a requesting party, and analyzing a target service name and a target area from the request message;
determining proxy service of the area where the target service is located according to the target area;
and forwarding the request message to the target service according to the proxy service, and feeding back a reply message after the target service processes the request message to the requester.
According to another aspect of the present invention, there is provided a message forwarding apparatus applied to a proxy service system, the apparatus comprising:
the service analysis module is used for receiving the request message sent by the requesting party and analyzing the target service name and the target area from the request message;
The proxy service determining module is used for determining the proxy service of the area where the target service is located according to the target area;
and the message forwarding module is used for forwarding the request message to the target service according to the proxy service and feeding back a reply message after the target service processes the request message to the requester.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the message forwarding method according to any one of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement a message forwarding method according to any of the embodiments of the present invention when executed.
The proxy service system provided by the embodiment of the invention comprises: the agent deployment module is used for configuring agent services for each region according to a preset configuration file; the service discovery module is used for inquiring target service information according to the proxy service; and the message forwarding module is used for forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format and feeding back the reply message after the target service processes the request message to the requester. The agent deployment module is used for configuring agent services for each region according to the preset configuration file, and the service discovery module and the message forwarding module are used for realizing the purpose of automatically forwarding the request message of the requester to the target service of the target region, so that all configuration work of the agent services can be maintained through one unified preset configuration file, and the deployment efficiency and the automation degree of the agent services are improved; meanwhile, the service automatic discovery mechanism of the service discovery module is utilized to automatically and rapidly find the target service information, so that the development efficiency of the collaboration function between the cross-region services is improved, a large amount of configuration work is reduced, and the message forwarding capability is more accurate and reliable.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a diagram showing an exemplary configuration of a proxy service system according to a first embodiment of the present invention;
fig. 2 is an exemplary diagram of a TRP port configuration provided in accordance with one embodiment of the present invention;
FIG. 3 is a diagram illustrating an exemplary content of a preset configuration file according to a first embodiment of the present invention;
FIG. 4 is an exemplary diagram of a service information synchronization provided in accordance with a first embodiment of the present invention;
fig. 5 is an exemplary diagram of a TRP service architecture provided in accordance with one embodiment of the present invention;
fig. 6 is an exemplary diagram of an existing cloud platform port forwarding configuration according to a first embodiment of the present invention;
Fig. 7 is a flowchart of a message forwarding method according to a second embodiment of the present invention;
fig. 8 is a schematic structural diagram of a message forwarding device according to a third embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device implementing a message forwarding method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, 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.
Example 1
Fig. 1 is a diagram illustrating a structure of a proxy service system according to an embodiment of the present invention, as shown in fig. 1, the system includes: proxy deployment module 110, service discovery module 120, and message forwarding module 130. The following describes the structural composition of the proxy service system of the present embodiment in detail.
The agent deployment module 110 is configured to configure agent services for each area according to a preset configuration file.
The proxy service may refer to a medium designed for each area in the embodiment of the present invention to implement message forwarding between the areas and the cross-areas, and in the embodiment of the present invention, the proxy service may be represented by a cross-area service proxy (Transregional Proxy, TRP). The zone may generally refer to a distinction between physical locations (available area, machine room, etc.), and under certain conditions, a plurality of logical areas may also be divided in the same machine room, which is not limited by the embodiment of the present invention. One or more cloud base services may be included in the area, which may refer to some of the base services of management, scheduling, etc. of the cloud platform configuration.
The preset configuration file may be a configuration file configured in advance for each proxy service and including configuration information of all areas, the proxy service deployed in each area may be enabled to know service information configured in each area by using the preset configuration file, the preset configuration file includes configuration information in aspects of an internet protocol (Internet Protocol, IP) address, a communication protocol, a monitoring port, and the like of each area, the monitoring port is used for receiving a message, and the monitoring port may include a common TCP/UDP monitoring port and the like.
Specifically, the agent deployment module 110 may synchronously deploy the configuration information to TRP service nodes (nodes with deployed TRP services that are externally accessed in each area) of each area according to a preset configuration file that is preconfigured and contains configuration information such as an IP address, a communication protocol, a port, etc. of each area, so that the TRP service of each area can know the information such as the IP address, the communication protocol, the monitoring port, etc. of each area, and then the request can be forwarded by using the TRP service configured by each area.
The service discovery module 120 is configured to query the target service information according to the proxy service.
The target service information may refer to service information corresponding to a target service (cloud base service), and the target service information may include, but is not limited to, service name, IP address, protocol, listening port, and the like of the target service.
Specifically, the service discovery module 120 needs to have an auto discovery function as a precondition of request forwarding, so that the TRP service can automatically and quickly find the target service information, and exemplary ways of querying the target service information according to the proxy service may include, but are not limited to, the following ways: target service information corresponding to target service can be searched by calling a service query interface provided by TRP service; inquiring the domain name of the target service according to the agreed domain name resolution rule to further obtain the IP address of the target service, and searching the corresponding protocol and port in the preset configuration file according to the IP address to obtain the target service information corresponding to the target service; some middleware services (such as open source software ETCD, zooKeeper) configured by the cloud platform can be combined with the service name of the target service to discover service information. In summary, the service discovery mechanism of the service discovery module is performed in a same zone, and the module can support multiple methods to discover the target service information of the target service, and the service discovery mechanism can be customized to realize a plurality of request forwarding scenes, so that the target service information can be automatically and quickly found.
The message forwarding module 130 is configured to forward the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format, and feed back the reply message after the target service processes the request message to the requester.
The message transmission protocol may include, but is not limited to, text or binary transmission protocols based on TCP, such as hypertext transmission protocol (Hypertext Transfer Protocol, HTTP), zeroMQ (ZMQ), etc., which may be specifically set according to actual service requirements, which is not limited by the embodiment of the present invention. The message formats may be used to normalize the formats of the request and return of the message, which may include a message request format and a message return format.
Specifically, the TRP service may be invoked by the message forwarding module 130 to parse the request message of the requester to obtain the target service information, and further forward the request message of the requester to the target service of the target area according to the agreed message transmission protocol and the message format, and after the target service processes the request message, feed back the corresponding reply message to the requester.
The proxy service system provided by the embodiment of the invention comprises: the agent deployment module is used for configuring agent services for each region according to a preset configuration file; the service discovery module is used for inquiring target service information according to the proxy service; and the message forwarding module is used for forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format and feeding back the reply message after the target service processes the request message to the requester. The agent deployment module is used for configuring agent services for each region according to the preset configuration file, and the service discovery module and the message forwarding module are used for realizing the purpose of automatically forwarding the request message of the requester to the target service of the target region, so that all configuration work of the agent services can be maintained through one unified preset configuration file, and the deployment efficiency and the automation degree of the agent services are improved; meanwhile, the service automatic discovery mechanism of the service discovery module is utilized to automatically and rapidly find the target service information, so that the development efficiency of the collaboration function between the cross-region services is improved, a large amount of configuration work is reduced, and the message forwarding capability is more accurate and reliable.
Further, on the basis of the above embodiment of the present invention, in the agent deployment module 110, the agent service is configured for each area according to a preset configuration file, including the following steps:
and controlling the external access nodes of each area to install proxy service software, and configuring the corresponding monitored internet protocol address, protocol and port for the proxy service of each area according to a preset configuration file.
Specifically, because the access between the cross-regions needs to know the information such as the IP addresses, protocols, ports and the like of the two parties, the operation and maintenance personnel can pre-configure a configuration file containing the service information of all the regions; next, the proxy deployment module 110 may control the external access node (host) of each area to install proxy service software, i.e. TRP service software, which automatically reads and configures the IP address, protocol and port corresponding to the monitoring from the preset configuration file after being started.
As shown in FIG. 2, each zone has two hosts accessing from outside, and a unified listening protocol and a tcp 7000 (which can be configured according to actual service requirements) are agreed at the same time, wherein TRP1 and TRP2 represent proxy services. Illustratively, if the message transmission protocol used is http, the unified address configuration information may be as follows:
TRP1 TRP2
zone1 http://1.1.1.1:7000 http://1.1.1.2:7000
zone2 http://1.1.2.1:7000 http://1.1.2.2:7000
zone3 http://1.1.3.1:7000 http://1.1.3.2:7000
FIG. 3 is a diagram illustrating an exemplary content of a default configuration file according to an embodiment of the present invention, where default means default configuration information, and configuration items that are not available to individual zones are read from the default as shown in FIG. 3.
It can be seen that, no matter how many services are provided, the configuration quantity is always (zone number is equal to TRP host number), and the configuration information can be maintained by increasing or decreasing configuration and issuing synchronous configuration information through a unified preset configuration file, so that the deployment efficiency and the automation degree of proxy service are improved.
When the TRP service software is installed, the configuration information in the preset configuration file is read, for example, when the TRP service software is installed by zone1.TRP1, after the TRP service is operated, the program automatically reads the configuration content of http://1.1.1.1:7000, the program knows the protocol to be monitored, the ports are http and 7000, the monitored IP address can be 0.0.0.0 (full address monitoring) or 1.1.1.1, and the IP address can be configured correspondingly according to the actual service requirement.
The agent deployment module 110 of the scheme can make operation and maintenance work very simple and efficient, can easily realize automatic deployment and operation and maintenance, and greatly improves the operation and maintenance accuracy of the cloud platform, thereby improving the stability of the cloud platform.
Further, on the basis of the above embodiment of the present invention, in the service discovery module 120, the target service information is queried according to the proxy service, including at least one of the following:
searching target service information in a service information summary file corresponding to the proxy service;
calling proxy service to resolve the internet protocol address of the domain name corresponding to the target service according to a first preset domain name rule, and searching a corresponding protocol and port in a preset configuration file according to the internet protocol address;
calling proxy service to search character keywords corresponding to target service in a preset configuration file, resolving Internet protocol addresses corresponding to the character keywords according to a second preset domain name rule in a preset Hosts configuration file, and searching corresponding protocols and ports in the preset configuration file according to the Internet protocol addresses, wherein the preset Hosts configuration file stores association relations among the character keywords, domain names and Internet protocol addresses corresponding to cloud base services.
The service information summary file may be a file configured for each proxy service, that is, TRP service, and including all service information, where service information in the service information summary file may be actively reported by each cloud base service, or an operation and maintenance personnel may obtain the service information according to an actual service requirement. It can be understood that, regarding the expression form of all service information stored in each proxy service, the expression form may be one service information summary file configured by each proxy, or one variable recorded in a memory, which is service information managed by itself in a program running state.
The first preset domain name rule may be understood as a domain name resolution rule preconfigured on the premise that the domain name server needs to be deployed and maintained, and the IP address of the target service is found through the domain name by means of the additional domain name service. The second preset domain name rule may be understood as a domain name resolution rule preconfigured without deploying and maintaining a domain name server, and the IP address of the target service is found by means of a role keyword corresponding to the target service and a preset Hosts configuration file.
The role key (node_role) may refer to a role name corresponding to a node (cloud base service and TRP service), for example, the role key corresponding to the cloud base service may be webservice, the role key corresponding to the TRP service may be proxy, and the like. The preset Hosts configuration file can be understood as a preset Linux/etc/Hosts configuration file, and the preset Hosts configuration file stores the association relationship of the role keywords, the domain names and the IP addresses corresponding to each cloud basic service.
Specifically, the service discovery mechanism in the service discovery module 120 is performed in a same zone, and the module can support multiple methods to discover the target service information of the target service, and the specific implementation manner is as follows:
(1) Searching corresponding target service information according to the service name of the target service in a service information summary file corresponding to the TRP service;
(2) invoking TRP service to resolve the IP address of the domain name corresponding to the target service according to the first preset domain name rule, searching the corresponding protocol and port in the preset configuration file according to the IP address, realizing the function, registering the domain name of each cloud basic service to a domain name server, invoking the TRP service to inquire the domain name of the target service according to the first preset domain name rule agreed in advance, and further obtaining the IP address of the target service, wherein, referring to fig. 3, the service name (server_name) of the cloud basic service S1 is S1, the agreed domain name rule in the internal management network can be { zone_name } { server_name }. Mgmt.local, then the corresponding domain name can be zone1.s1.mgmt.local, and the required target service information can be obtained by combining the protocol and port in the preset configuration file after resolving the IP address;
(3) calling TRP service to search character keywords corresponding to target service in preset configuration file, resolving IP address corresponding to character keywords in preset Hosts configuration file according to second preset domain name rule, searching corresponding protocol and port in preset configuration file according to IP address, realizing the function without participation of domain name server, directly implementing resolution of local domain name through self-contained Hosts information of operating system, specifically, configuring and storing corresponding relation between domain name and IP address of each service character in Hosts by standard deployment of cloud platform, for example, reading character keywords of target service in preset configuration file according to second preset domain name rule of Linux, querying local Hosts according to second preset domain name rule of convention to obtain IP address corresponding to target service, referring to FIG. 3, service name of cloud base service S1 is S1, role name is bypass, domain name rule in internal management network can be { server_native, local domain name or local domain name of the protocol in the cloud platform is mapped to be mapped to local domain name 1, and then local domain name of the local domain name is obtained after the local domain name is mapped to the local domain name 1.
Further, on the basis of the above embodiment of the present invention, an implementation manner of the service discovery mechanism may further include:
(4) each cloud basic service can search the corresponding service information by calling a query interface of the TRP service, the TRP service records various cloud basic service information of each region, and the TRP service provides an opening type interface so that the cloud basic service can query the service information;
(5) some middleware services (such as open source software ETCD, zooKeeper) configured through the cloud platform can be combined with service names of target services to discover service information, and some cloud base services can be connected to the middleware services when being online, so that service information can be discovered through the middleware services, which belongs to the prior art, and therefore details are not repeated here.
The use of service information is mainly done around the following scenarios:
1) Cloud-based service to discover TRP services of zone where it is located
This behavior is actively initiated by the cloud base service, which can read the preset configuration content, see fig. 3, and supposing that s1 of zone1 is to find the TRP service of the zone, the protocol of the TRP service read from the preset configuration file to zone1 is http, port is 7000, management address (mgmt_ip_addrs) is 192.168.1.1 and 192.168.1.2, and a service reachable address is found randomly, wherein the service reachable address can be determined by means of port detection and the like. If s1 of zone2 is to search for TRP service in the local area, there is no corresponding management address mgmt_ip_addrs in the configuration content in the preset configuration file, and at this time, the TRP service with node_role being proxy may be searched by the method (3) in the service discovery method.
2) TRP service to discover cloud base service of zone
The cloud base service can be found by the means (1), (2), (3) and (5) in the service discovery method described above.
By the service discovery method, the service can be automatically discovered, a large amount of configuration work can be reduced, and the message forwarding capability can be more accurate and reliable.
Further, on the basis of the above embodiment of the present invention, in the message forwarding module 130, forwarding, according to the agreed message transmission protocol and message format, the request message of the requester to the target service of the target area, and feeding back, to the requester, the reply message after the target service processes the request message, includes:
A. the control request party sends the request message to the proxy service of the local area according to the message request format of the message transmission protocol and the message format;
B. calling proxy service to analyze the name and the target area of the target service from the request message;
C. when the target area is the local area, calling the proxy service to search target service information corresponding to the target service in a service information summary file configured by the proxy service according to the name of the target service, forwarding a request message to the target service according to a message transmission protocol and the target service information, and feeding back a reply message processed by the target service to a requester according to a message return format of the message transmission protocol and the message format;
D. When the target area is not the local area, the proxy service of the local area is called to search target proxy service information corresponding to the target area in a preset configuration file, request information is forwarded to target proxy service of the target area according to the target proxy service information, the target proxy service is called to search target service information corresponding to the target service in a service information summary file configured by the target proxy service according to a target service name, the request information is forwarded to the target service according to a message transmission protocol and the target service information, and a reply message processed by the target service is fed back to a request party according to a message return format of the message transmission protocol and a message format.
Specifically, the requesting party only needs to provide the name and the target area of the target service, package the request message according to the agreed message transmission protocol and message format and send the request message to the TRP service, and the TRP service can automatically forward the request message to the target service. The general procedure of message forwarding is as follows: when the TRP service receives a request message of a requester, resolving a target service name and a target area from the request message, if the target area is the area, searching target service information corresponding to the target service in a service information summary file configured by the TRP service, and sending the request message to the target service; if the target area is not the local area, searching target TRP service information corresponding to the target area in a preset configuration file, sending a request message to target TRP service of the target area, and forwarding the request message to the target service by the target TRP service; after the target service processes the request message, the corresponding reply message is fed back to the requester according to the message transmission protocol and the message return format of the message format.
The message formats may include a message request format and a message return format, which may be agreed upon as follows, by way of example:
wherein, in the message request format: action is the action name of the TRP service, and the message forwarding of the service is fixed to one name; server_name is the name of the target service; zone_id is the target area and request is the request message content;
message return format: the zone_id expression request message gets a reply from this zone; ret_code is a return number, different numbers representing different meanings, e.g., 0 expressed normally, 4040 expressed no service found, etc.; response is the reply message content returned by the target service.
Further, on the basis of the above embodiment of the present invention, the proxy service system further includes: the service registration module is used for providing a registration interface for the proxy service, wherein the registration interface provides service information uploaded by each cloud base service and the user for the proxy service, and the service information is stored in the service information summary file.
In the embodiment of the invention, in order to expand the service information source channel recorded by the TRP service, the proxy service system can also comprise a service registration module, and the modes of registering cloud basic service information include the following modes:
(1) Cloud base service actively reports service information to TRP service
The cloud basic service needs to report service information (service name, IP address, protocol, port and the like) to the TRP service according to a standard method provided by the TRP service, so that the TRP service can centrally manage and record the service information of the cloud basic service;
(2) human intervention registration service information to TRP service
The TRP service also provides an open internal interface, so that system management personnel such as development/operation and maintenance can register required cloud basic service information according to actual service requirements.
The method for actively reporting the service information through the outside provided by the service registration module greatly expands the service information source channel recorded by the TRP service and can provide a data information basis for supporting functions such as service discovery, message forwarding and the like.
Further, on the basis of the above embodiment of the present invention, the proxy service system further includes: and the service information synchronization module is used for configuring the proxy service clusters of the areas and synchronizing the service information among the proxy services of the areas.
In the embodiment of the present invention, as shown in fig. 4, a plurality of TRP services may be deployed as a distributed TRP cluster in the same zone, thereby providing load balancing, high availability, and other capabilities. Messages may be dispersed across multiple TRP services to achieve load balancing to improve service performance and stability. When some TRP service is in abnormal disaster conditions such as downtime, zombies and the like, other TRP services can still normally provide services. There may be two roles of primary and secondary in one TRP cluster, where the method for electing TRP service of primary role may be: the corresponding TRP service with the minimum IP address character string comparison in the cluster is directly used as a primary role, and meanwhile, multiple primary roles are allowed to exist under the condition of some anomalies, so that the normal operation of the service is not influenced.
The service information synchronization module has the following two synchronization modes:
(1) the TRP service of the secondary role actively synchronizes service information to the TRP service of the primary role of the local area: when the TRP cluster is started, the TRP service of the primary role discovers service information according to preset configuration information, wherein some service information is actively reported to the TRP service of the secondary role, and meanwhile, the TRP service can periodically synchronize the service information to the TRP service of the secondary role;
(2) the primary role TRP service actively synchronizes service information to the TRP service of the home zone/other zone: the primary role TRP service periodically synchronizes service information to all other TRP services of the home zone and to one TRP service of each of the other zones.
For example, referring to fig. 4, TRP1 of zone1 is the primary role and TRP2 is the secondary role; zone1.trp1 found the service information of S1 and S2, zone1.trp2 found the service information of S3. The service information synchronization manner may be as follows:
zone1.trp1 would inform zone1.TRP2, zone1.TRP2 of S1 and S2 service information and would inform zone1.trp1 of S3 service information;
TRP1 informs zone2 of random one TRP service of zone1 service information, if reported to zone2 TRP1, it is a secondary role, periodically synchronizes information to TRP service of primary role in zone2, and then it continues to synchronize zone1 service information to zone2 TRP2;
TRP2 of zone2 is a primary role which informs zone1 of a random one TRP service of zone2 service information, if zone1.TRP2, zone1.TRP2 is reported as a secondary role, periodically synchronizes service information to TRP service of primary role in zone1, and then it continues to synchronize service information of zone2 to zone1.TRP1.
With the service information synchronization module, each TRP service information in the present zone will be in a substantially aligned state, while the TRP service in one zone can also know the service information situation of other zones.
Further, on the basis of the above embodiment of the present invention, the proxy service system further includes: and the message fusing module is used for configuring a timeout waiting mechanism, a target service unreachable mechanism and a survival counting mechanism for the request message.
In the embodiment of the invention, the proxy service system can also comprise a message fusing module, wherein the message fusing module comprises the following mechanisms:
(1) timeout waiting mechanism
Most of the purposes of the embodiments of the present invention are to process short-time connection messages, so that the normal total execution time of a message can be set, for example, to not more than 60 seconds (specifically, to be set according to the actual scenario), and the circulation of a message between nodes can have different timeout time settings.
Fig. 5 is an exemplary diagram of a TRP service architecture according to an embodiment of the present invention. As shown in fig. 5, S1, S2, and S3 respectively represent cloud infrastructure services, where zone1.s1 is to access zone2.s1, and the corresponding message paths are: zone1.s1-zone1.trp1-zone2.trp1-zone2.s1, the corresponding timeout waiting mechanism may be set as follows: when zone1.s1 initiates a message to zone2.s1, default message timeout time is 60 seconds, and no waiting is performed after timeout; between zone1.s1 and zone1.trp1, the message timeout time can be set to 5 seconds, and the fault is reported when the timeout occurs; between zone1.Trp1 and zone2.Trp1, the message timeout time can be set to 30 seconds, and the error is reported when the timeout occurs; between zone2.trp1 and zone2.s1, the message timeout time may be set to 5 seconds, and the timeout is false.
The message timeout can be set according to the principle that the timeout time between service nodes in the areas is shorter and the timeout time between service nodes between the cross areas is longer.
By the timeout waiting mechanism, long connections can be eliminated or reduced, the timeout connection is interrupted in real time, resources are released, and waiting time of problem messages is reduced.
(2) Target service unreachable mechanism
I.e. when the target service cannot be found or detected as unreachable, an error can be returned directly. For example, referring to fig. 5, zone1.s2 is to access zone2.s3, the corresponding message path traversed is: zone1.S2-zone1.TRP1-zone2.TRP2-zone2.S3. This middle would involve multiple nodes, which would all return an error directly when zone1.s2 detected no TRP service for zone1 available, or when zone1.trp1 detected zone2 was not available, or when zone2.trp2 detected no zone2.s3 was available.
Through the target service unreachable mechanism, when the target service is not available, an error is returned immediately, so that the time for waiting overtime can be saved, and the resources are released immediately.
(3) Survival counting mechanism
The technical scheme of the invention is to realize the message forwarding by using the TRP service, wherein some dead loop situations can occur, or the message forwarding can be caused to pass through an invalid long-chain path due to programming errors, such as the usage of message nesting. The occurrence of the above situation can be avoided by using the survival counting mechanism. When the initial message is sent, the system defaults to configuring a survival count value (for example, default value is 3) for the message, the count value is reduced by 1 every time the message is forwarded through the TRP service, and when the value is reduced to 0, an error is directly returned. Illustratively, zone1.s3 is to access S2 of zone3, corresponding to the message path traversed: zone1.S3-zone1.TRP2-zone3.TRP1-zone3.S2. When a message is sent out by zone1.s3, the survival count value is set to 3, after zone1.trp2 receives the message, the count value is reduced by 1 to 2, and after zone3.trp1 receives the message, the count value is reduced by 1 to 1.
Referring to fig. 6, in the prior art, communication between the cross-area services of the cloud platform generally adopts a "TCP/IP proxy service with fixed configuration" to forward messages, that is, which services need to communicate with each other, and the ports for forwarding are correspondingly and one-to-one configured, for example, the means of forwarding network address translation (Network Address Translation, NAT) configured by using the open source software Haproxy or iptables of Linux. S1, S2, S3 in fig. 6 are cloud base services, and Proxy1, proxy2 represent Proxy services for external access. To implement cross-domain communication between cloud-based services, a one-to-one forwarding port for each service needs to be configured on proxy.
The above configuration method has the following disadvantages:
(1) deployment efficiency is low. When there is a requirement for multi-area and multi-service deployment, a lot of manpower/time is required to do configuration work, for example, M zones are required to deploy N services in each zone, N configurations are required in each zone, at least m×n configurations are required in total, and the configuration quantity is very large;
(2) the degree of automation is low. When new products are online, namely new services, manual intervention is needed for configuration work, a large amount of configuration work is needed when the number of zones is large, the operation and maintenance efficiency is low, and the error rate is high;
(3) development efficiency is low and standardization is difficult. The collaboration function between the cross-regional services is difficult to realize, is easy to make mistakes, can not transmit the request to the cross-regional target service in an automatic discovery mode, and can only distinguish the target service of the target region through a fixed configuration list according to service dimension;
(4) all cloud base services in the area must develop related components to support connection to the cluster management service (e.g. etcd/zookeeper), and must establish long connection with these services, when the number of cloud base services is particularly large, the load of the cluster management service will increase, the connection number may be insufficient, and unstable phenomenon is very easy to occur.
Comparing the configuration example of the TRP service listening ports of each zone provided in the embodiment of the present invention in fig. 2, it is easy to see that the port configuration method in fig. 2 is simpler and more efficient than that in fig. 6 in the prior art.
Example two
Fig. 7 is a flowchart of a message forwarding method according to a second embodiment of the present invention, where the method may be applied to a message forwarding case, and the method may be performed by a message forwarding device, where the message forwarding device may be implemented in hardware and/or software, and the message forwarding device may be configured in an electronic device, where the electronic device may be, for example, a computer device or a server. As shown in fig. 7, the message forwarding method provided in the second embodiment is applied to a proxy service system, and specifically includes the following steps:
s210, receiving a request message sent by a requester, and analyzing a target service name and a target area from the request message.
In the embodiment of the invention, when the TRP service receives the request message of the requester, the target service name and the target area corresponding to the target service are analyzed from the request message.
S220, determining the proxy service of the area where the target service is located according to the name of the target service and the target area.
In the embodiment of the invention, if the target area is the local area, the proxy service of the area where the target service is located and the TRP service which receives the request message are indicated to be the same; if the target area is not the local area, the TRP service can be called to search target TRP service information corresponding to the target area according to the target service name in a preset configuration file configured by the TRP service.
S230, forwarding the request message to the target service according to the proxy service, and feeding back a reply message after the target service processes the request message to the requester.
In the embodiment of the invention, the request message can be forwarded to the target service by calling the TRP service of the area where the target service is located, and the corresponding reply message is fed back to the requester after the target service processes the request message.
According to the technical scheme, the request message sent by the requesting party is received, the target service name and the target area are analyzed from the request message, the proxy service of the area where the target service is located is determined according to the target service name and the target area, the request message is forwarded to the target service according to the proxy service, and the reply message after the request message is processed by the target service is fed back to the requesting party. According to the embodiment of the invention, the request message can be automatically forwarded to the corresponding target service by calling the proxy service configured in each region and according to the name of the target service and the target region, a special proxy server is not required to be deployed to construct a proxy channel, and a specific message sending and receiving device is not required to be configured by the cloud base service, so that the forwarding of messages between different cloud base services in a region and a cross region can be satisfied.
Example III
Fig. 8 is a schematic structural diagram of a message forwarding device according to a third embodiment of the present invention. As shown in fig. 8, the apparatus is applied to a proxy service system, and includes:
the service resolving module 31 is configured to receive a request message sent by a requester, and resolve a target service name and a target area from the request message.
The proxy service determining module 32 is configured to determine, according to the target area, a proxy service in the area where the target service is located.
The message forwarding module 33 is configured to forward the request message to the target service according to the proxy service, and feed back a reply message after the target service processes the request message to the requester.
According to the technical scheme of the embodiment of the invention, the service analysis module receives the request message sent by the request party, the proxy service determination module analyzes the target service name and the target area from the request message, determines the proxy service of the area where the target service is located according to the target service name and the target area, and the message forwarding module forwards the request message to the target service according to the proxy service and feeds back the reply message after the target service processes the request message to the request party. According to the embodiment of the invention, the request message can be automatically forwarded to the corresponding target service by calling the proxy service configured in each region and according to the name of the target service and the target region, a special proxy server is not required to be deployed to construct a proxy channel, and a specific message sending and receiving device is not required to be configured by the cloud base service, so that the forwarding of messages between different cloud base services in a region and a cross region can be satisfied.
The message forwarding device provided by the embodiment of the invention can execute the message forwarding method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 9 shows a schematic diagram of an electronic device 40 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 9, the electronic device 40 includes at least one processor 41, and a memory communicatively connected to the at least one processor 41, such as a Read Only Memory (ROM) 42, a Random Access Memory (RAM) 43, etc., in which the memory stores a computer program executable by the at least one processor, and the processor 41 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 42 or the computer program loaded from the storage unit 48 into the Random Access Memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 may also be stored. The processor 41, the ROM 12 and the RAM 43 are connected to each other via a bus 14. An input/output (I/O) interface 45 is also connected to bus 44.
Various components in electronic device 40 are connected to I/O interface 45, including: an input unit 46 such as a keyboard, a mouse, etc.; an output unit 47 such as various types of displays, speakers, and the like; a storage unit 48 such as a magnetic disk, an optical disk, or the like; and a communication unit 49 such as a network card, modem, wireless communication transceiver, etc. The communication unit 49 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks.
The processor 41 may be various general and/or special purpose processing components with processing and computing capabilities. Some examples of processor 41 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 41 performs the various methods and processes described above, such as a message forwarding method.
In some embodiments, the message forwarding method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 48. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 40 via the ROM 42 and/or the communication unit 49. When the computer program is loaded into RAM 43 and executed by processor 41, one or more steps of the message forwarding method described above may be performed. Alternatively, in other embodiments, processor 41 may be configured to perform the message forwarding method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on 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.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A proxy service system, the system comprising:
the agent deployment module is used for configuring agent services for each region according to a preset configuration file;
the service discovery module is used for inquiring target service information according to the proxy service;
and the message forwarding module is used for forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format, and feeding back the reply message after the target service processes the request message to the requester.
2. The system of claim 1, wherein the configuring the proxy service for each region according to the preset configuration file comprises:
and controlling the external access nodes of each region to install proxy service software, and configuring the corresponding monitored internet protocol address, protocol and port for the proxy service of each region according to the preset configuration file.
3. The system of claim 1, wherein the querying the target service information from the proxy service comprises at least one of:
searching the target service information in a service information summary file corresponding to the proxy service;
calling the proxy service to resolve an internet protocol address of a domain name corresponding to the target service according to a first preset domain name rule, and searching a corresponding protocol and port in the preset configuration file according to the internet protocol address;
invoking the proxy service to search a role keyword corresponding to the target service in the preset configuration file, analyzing an internet protocol address corresponding to the role keyword in the preset Hosts configuration file according to a second preset domain name rule, and searching a corresponding protocol and a port in the preset configuration file according to the internet protocol address, wherein the preset Hosts configuration file stores the association relation of the role keyword, the domain name and the internet protocol address corresponding to each cloud basic service.
4. The system of claim 1, wherein the forwarding the request message of the requester to the target service of the target area according to the agreed message transmission protocol and message format, and feeding back the reply message after the target service processes the request message to the requester, comprises:
controlling the requester to send the request message to the proxy service of the local area according to the message transmission protocol and the message request format of the message format;
calling the proxy service to analyze the target service name and the target area from the request message;
when the target area is the local area, calling the proxy service to search the target service information corresponding to the target service in a service information summary file configured by the proxy service according to the target service name, forwarding the request message to the target service according to the message transmission protocol and the target service information, and feeding back the reply message processed by the target service to the requester according to the message transmission protocol and the message return format of the message format;
when the target area is not the local area, the proxy service of the local area is called to search target proxy service information corresponding to the target area in the preset configuration file, the request message is forwarded to target proxy service of the target area according to the target proxy service information, the target proxy service is called to search the target service information corresponding to the target service in a service information summary file configured by the target proxy service according to the target service name, the request message is forwarded to the target service according to the message transmission protocol and the target service information, and the reply message processed by the target service is fed back to the request party according to the message transmission protocol and the message return format of the message format.
5. The system of claim 1, wherein the system further comprises: the service registration module is used for providing a registration interface for the proxy service, wherein the registration interface provides service information uploaded by each cloud base service and a user for the proxy service, and the service information is stored in a service information summary file.
6. The system of claim 1, wherein the system further comprises: and the service information synchronization module is used for configuring the proxy service clusters of the areas and synchronizing the service information among the proxy services of the areas.
7. The system of claim 1, wherein the system further comprises: and the message fusing module is used for configuring a timeout waiting mechanism, a target service unreachable mechanism and a survival counting mechanism for the request message.
8. A message forwarding method for use in a proxy service system, the method comprising:
receiving a request message sent by a requesting party, and analyzing a target service name and a target area from the request message;
Determining the proxy service of the area where the target service is located according to the target service name and the target area;
and forwarding the request message to a target service according to the proxy service, and feeding back a reply message after the target service processes the request message to the requester.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the message forwarding method of claim 8.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the message forwarding method of claim 8.
CN202311340708.7A 2023-10-17 2023-10-17 Proxy service system, message forwarding method, electronic device, and storage medium Pending CN117675899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311340708.7A CN117675899A (en) 2023-10-17 2023-10-17 Proxy service system, message forwarding method, electronic device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311340708.7A CN117675899A (en) 2023-10-17 2023-10-17 Proxy service system, message forwarding method, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
CN117675899A true CN117675899A (en) 2024-03-08

Family

ID=90079673

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311340708.7A Pending CN117675899A (en) 2023-10-17 2023-10-17 Proxy service system, message forwarding method, electronic device, and storage medium

Country Status (1)

Country Link
CN (1) CN117675899A (en)

Similar Documents

Publication Publication Date Title
US10110671B2 (en) Method, system, and device for managing server hardware resources in a cloud scheduling environment
CN110247784B (en) Method and device for determining network topology structure
CN108833202B (en) Method, device and computer readable storage medium for detecting fault link
CN108427619B (en) Log management method and device, computing equipment and storage medium
EP4024765B1 (en) Method and apparatus for extracting fault propagation condition, and storage medium
JP7132494B2 (en) Multi-cloud operation program and multi-cloud operation method
CN115378944A (en) Network system, service grid configuration method, storage medium and electronic equipment
CN114915561A (en) Network topological graph generation method and device
CN114697391A (en) Data processing method, device, equipment and storage medium
US10904327B2 (en) Method, electronic device and computer program product for searching for node
US11595471B1 (en) Method and system for electing a master in a cloud based distributed system using a serverless framework
CN117675899A (en) Proxy service system, message forwarding method, electronic device, and storage medium
EP3306471B1 (en) Automatic server cluster discovery
CN114760360B (en) Request response method, request response device, electronic equipment and computer readable storage medium
CN113364681B (en) Network path determination method, network path determination device, electronic apparatus, network path determination medium, and program product
CN115426258A (en) Information configuration method, device, switch and readable storage medium
CN115604160A (en) Network detection processing method and device, electronic equipment and storage medium
US10148518B2 (en) Method and apparatus for managing computer system
EP3756310B1 (en) Method and first node for managing transmission of probe messages
CN113778780A (en) Application stability determination method and device, electronic equipment and storage medium
CN113766363A (en) Fault monitoring method and device and computing equipment
CN115225634B (en) Data forwarding method, device and computer program product under virtual network
US11601305B2 (en) Physical infrastructure/virtual infrastructure integration system
US11469981B2 (en) Network metric discovery
US11283823B1 (en) Systems and methods for dynamic zone protection of networks

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