CN110881055A - Micro-service processing method and device based on Redis - Google Patents

Micro-service processing method and device based on Redis Download PDF

Info

Publication number
CN110881055A
CN110881055A CN201811032436.3A CN201811032436A CN110881055A CN 110881055 A CN110881055 A CN 110881055A CN 201811032436 A CN201811032436 A CN 201811032436A CN 110881055 A CN110881055 A CN 110881055A
Authority
CN
China
Prior art keywords
node
micro service
key
service node
redis server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811032436.3A
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.)
eBaoTech Corp
Original Assignee
eBaoTech Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by eBaoTech Corp filed Critical eBaoTech Corp
Priority to CN201811032436.3A priority Critical patent/CN110881055A/en
Publication of CN110881055A publication Critical patent/CN110881055A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention provides a micro-service processing method and device based on Redis. The method comprises the following steps: after the micro service node is started, registering the node information of the node to a Redis server so that the Redis server can create a key-value pair for the node; reading and storing node information of other micro service nodes which are already stored by the Redis server; creating a listener, and monitoring the key change of the Redis server through the listener; receiving, by a listener, change information indicating a change of the key pushed by the Redis server; and updating the stored information of other micro service nodes according to the change information. The invention detects the change of other nodes by monitoring the change of the key at one side of the server through the monitor of each node, does not need polling, saves system resources and can improve the real-time performance of monitoring.

Description

Micro-service processing method and device based on Redis
Technical Field
The invention relates to the field of computer networks, in particular to a micro-service processing method and device based on Redis.
Background
The microservice architecture is one of the software system architectures that facilitates software development, release, and deployment. However, an important concern of the micro-service architecture is registration and discovery of the service, and only through registration and discovery of the service, the location of the service can be known, and then the call to the service can be correctly realized. In the architecture implementation of the current process, the node information is generally known by polling the registration server. This polling method has some disadvantages, for example, additional resources are required to provide the registration service, and the service itself is also costly to operate and maintain by polling service discovery in order to make it highly available.
Disclosure of Invention
The invention provides a micro-service processing method based on Redis, which acquires the change information of other micro-service nodes by establishing a monitor at each micro-service node to monitor the change of the key of a registration server.
Some embodiments of the present invention provide a micro-service processing method based on Redis, including: after a micro service node is started, registering node information of the micro service node to a Redis server so that the Redis server can create a key-value pair for the micro service node; the micro service node reads and stores the node information of other micro service nodes which are already stored by the Redis server; the method comprises the steps that a micro service node creates a listener, and the change of a key of the Redis server is monitored through the listener; the micro service node receives the change information which is pushed by the Redis server and indicates the change of the key through a listener; and the micro service node updates the stored information of other micro service nodes according to the change information.
Some embodiments of the invention provide a computer apparatus comprising: a processor; and a memory for storing computer instructions adapted to be loaded by the processor to perform the above-mentioned micro-service processing method performed on the micro-service node side.
Some embodiments of the present invention provide a computer readable medium storing computer readable instructions adapted to be loaded by a processor to execute the above-mentioned micro-service processing method executed by the micro-service node side.
Some embodiments of the present invention further provide a micro-service processing method based on Redis, including: receiving node information sent by a micro service node by a Redis server, and creating a key-value pair for the micro service node according to the node information; the Redis server sends node information of other micro service nodes stored locally to the micro service node; the Redis server receives a monitoring request of a monitor created by the micro service node for the change of the key in the Redis server, and monitors the change of the key according to the monitoring request; when detecting the change of the key, the Redis server sends change information indicating the change of the key to a monitor of the micro service node, so that the micro service node updates the information of the micro service node locally stored by the micro service node according to the change information.
Some embodiments of the present disclosure also provide a computer device comprising a processor; and a memory for storing computer instructions adapted to be loaded by the processor to perform the server-side microservice processing method described above.
Some embodiments of the present disclosure also provide a computer readable medium storing computer readable instructions adapted to be loaded by a processor to perform the server-side microservice processing method described above.
Drawings
Fig. 1 shows a flow diagram of a Redis-based micro-service processing method according to an embodiment of the present invention.
FIG. 2 shows a micro-service processing architecture diagram of Redis according to an embodiment of the invention.
Fig. 3 shows a flow diagram of a Redis-based micro-service processing method according to an embodiment of the present invention.
Fig. 4 shows a schematic structural diagram of a computer device according to an embodiment of the present invention.
Fig. 5 shows a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The invention will now be described in detail with reference to exemplary embodiments thereof, some of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings, in which like numerals refer to the same or similar elements throughout the different views unless otherwise specified. The aspects described in the following exemplary embodiments do not represent all aspects of the present invention. Rather, these aspects are merely examples of systems and methods according to various aspects of the present invention as recited in the appended claims.
Referring to fig. 1, a flowchart illustrating a method for handling a micro service based on Redis according to an embodiment of the present invention, where the method is performed on a micro service node side in a micro service architecture, and specifically, the method 100 may include: step 110, step 120, step 130, step 140 and step 150, which are described below with reference to specific embodiments.
Step 110, after the micro service node is started, registering the node information of the micro service node to a Redis server so that the Redis server creates a key-value pair for the micro service node.
After the micro service node is started, the node information of the service node, for example, the name of the micro service, the IP address and the port address of the micro service node, which can be provided by the micro service node, is sent to a Redis server (e.g., a Redis registry server). When multiple instances are deployed on the same server by the same micro-service program, the IP and the service name of the instances are the same, so that the combination of the IP address, the port address and the service name is used as the node identifier in the embodiment of the invention, and the node is ensured to be uniquely identified. The microservice of the embodiment of the present invention can run in its own program, and communicate with an HTTP (hypertext Transfer Protocol) API (application programming Interface) through a lightweight device.
After receiving the registration information sent by the micro service node, the Redis server creates a corresponding key-value pair for the micro service node, and stores the micro service node and the corresponding key-value pair to a corresponding memory, wherein the memory can be acquired by other micro service nodes. The key-value pair created by Redis may support the storage of multiple value types, such as string, list, set, zset, and hash. The key of the embodiment of the invention can comprise a prefix and a node identifier, wherein the prefix can comprise a system environment identifier, such as an environment name; the node identification may include a service name of a service provided by the micro service node, an IP address and a port address of the micro service node, and the like. In some embodiments, the node identification includes a service name of the service provided by the microservice node, an IP address and a port address of the microservice node. It should be noted that the node identifier is not limited to the above three items of information, and may also include information expressing other attributes of the node.
In addition to sending node information (e.g., service name, IP address, and port address) to the Redis server, the microservice node may also send to the Redis the validity time of the microservice node, which is the time that the microservice node remains valid at the Redis server. In some embodiments, the validity time of the microservice node is sent at the same time the node information is sent to the Redis server. Generally, the validity time of a microservice node is mainly characterized by how long it expects other microservice nodes to receive notifications after the microservice node goes offline. Generally, the shorter the effective time, the more timely the notification, but the too short notification time means that the shorter the interval between the micro-services refreshing the self-information, the higher the resource consumption of the system. In some embodiments, each microservice node has the same validity time. In other embodiments, different microservice nodes have different validity times.
In some embodiments, the methods provided by embodiments of the present invention may further comprise: and the micro service node sends the valid time of the micro service node to the Redis server again in a preset time period, wherein the preset time period is less than the last valid time of the service node. For example, the effective time of the micro service node J sent to the Redis server is 10s, and then the effective time of the micro service node J is sent to the Redis server again after an interval of 8s, that is, the time interval 8s between the current effective time sending and the last effective time sending is less than the last effective time 10 s. The validity time of this transmission may be the same as the last validity time 10s, or may be different from the last validity time 10 s. In some embodiments, the effective time of each transmission of the micro service node is set to be the same.
The micro service node refreshes the node information of the micro service node according to a preset period and sends the refreshed node information to the Redis server, so that the Redis server is guaranteed to acquire timely and effective micro service node information. And the refreshing period of the micro service node is less than the effective time of the micro service node to the Redis server. In some embodiments, the refresh period of the micro service node is set to 4/5 of the valid time of the micro service node, so that not only can the Redis be guaranteed to know valid information of the micro service node in time, but also the refresh of the node itself can be guaranteed not to be too frequent, and the waste of refresh resources is avoided.
In some embodiments, the Redis server further sets an effective time for the key-value pair corresponding to the node according to the effective time of the node sent by the micro service node, where the effective time of the key-value pair is the same as the effective time of the node.
It should be noted that the micro service node described in the embodiment of the present invention is not specifically referred to as a certain micro service node, but may be a part or all of the micro service nodes served by the Redis server.
And step 120, the micro service node reads and stores the node information of other micro service nodes which are already stored by the Redis server.
After the micro service node is started up and brought online, the micro service node reads node information (for example, key-value peer of the micro service node) of other micro service nodes already stored by the Redis registration server from the Redis registration server, and stores the acquired node information of the other micro service nodes in a local memory of the micro service node for subsequent service call.
And step 130, the micro service node creates a listener, and the listener is used for monitoring the key change of the Redis server.
The microserver node creates a listener, which may be in the form of an interface, for example, in the following manner:
import org.springframework.data.redis.connection.MessageListener;
public interface IRedisListener extends MessageListener {
/**
topics of support
* @return
*/
public String supportTopic();
}
The listener may be implemented in various ways, for example, it may be a new node listener, an expired listener, or the like.
In some embodiments, there are 2 kinds of listeners inside each microservice, one of them is a newly added listener, which is responsible for listening (also called subscribing) to a topic create _ Node, and any event sent to this topic implies that a certain microservice Node X is on-line, and when any event of this topic arrives, the listening code is called, so that other microservice nodes know the on-line of Node X. Any microserver node, when it normally starts up, should issue an event to this create _ nodes topic. The listener monitors that the name of the topo is topo. Another type of listener, called an expired listener, is responsible for listening for expire events and expired events. When any micro service node runs, a daemon thread exists, and is responsible for setting expiration time to a key identified by own ip address/port address/service name in Redis at fixed time intervals, and an expire event is generated and is similar to a heartbeat event. When the micro service node crashes or the network of the node and the Redis is interrupted for some reason, the Redis server cannot accept the heartbeat event of the node all the time, and the Redis server automatically removes the corresponding key-value, so that an expired event is generated. When other micro service nodes receive the amplified event, the corresponding nodes are removed from the local service node list.
For example, a listener may be created by the following code:
@Bean
public RedisMessageListenerContainer redisExpireEventContainer(){
RedisMessageListenerContainer container=newRedisMessageListenerContainer();
container.setConnectionFactory(redisConnectionFactory);
if(redisListeners!=null)
{
for(IRedisListener listener:redisListeners){
PlatformLogger.getLogger().info("register redis listener {}for topic {}",listener.getClass().getName(),listener.supportTopic());
container.addMessageListener(listener,new PatternTopic(listener.supportTopic()));
}
PlatformLogger.getLogger().info("success register {} redislisteners",redisListeners.size());
}
return container;
}
as shown in fig. 2, each micro service node (micro service nodes 210, 220, 230, and 240) may create a listener (210M, 220M, 230M, and 240M) to listen to events of key-value pairs saved in the Redis server 200. The Redis server 200, upon monitoring the key-value change event, may push change information indicating the change of the key to the listeners 210M, 220M, 230M, and 240M of the respective microservice nodes. Compared with the conventional mode that other service nodes are obtained by polling the micro service nodes, the real-time performance and the timeliness of obtaining the new node addition and the outdated information change are greatly improved.
Different listeners may listen to the Redis registry server for different key changes, e.g., new or expired keys.
The addition of Key indicates that a new micro service node in the system is registered in a Redis server and can monitor through a specific topic of a subscription monitor.
The expiration of the Key indicates that the validity period of the Key of the Redis server has passed. This is usually the case because the micro service node corresponding to the expired key does not update the valid time of the key of the Redis server on time, which results in the Redis server actively deleting the key. The validity time of the key-value pair of the micro service node is not updated on time, which typically occurs in the case of no response by the micro service node or a long time interruption of the network between the micro service node and the Redis server. Listening may be through an expired listener.
In some embodiments of the present invention, listening for changes in keys of a Redis server by an expired listener may include: monitoring a first expiration event of a key-value pair of one or all micro service nodes which are already stored by the Redis server through an expiration listener, wherein the first expiration event is an event that the key-value pair sends valid time according to a preset time period to a corresponding node, for example, the above-described expire event. Listening for changes to keys of the Redis server by the expired listener may further include: and monitoring a second expiration event of a key-value pair of one or all micro service nodes which are already stored by the Redis server through an expiration listener, wherein the second expiration event is an event that the key-value pair fails due to the fact that the node corresponding to the key-value pair does not send valid time according to a preset time period, for example, the above-described expired event.
In some embodiments of the present invention, listening, by the listener, for a change in the key of the Redis server may include: and monitoring events generated by the indication nodes in the key of the Redis server through the newly added monitor. For example, events generated by an indication node in a redis server can be monitored by subscribing to a topic _ create _ nodes, and any event sent to the topic implies that a micro service node nodx is on line, and when any event of the topic arrives, a monitoring code is called, so that other micro service nodes know the node x is on line.
And step 140, the micro service node receives the change information which is pushed by the Redis server and indicates the change of the key through a monitor.
The monitor created by the micro service node can monitor the change of the key of the Redis server, the event of the change of the key of the Redis server, such as the event of the addition or the expiration of the key, and the Redis server sends the change information (such as the addition event or the expiration event) indicating the change of the key to each micro service node.
In some embodiments, the nodal communication protocol of the Redis server and the microservice is a TCP-based protocol. Redis defines an application protocol that enables efficient and secure communication between Redis clients and Redis servers.
In some embodiments, for an expiration event, the snooped topic is:
__keyspace@0__:${prefix} /*
where $ prefix is the value of the prefix, corresponding to the prefix of the node identification actually stored,
for example, a micro service node is stored in number 0 database of redis, and key is ebao _ test _ env/nodes/security-service/192.168.1.5/53836
Then the topic that the expired listener listens to should be:
__keyspace@0__:ebao_test_env/nodes/*
due to the last wildcard, it is actually listening for the expiration events of a batch or group of keys, not for the expiration events of a node.
When an expiration event is received, the following codes are triggered:
@Override
public void onMessage(Message message, byte[]pattern) {
Assert.notNull(message, "message can not be null");
Assert.notNull(message.getBody(), "message body cannot benull");
ApplicationEvent event = RedisKeyEvent.generateApplicationEvenet(message);
if (event != null)
statusManager.refresh(event);
}
the body of the message is text, expire or expired, so as to know whether the deletion is overdue or a heartbeat event.
The message channel is a text containing the actual value of the current specific topic, for example:
__keyspace@0__:ebao_test_env/nodes/security-service/192.168.1.5/53836
from the topic we can obtain the unique identifier of the node, thereby deleting the corresponding node.
The body part of each event is a json text and contains information such as an IP address, a port address and a service name IP/port/servicename of a node, and other additional information can be added into the frame according to needs.
The java example code is as follows, and other machine languages may refer to the redis connection and usage specification of the corresponding language.
@Override
publicvoid onMessage(Message message, byte[]pattern) {
String body=new String(message.getBody());
PlatformLogger.getLogger().debug("the node register event comingwith body:{}",body);
Node node=jsonAccessor.decode(body,Node.class);
ApplicationEvent event= eventNodeConvertor.to(node);
event.setType(EStatusType.start);
statusManager.refresh(event);
PlatformLogger.getLogger().debug("the node {}:{} is registered tocurrent application",event.getAddress(),event.getPort());
}
And 150, the micro service node updates the stored information of other micro service nodes according to the change information.
The micro service node receives the change information which is pushed by the Redis server and indicates the change of the key through the monitor, and then updates the information of other locally stored micro service nodes according to the change information which indicates the change of the key, for example, for a newly added key, the node information corresponding to the newly added key can be added to the list of other locally stored micro service nodes, for an expired key, the node information corresponding to the key can be deleted from the list of other locally stored micro service nodes, and the timely updating of the information of other locally stored micro service nodes is completed.
According to the micro-service processing method based on Redis provided by the embodiment of the invention, the change of the key of the Redis server is detected through the monitor established at each micro-service node, the state change of the micro-service node corresponding to the key is represented through the change of the key, and the information of the service node locally stored in the micro-service node is updated in time; in addition, resource loss caused by periodic polling can be avoided, and the high available operation and maintenance cost of the system is reduced.
Referring to fig. 3, fig. 3 is a flow chart illustrating a micro-service processing method according to an embodiment of the present invention, which is performed on a server side of a micro-service architecture, and specifically, the method 300 may include: the steps 310, 320, 330 and 340 are described in detail below with reference to specific embodiments.
And 310, receiving node information sent by the micro service node by the Redis server, and creating a key-value pair for the micro service node according to the node information.
The Reids server, as a Redis center, receives node information sent by each micro service node, uses the node information as registration information of the node, for example, may include a name of a micro service provided by the micro service node, an IP address and a port address of the micro service node, and creates a key-value pair for the micro service node according to the node information. In some embodiments, such as china, a key includes a prefix, which may include a system environment identifier (e.g., environment name), and a node identifier, which may include a service name, an IP address, a port address, and the like.
And step 320, the Redis server sends the node information of other micro service nodes stored locally to the micro service node.
The Redis server sends node information (e.g., key-value peers) of other micro service nodes that the server holds locally to the micro service node.
Step 330, the Redis server receives the monitoring request of the monitor created by the micro service node to the change of the key in the Redis server, and monitors the change of the key according to the monitoring request.
As described above, each micro service node creates corresponding listeners, for example, a newly added listener and an expired listener, and sends a monitoring request to the Redis server through the listeners, and the Redis service receives the monitoring request sent by the listener created by the micro service node, and monitors a change of a key in the Redis server according to the monitoring request, for example, an event such as a newly added key, an expired key, and the like.
Step 340, when detecting the change of the key, the Redis server sends change information indicating the change of the key to a monitor of the micro service node, so that the micro service node updates the information of the micro service node locally stored by the micro service node according to the change information.
After monitoring the key change event, the Redis server pushes change information indicating the key change, such as a newly added event, a first expiration event (e.g., a heartbeat event), and a second expiration event (e.g., an expiration deletion event), to all listeners of the micro service node sending the monitoring request, so that the service node of each listener can update the node list information locally maintained by the micro service node according to the change information pushed by the Redis server.
In some embodiments, the Redis server further receives the valid time sent by the micro service node, and sets the valid time for the key-value pair corresponding to the micro service node according to the valid time.
In some embodiments, the Redis server monitors whether a locally stored microservice node sends valid time according to a predetermined time, if so, generates a first expiration event, and if not, generates a second expiration event.
In some embodiments, the Redis server detects a topic create _ node added by an indication node, and sends an event corresponding to the topic to a micro service node subscribed to the topic.
It should be noted that, the execution action on the Redis server side has a corresponding description in the description on the micro service node side, and is not described herein again.
The present disclosure also provides a computer device. As shown in fig. 4, the computer device 400 may include a processor 421, an input/output (I/O) device 422, a memory 423, a database 424, and a display 425.
The processor 421 may be one or more known processing devices that can load computer instructions stored in the memory 423 for implementing the above-described methods to cause a computer apparatus to perform the above-described methods.
I/O device 422 may be configured to allow data to be received and/or transmitted. I/O device 422 may include one or more digital and/or analog communication devices that allow computer device 400 to communicate with other machines and devices. Computer device 400 may also include one or more databases 424, or be communicatively coupled to one or more databases 424 via a network. For example, database 424 may be any suitable database suitable for performing the associated data processing of the above-described methods.
The display 425 may include a display screen that may be used to display the output results of the input/output device 422 as well as intermediate results in the processing of the data.
The present disclosure also provides a computer-readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the above-described method on the node side in Redis-based microservice processing.
The embodiment of the invention also provides a server. As shown in FIG. 5, server 500 may include a processor 501, an input/output (I/O) device 502, a memory 503, and a database 504.
The processor 501 may employ one or more processing chips that can load computer instructions stored in the memory 503 to implement the above-described methods to cause the server to implement the above-described methods.
The I/O device 502 may be configured to allow data to be received and/or transmitted. The I/O device 502 may include one or more digital and/or analog communication devices that allow the server 500 to communicate with other machines and devices. Server 500 may also include one or more databases 504, or be communicatively coupled to one or more databases 504 via a network. For example, database 504 may be any suitable database suitable for performing the associated data processing of the above-described methods.
Embodiments of the present invention also provide a computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, implement the server-side method of Redis-based microservice processing described above.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention can be implemented by combining software and a hardware platform. With this understanding in mind, all or part of the technical solutions of the present invention that contribute to the background art may be embodied in the form of a software product, which can be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, a smart phone, or a network device, etc.) to execute the methods according to the embodiments or some parts of the embodiments.
The terms and expressions used in the specification of the present invention have been set forth for illustrative purposes only and are not meant to be limiting. It will be appreciated by those skilled in the art that changes could be made to the details of the above-described embodiments without departing from the underlying principles thereof. The scope of the invention is, therefore, indicated by the appended claims, in which all terms are intended to be interpreted in their broadest reasonable sense unless otherwise indicated.

Claims (20)

1. A micro-service processing method based on Redis is characterized by comprising the following steps:
after a micro service node is started, registering node information of the micro service node to a Redis server so that the Redis server can create a key-value pair for the micro service node;
the micro service node reads and stores the node information of other micro service nodes which are already stored by the Redis server;
the method comprises the steps that a micro service node creates a listener, and the change of a key of the Redis server is monitored through the listener;
the micro service node receives the change information which is pushed by the Redis server and indicates the change of the key through a listener;
and the micro service node updates the stored information of other micro service nodes according to the change information.
2. The method of claim 1, wherein the key comprises a prefix and a node identification.
3. The method of claim 2, wherein the node identification comprises a service name, an IP address, and a port address.
4. The method of claim 2, wherein the node information comprises a service name, an IP address, and a port address, and wherein registering the node information of the micro service node with a Redis server comprises:
and sending the service name, the IP address and the port address of the micro service node as registration information to a Redis server.
5. The method of claim 4, further comprising:
and the micro service node sends the valid time of the micro service node to the Redis server so that the Redis server sets the valid time for the Key-value pair corresponding to the micro service node.
6. The method of claim 5, further comprising:
and the micro service node sends the valid time of the micro service node to the Redis server again in a preset time period, wherein the preset time period is less than the last valid time of the micro service node.
7. The method of any of claims 5 and 6, the listeners comprising a newly added listener and an expired listener.
8. The method of claim 7, wherein the listening, by the listener, for a change in key of the Redis server comprises:
and monitoring an event generated by an indication node in a key-value pair of the Redis server through the newly added listener.
9. The method of claim 7, wherein the listening, by the listener, for a change in key of the Redis server comprises:
monitoring a first expiration event of a key-value pair of a micro service node which is stored by a Redis server through an expiration listener, wherein the first expiration event is an event of sending effective time by a node corresponding to the key-value pair according to a preset time period.
10. The method of claim 7, wherein the listening, by the listener, for a change in key of the Redis server comprises:
monitoring a second expiration event of a key-value pair of the micro service nodes which are already stored by the Redis server through an expiration listener, wherein the second expiration event is an event that the key-value pair fails because the node corresponding to the key-value pair does not send valid time according to a preset time period.
11. A micro-service processing method based on Redis is characterized by comprising the following steps:
receiving node information sent by a micro service node by a Redis server, and creating a key-value pair for the micro service node according to the node information;
the Redis server sends node information of other micro service nodes stored locally to the micro service node;
the Redis server receives a monitoring request of a monitor created by the micro service node for the change of the key in the Redis server, and monitors the change of the key according to the monitoring request;
when detecting the change of the key, the Redis server sends change information indicating the change of the key to a monitor of the micro service node, so that the micro service node updates the information of the micro service node locally stored by the micro service node according to the change information.
12. The method of claim 11, wherein the key comprises a prefix and a node identification.
13. The method of claim 12, wherein the node identification comprises a service name, an IP address, and a port address.
14. The method of claim 11, further comprising:
and the Redis server receives the effective time sent by the micro service node and sets the effective time for the key-value pair corresponding to the micro service node according to the effective time.
15. The method of claim 14, further comprising:
the Redis server detects whether other locally-stored micro service nodes send valid time according to preset time, if so, a first expiration event is generated, and if not, a second expiration event is generated.
16. The method of claim 11, further comprising:
the Redis server monitors a theme added by the indication node and sends an event corresponding to the theme to the micro service node subscribed with the theme.
17. A computer apparatus, comprising:
a processor; and
a memory for storing computer instructions adapted to be loaded by the processor to perform the method of any of claims 1 to 10.
18. A computer readable medium storing computer readable instructions adapted to be loaded by a processor to perform the method of any of claims 1 to 10.
19. A server, comprising:
a processor; and
a memory for storing computer instructions adapted to be loaded by the processor to perform the method of any of claims 11 to 16.
20. A computer readable medium storing computer readable instructions adapted to be loaded by a processor to perform the method of any of claims 11 to 16.
CN201811032436.3A 2018-09-05 2018-09-05 Micro-service processing method and device based on Redis Pending CN110881055A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811032436.3A CN110881055A (en) 2018-09-05 2018-09-05 Micro-service processing method and device based on Redis

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811032436.3A CN110881055A (en) 2018-09-05 2018-09-05 Micro-service processing method and device based on Redis

Publications (1)

Publication Number Publication Date
CN110881055A true CN110881055A (en) 2020-03-13

Family

ID=69727589

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811032436.3A Pending CN110881055A (en) 2018-09-05 2018-09-05 Micro-service processing method and device based on Redis

Country Status (1)

Country Link
CN (1) CN110881055A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698266A (en) * 2020-06-30 2020-09-22 平安国际智慧城市科技股份有限公司 Service node calling method, device, equipment and readable storage medium
CN112738339A (en) * 2020-12-29 2021-04-30 杭州东信北邮信息技术有限公司 Service instance lossless capacity expansion and reduction method under telecommunication domain micro-service architecture
CN114125035A (en) * 2021-09-27 2022-03-01 烽火通信科技股份有限公司 Service registration method and device under large-scale capacity expansion scene
CN116760930B (en) * 2023-08-17 2023-11-10 Tcl通讯科技(成都)有限公司 Call processing method and device, storage medium and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636437A (en) * 2014-12-31 2015-05-20 华为技术有限公司 Event notification method and device and monitor processing method
CN106302596A (en) * 2015-06-03 2017-01-04 北京京东尚科信息技术有限公司 A kind of method and apparatus of service discovery
CN107786527A (en) * 2016-08-31 2018-03-09 阿里巴巴集团控股有限公司 Realize the method and apparatus of service discovery
CN107888444A (en) * 2017-09-29 2018-04-06 深圳市牛鼎丰科技有限公司 Service monitoring method, service monitoring device, computer equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636437A (en) * 2014-12-31 2015-05-20 华为技术有限公司 Event notification method and device and monitor processing method
CN106302596A (en) * 2015-06-03 2017-01-04 北京京东尚科信息技术有限公司 A kind of method and apparatus of service discovery
CN107786527A (en) * 2016-08-31 2018-03-09 阿里巴巴集团控股有限公司 Realize the method and apparatus of service discovery
CN107888444A (en) * 2017-09-29 2018-04-06 深圳市牛鼎丰科技有限公司 Service monitoring method, service monitoring device, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698266A (en) * 2020-06-30 2020-09-22 平安国际智慧城市科技股份有限公司 Service node calling method, device, equipment and readable storage medium
CN111698266B (en) * 2020-06-30 2023-05-02 深圳赛安特技术服务有限公司 Service node calling method, device, equipment and readable storage medium
CN112738339A (en) * 2020-12-29 2021-04-30 杭州东信北邮信息技术有限公司 Service instance lossless capacity expansion and reduction method under telecommunication domain micro-service architecture
CN114125035A (en) * 2021-09-27 2022-03-01 烽火通信科技股份有限公司 Service registration method and device under large-scale capacity expansion scene
CN114125035B (en) * 2021-09-27 2023-08-08 烽火通信科技股份有限公司 Service registration method and device under large-scale capacity expansion scene
CN116760930B (en) * 2023-08-17 2023-11-10 Tcl通讯科技(成都)有限公司 Call processing method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN110881055A (en) Micro-service processing method and device based on Redis
CN113039763B (en) NF Service Consumer Restart Detection Using Direct Signaling Between NFs
US20210176310A1 (en) Data synchronization method and system
CN100579082C (en) Information exchange system, management server, and method for reducing the network load
CN101317370B (en) Method and management agent for event notifications correlation
CN111163159B (en) Message subscription method, device, server and computer readable storage medium
US20180004582A1 (en) Timers in stateless architecture
CN111770172A (en) Message middleware consumption proxy method, device, proxy server and storage medium
CN113905005A (en) Client state updating method and device for instant messaging
CN111064626A (en) Configuration updating method, device, server and readable storage medium
CN111464642A (en) Method and device for pushing messages of vehicle machine
WO2024103943A1 (en) Service processing method and apparatus, storage medium, and device
CN107425994B (en) Method, terminal and server for realizing remote parameter management
EP3373608B1 (en) Method and apparatus for acquiring resources
CN111182066A (en) Log level dynamic adjustment method based on token authentication
CN111130905A (en) Distributed cluster-based log level dynamic adjustment method
CN114025005B (en) Data communication method, system, electronic equipment and storage medium
CN111124703A (en) Method and system for automatically reminding processing work in cluster environment
CN111200578A (en) Communication method, client device and server device
CN112511595B (en) Message pushing method and message service system
CN112437146B (en) Equipment state synchronization method, device and system
CN115065686A (en) Configuration method, device and system of distributed load balancing system
CN113094074A (en) Service cluster updating method and device
CA3177732A1 (en) Methods and apparatuses for enhanced 5gc restoration when a network function (nf) set is deployed in the network
WO2016082492A1 (en) Method for notifying original resource, and corresponding node

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200313

RJ01 Rejection of invention patent application after publication