CN110633175B - Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium - Google Patents
Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110633175B CN110633175B CN201910927223.5A CN201910927223A CN110633175B CN 110633175 B CN110633175 B CN 110633175B CN 201910927223 A CN201910927223 A CN 201910927223A CN 110633175 B CN110633175 B CN 110633175B
- Authority
- CN
- China
- Prior art keywords
- micro
- room
- machine room
- service
- data access
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/1658—Data re-synchronization of a redundant component, or initial sync of replacement, additional or spare unit
- G06F11/1662—Data re-synchronization of a redundant component, or initial sync of replacement, additional or spare unit the resynchronized component or unit being a persistent storage device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F16/273—Asynchronous replication or reconciliation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2201/00—Indexing scheme relating to error detection, to error correction, and to monitoring
- G06F2201/80—Database-specific techniques
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Quality & Reliability (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Telephonic Communication Services (AREA)
- Hardware Redundancy (AREA)
Abstract
The invention discloses a multi-computer-room data processing method based on micro-services, electronic equipment and a storage medium, wherein a main computer room and a slave computer room are configured for each micro-service in a configuration center; a plurality of micro services with calling relation to each other are configured into the same main computer room and the same slave computer room; the method comprises the following steps: receiving a data access request for any microservice; routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center; and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation. According to the scheme, the micro-service is provided with the master machine room and the slave machine room, the data access request aiming at the micro-service is processed by the master machine room of the micro-service, unidirectional data synchronization from the master machine room to the slave machine room is realized, and data collision in a multi-machine-room scene is effectively avoided.
Description
Technical Field
The invention relates to the technical field of information processing, in particular to a multi-computer-room data processing method based on micro-service, electronic equipment and a storage medium.
Background
The user can use the client to obtain the service provided by the server, such as downloading the electronic book from the server, browsing the comment information of the electronic book, and the like. In order to manage the server and ensure normal operation of server services, operators can store the server in a machine room, and the temperature, humidity, antistatic measures and the like of the machine room have strict requirements. In order to prevent a situation where a server in a machine room hangs down and causes a service interruption, the machine rooms are generally installed in a plurality of places so that after one machine room hangs down, reliable service can be provided through another machine room. The user can access the required service through any computer room, and the domain name server generally allocates a computer room close to the user to provide the service for the user.
In order to ensure that a plurality of computer rooms can provide reliable service at any time, data in the plurality of computer rooms need to be synchronized, so that the data in the plurality of computer rooms are consistent. However, in the process of providing services for users, based on reasons such as flow balance and user location change, there is a high possibility that the rooms allocated to the same user are inconsistent, and once the rooms allocated later do not complete data synchronization while providing services for users, there is a high possibility that data in the rooms are inconsistent, which causes a problem of data collision.
Disclosure of Invention
In view of the above, the present invention has been made to provide a multi-room data processing method based on micro-services, an electronic device and a storage medium that overcome or at least partially solve the above problems.
According to one aspect of the invention, a multi-machine-room data processing method based on micro-services is provided, wherein a main machine room and a slave machine room are configured for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
the method comprises the following steps:
receiving a data access request for any microservice;
routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center;
and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation.
According to another aspect of the present invention, there is provided an electronic apparatus including: the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction causes the processor to execute the following operations:
configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
receiving a data access request for any microservice;
routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center;
and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation.
According to yet another aspect of the present invention, there is provided a storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to:
configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
receiving a data access request for any microservice;
routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center;
and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation.
According to the technical scheme provided by the invention, the master machine room and the slave machine room are configured for each micro-service in the configuration center, so that the precise configuration of the master machine room and the slave machine room based on the micro-service is realized, and the same master machine room and the same slave machine room are configured for a plurality of micro-services with mutual calling relation, so that the plurality of micro-services with mutual calling relation can be called in real time and are not influenced by unstable factors such as network jitter and the like existing in a special line of the machine room and a public network; routing the data access request aiming at the micro service to a main machine room of the micro service according to the configuration information of the configuration center, so that the data access request aiming at the micro service is always processed by the main machine room of the micro service, and the main machine room is used as hot standby; under the condition that the data access request is a data write-in request, data write-in operation is executed to write data into a database of a main machine room of the micro service, the data write-in operation is synchronized to a slave machine room of the micro service, and the slave machine room executes the data write-in operation, so that unidirectional data synchronization from the main machine room to the slave machine room is realized, data collision in a multi-machine-room scene is effectively avoided, and a multi-machine-room data processing mode is optimized.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flowchart illustrating a multi-computer-room data processing method based on micro-services according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a multi-computer-room data processing method based on micro-services according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example one
Fig. 1 is a schematic flowchart illustrating a multi-computer-room data processing method based on micro-services according to an embodiment of the present invention, where as shown in fig. 1, the method includes the following steps:
step S101, receiving a data access request aiming at any micro service.
Specifically, a master room and a slave room are configured in advance for each micro service in a configuration center, the micro service refers to a service which can be deployed independently and has high cohesion characteristics, and the characteristics of low coupling between different micro services are also provided. One skilled in the art can configure the master machine room and the slave machine room for each microservice according to actual needs to ensure balanced flow of the machine rooms. Assuming that the e-book reading server includes 4 micro-services, the 4 micro-services are respectively micro-service a to micro-service D, and the e-book reading server corresponds to 2 rooms, respectively room 1 and room 2, the room 1 may be configured as a master room of the micro-service a and micro-service B, the room 2 may be configured as a slave room of the micro-service a and micro-service B, and in addition, the room 2 may be configured as a master room of the micro-service C and micro-service D, and the room 1 may be configured as a slave room of the micro-service C and micro-service D.
In addition, a plurality of micro services can be called each other, and in order to ensure that a plurality of micro services with calling relations can be called in real time, in the invention, a plurality of micro services with calling relations are configured into the same master computer room and the same slave computer room. The main machine room of the micro-service is used for providing external data access for each micro-service, the slave machine room does not provide the external data access under the condition that the main machine room provides the external data access, but serves as hot spare, once the main machine room has abnormal work, faults and the like, the slave machine room can replace the main machine room within a short time, the function of the main machine room is completely realized, and reliable external data access is provided.
When a user or a business operation and maintenance person wants to access data of any micro service, a data access request for the micro service can be sent, wherein the data access request can carry information such as micro service identification, a request method, request content, a request UR L, a requested server address, a communication protocol and the like, and the micro service identification can be a micro service name or a micro service ID and the like.
And step S102, routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center.
After the configuration center completes the configuration of the master room and the slave room of each micro service, configuration information is generated, information such as the micro service identifier of each micro service, the corresponding master room and the slave room is recorded in the configuration information, and then the master room of the micro service to which the data access request is directed can be inquired according to the configuration information, and then the data access request is routed to the master room of the micro service, and the master room processes the data access request. Specifically, the micro-service identifier carried in the data access request may be matched with the micro-service identifier of each micro-service recorded in the configuration information, the host room of the matched micro-service is determined as the machine room for processing the data access request, and then the data access request is routed to the host room.
Step S103, if the data access request is a data write request, performing a data write operation to write data into the database of the main room of the microservice, and synchronizing the data write operation to the slave room of the microservice, so that the slave room performs the data write operation.
The data access request may be a data read request or a data write request. If the data access request is a data reading request, data reading operation is executed to read data from a database of a main computer room of the micro service; if the data access request is a data write request, performing data write operation to write data into the database of the main room of the micro-service, and updating the data in the database of the main room by performing the data write operation, in this case, data synchronization between the main room and the slave room needs to be performed in time.
By using the multi-computer-room data processing method based on the micro-services provided by the embodiment, the main computer room and the auxiliary computer rooms are configured for each micro-service in the configuration center, so that the precise configuration of the main computer room and the auxiliary computer rooms based on the micro-services is realized, and the same main computer room and the same auxiliary computer room are configured for a plurality of micro-services with a calling relationship with each other, so that a plurality of micro-services with the calling relationship with each other can be called in real time and are not influenced by unstable factors such as network jitter existing in a special line of the computer room and a public network; routing the data access request aiming at the micro service to a main machine room of the micro service according to the configuration information of the configuration center, so that the data access request aiming at the micro service is always processed by the main machine room of the micro service, and the main machine room is used as hot standby; under the condition that the data access request is a data write-in request, data write-in operation is executed to write data into a database of a main machine room of the micro service, the data write-in operation is synchronized to a slave machine room of the micro service, and the slave machine room executes the data write-in operation, so that unidirectional data synchronization from the main machine room to the slave machine room is realized, data collision in a multi-machine-room scene is effectively avoided, and a multi-machine-room data processing mode is optimized.
Example two
Fig. 2 is a flowchart illustrating a multi-computer-room data processing method based on micro-services according to a second embodiment of the present invention, where as shown in fig. 2, the method includes the following steps:
step S201, a data access request for any microservice is received.
The configuration center configures a master machine room and a slave machine room for each micro-service in advance. For each micro-service, the master room of the micro-service is used to provide external data access, and in the case that the master room provides external data access, the slave room of the micro-service does not provide external data access, but serves as a hot-standby.
In an actual usage scenario, some micro services need to be invoked with each other, for example, a plurality of micro services related to user production content need to be invoked with each other, or a plurality of micro services related to user account assets need to be invoked with each other. If different host rooms are configured for a plurality of micro services with calling relations, in the process of calling the micro services, calling needs to be carried out through a machine room special line or a public network between machine rooms, and then the calling of the micro services is likely to be influenced by unstable factors such as network jitter existing in the machine room special line and the public network.
In order to realize real-time calling of a plurality of micro services with calling relations, in the invention, the plurality of micro services with calling relations are divided into the same micro service group to obtain a plurality of micro service groups, different group domain names are configured for each micro service group, and then a master room and a slave room are configured for each micro service group in a configuration center by taking the micro service group as a unit, so that the plurality of micro services with calling relations are configured into the same master room and the same slave room. By the configuration mode, a plurality of micro services with calling relation can be called in the same machine room, cross-machine-room calling is not needed, and real-time calling among the micro services is effectively realized.
For example, a user wants to recharge his e-book account, requests to access data of the recharging micro service, and sends a data access request for the recharging micro service, wherein the data access request can carry information such as micro service identification, request method, request content, request UR L, requested server address, communication protocol and the like of the recharging micro service, and then receives the data access request for the recharging micro service in step S201.
Step S202, according to the configuration information stored in the domain name server, determining a processing machine room of the micro service, and performing routing processing on the data access request according to the processing machine room of the micro service.
After the configuration center completes the configuration of the master room and the slave room of each micro-service, configuration information is generated, and information such as the micro-service identifier of each micro-service, the corresponding master room and the slave room is recorded in the configuration information. The domain name server (namely DNS server) and the gateway acquire configuration information of the configuration center and store the configuration information so as to perform routing processing on the data access request according to the configuration information. Specifically, the configuration center may actively send the configuration information to the domain name server and the gateway, or the domain name server and the gateway actively pull the latest configuration information from the configuration center, which is not limited herein.
After receiving a data access request, a domain name server determines a processing machine room of a micro service according to configuration information stored in the domain name server, wherein the micro service identifier carried in the data access request can be matched with the micro service identifier of each micro service recorded in the configuration information stored in the domain name server, a main machine room of the matched micro service is determined as the processing machine room for processing the data access request, namely the processing machine room of the micro service, then the data access request is routed according to the determined processing machine room of the micro service, and specifically, the data access request is routed to the processing machine room of the micro service.
Step S203, judging whether the processing machine room of the micro service is consistent with the main machine room of the micro service according to the configuration information stored in the gateway; if yes, go to step 204; if not, go to step 205.
Considering that the frequency of updating the configuration information by the domain name server is often low, and the configuration information stored in the domain name server may not be the latest configuration information of the configuration center, the processing room of the micro-service determined by the domain name server according to the stored configuration information is not necessarily the main room of the micro-service. In order to solve the problem, the invention checks the correctness of the routing processing of the domain name server aiming at the data access request through the gateway. The frequency of updating the configuration information by the gateway is much higher than that of updating the configuration information by the domain name server, and preferably, the configuration information stored in the gateway and the configuration center of the configuration center keep real-time synchronization. When a data access request reaches a gateway through the route of a domain name server, the gateway determines the actual main room of the micro-service corresponding to the data access request according to the configuration information stored in the gateway, specifically, the micro-service identifier carried in the data access request is matched with the micro-service identifier of each micro-service recorded in the configuration information stored in the gateway to obtain the main room of the matched micro-service, and then, whether the processing machine room of the micro-service determined by the domain name server is consistent with the main room of the micro-service determined by the gateway is judged. If the processing machine room determined by the domain name server is the main machine room of the micro-service and the routing processing of the domain name server is correct, executing step S204; if the processing rooms determined by the domain name server are not the main room served by the micro server and the routing processing of the domain name server is wrong, step S205 is executed.
Step S204, the main computer room of the micro service processes the data access request.
If the processing machine room of the micro-service determined by the domain name server is judged to be consistent with the main machine room of the micro-service, the processing machine room determined by the domain name server is the main machine room of the micro-service, and the routing processing of the domain name server aiming at the data access request is correct, the data access request is directly processed by the main machine room of the micro-service.
Step S205, forwarding the data access request to the main computer room of the microservice for processing.
If the processing machine room of the micro-service determined by the domain name server is not consistent with the main machine room of the micro-service, which indicates that the routing processing of the domain name server for the data access request is wrong, the data access request is forwarded to the main machine room of the micro-service at the access layer of the processing machine room, and the data access request is processed by the main machine room of the micro-service. By the processing mode, the data access request aiming at the micro service is always processed by the main computer room of the micro service.
Specifically, the data access request is forwarded to the micro-service host computer room for processing through a public network or a machine room dedicated line arranged between the processing machine room and the micro-service host computer room. In order to facilitate communication among the machine rooms, a machine room dedicated line is generally arranged among the machine rooms, data transmission can be performed rapidly through the machine room dedicated line, and then the data access request is preferably forwarded to a micro-service mainframe room through the machine room dedicated line on an access layer of the processing machine room for processing, so that rapid forwarding of the data access request can be achieved. Considering the situation that the special line of the machine room can not normally transmit data due to the fault, the data access request can be preferentially forwarded to the main machine room of the micro-service through the special line of the machine room; and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through the public network.
Step S206, if the data access request is a data write request, performing a data write operation to write data into the database of the main room of the microservice, writing an operation instruction of the data write operation into the data access log, and synchronizing the data access log to the slave room of the microservice, so that the slave room performs the data write operation according to the data access log.
In the process of processing the data access request by the main room of the micro service, if the data access request is a data reading request, executing data reading operation to read data from a database of the main room of the micro service; if the data access request is a data write request, data write operation is performed to write data into the database of the main room of the micro-service, and the data in the database of the main room is updated through the data write operation, in this case, data synchronization between the main room and the slave room needs to be performed in time, then an operation instruction of the data write operation can be written into a data access log of the main room, and the data access log is synchronized to the slave room of the micro-service, so that the slave room can perform execution according to the operation instruction of the data write operation recorded in the data access log, and the data is written into the database of the slave room of the micro-service, thereby realizing unidirectional data synchronization from the main room to the slave room.
By using the multi-computer-room data processing method based on the micro-services provided by the embodiment, a plurality of micro-services with a calling relationship with each other are divided into the same micro-service group, and the micro-service group is taken as a unit to configure a master computer room and a slave computer room for each micro-service group in a configuration center, so that a plurality of micro-services in the same micro-service group can be called with each other in the same computer room without cross-computer-room calling, thereby effectively realizing real-time calling among the micro-services without being influenced by unstable factors such as network jitter and the like existing in a special line of the computer room and a public network; the gateway checks the correctness of the routing processing of the domain name server aiming at the data access request, under the condition that a processing machine room of the micro service determined by the domain name server is inconsistent with a main machine room of the micro service determined by the gateway, the data access request is forwarded to the main machine room of the micro service for processing, the data access request is forwarded to the main machine room of the micro service on an access layer of the processing machine room, so that the data access request aiming at the micro service is always processed by the main machine room of the micro service, and the auxiliary machine room is used as hot spare; in addition, unidirectional data synchronization from the main machine room to the auxiliary machine room is realized, data collision in a multi-machine-room scene is effectively avoided, and a multi-machine-room data processing mode is optimized.
EXAMPLE III
The third embodiment of the present invention provides a nonvolatile storage medium, where the storage medium stores at least one executable instruction, and the executable instruction may execute the multi-computer-room data processing method based on the micro service in any of the above method embodiments.
The executable instructions may be specifically configured to cause the processor to: configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room; receiving a data access request for any microservice; routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center; and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation.
In an alternative embodiment, the executable instructions further cause the processor to: dividing a plurality of micro services with a calling relationship into the same micro service group to obtain a plurality of micro service groups; and configuring the master machine room and the slave machine room for each micro-service group in the configuration center by taking the micro-service group as a unit.
In an alternative embodiment, the executable instructions further cause the processor to: determining a processing machine room of the micro-service according to configuration information stored in the domain name server, and performing routing processing on the data access request according to the processing machine room of the micro-service; judging whether a processing machine room of the micro service is consistent with a main machine room of the micro service or not according to configuration information stored in a gateway; if so, processing the data access request by the mainframe room of the micro-service; if not, the data access request is forwarded to the mainframe room of the microservice for processing.
In an alternative embodiment, the executable instructions further cause the processor to: and forwarding the data access request to the micro-service mainframe room for processing through a public network or a special machine room line arranged between the processing machine room and the micro-service mainframe room.
In an alternative embodiment, the executable instructions further cause the processor to: the data access request is forwarded to a mainframe room of the microservice through a special line of the machine room; and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through the public network.
In an alternative embodiment, the executable instructions further cause the processor to: and writing the operation instruction of the data writing operation into the data access log, and synchronizing the data access log to the slave machine room of the microservice so that the slave machine room can execute the data writing operation according to the data access log.
Example four
Fig. 3 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention, and the specific embodiment of the present invention does not limit the specific implementation of the electronic device.
As shown in fig. 3, the electronic device may include: a processor (processor)302, a communication Interface 304, a memory 306, and a communication bus 308.
Wherein:
the processor 302, communication interface 304, and memory 306 communicate with each other via a communication bus 308.
A communication interface 304 for communicating with network elements of other devices, such as clients or other servers.
The processor 302 is configured to execute the program 310, and may specifically execute the relevant steps in the embodiment of the multi-room data processing method based on microservices.
In particular, program 310 may include program code comprising computer operating instructions.
The processor 302 may be a central processing unit CPU, or an application specific Integrated circuit (asic), or one or more Integrated circuits configured to implement an embodiment of the present invention. The electronic device comprises one or more processors, which can be the same type of processor, such as one or more CPUs; or may be different types of processors such as one or more CPUs and one or more ASICs.
And a memory 306 for storing a program 310. Memory 306 may comprise high-speed RAM memory and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The program 310 may specifically be configured to cause the processor 302 to perform the following operations: configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room; receiving a data access request for any microservice; routing the data access request to a main computer room of the micro-service according to the configuration information of the configuration center; and if the data access request is a data write-in request, executing data write-in operation to write data into the database of the main machine room of the micro service, and synchronizing the data write-in operation to the slave machine room of the micro service so that the slave machine room executes the data write-in operation.
In an alternative embodiment, program 310 further causes processor 302 to: dividing a plurality of micro services with a calling relationship into the same micro service group to obtain a plurality of micro service groups; and configuring the master machine room and the slave machine room for each micro-service group in the configuration center by taking the micro-service group as a unit.
In an alternative embodiment, program 310 further causes processor 302 to: determining a processing machine room of the micro-service according to configuration information stored in the domain name server, and performing routing processing on the data access request according to the processing machine room of the micro-service; judging whether a processing machine room of the micro service is consistent with a main machine room of the micro service or not according to configuration information stored in a gateway; if so, processing the data access request by the mainframe room of the micro-service; if not, the data access request is forwarded to the mainframe room of the microservice for processing.
In an alternative embodiment, program 310 further causes processor 302 to: and forwarding the data access request to the micro-service mainframe room for processing through a public network or a special machine room line arranged between the processing machine room and the micro-service mainframe room.
In an alternative embodiment, program 310 further causes processor 302 to: the data access request is forwarded to a mainframe room of the microservice through a special line of the machine room; and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through the public network.
In an alternative embodiment, program 310 further causes processor 302 to: and writing the operation instruction of the data writing operation into the data access log, and synchronizing the data access log to the slave machine room of the microservice so that the slave machine room can execute the data writing operation according to the data access log.
For specific implementation of each step in the program 310, reference may be made to the description corresponding to the corresponding step in the multi-computer-room data processing embodiment based on the micro service, which is not described herein again. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described device may refer to the corresponding process description in the foregoing method embodiment, and is not described herein again.
By the scheme provided by the embodiment, the precise configuration of the master machine room and the slave machine room based on the micro-services is realized, and a plurality of micro-services with calling relations can be called in real time without being influenced by unstable factors such as network jitter existing in a special line of the machine room and a public network; moreover, the data access request aiming at the micro service is always processed by the main machine room of the micro service, and the main machine room is used as hot standby; and unidirectional data synchronization from the main machine room to the slave machine room is realized, data collision in a multi-machine-room scene is effectively avoided, and a multi-machine-room data processing mode is optimized.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
Claims (15)
1. A multi-machine-room data processing method based on micro-service is characterized in that a main machine room and a slave machine room are configured for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
the method comprises the following steps:
receiving a data access request for any microservice;
routing the data access request to a main computer room of the microservice according to configuration information of a configuration center;
if the data access request is a data write-in request, executing data write-in operation to write data into a database of a main machine room of the micro service, and synchronizing the data write-in operation to a slave machine room of the micro service so that the slave machine room can execute the data write-in operation;
wherein the configuring the master room and the slave room for each microservice at the configuration center further comprises: dividing a plurality of micro services with a calling relationship into the same micro service group to obtain a plurality of micro service groups; and configuring the master machine room and the slave machine room for each micro-service group in the configuration center by taking the micro-service group as a unit.
2. The method of claim 1, the routing data access requests to the primary premises of the microservice according to configuration information of a configuration center further comprising:
determining a processing machine room of the micro-service according to configuration information stored in a domain name server, and performing routing processing on the data access request according to the processing machine room of the micro-service;
judging whether the processing machine room of the micro service is consistent with the main machine room of the micro service or not according to configuration information stored in a gateway;
if so, processing the data access request by the mainframe room of the microservice;
if not, the data access request is forwarded to the mainframe room of the microservice for processing.
3. The method of claim 2, the forwarding the data access request to the main housing of the microservice for processing further comprising:
and forwarding the data access request to the micro-service host computer room for processing through a public network or a special machine room line arranged between the processing machine room and the micro-service host computer room.
4. The method of claim 3, wherein forwarding the data access request to the main room of the microservice for processing via a public network or a machine room dedicated line disposed between the processing machine room and the main room of the microservice further comprises:
the data access request is forwarded to the mainframe room of the microservice through the special line of the machine room;
and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through a public network.
5. The method of any of claims 1-4, the synchronizing the data write operation to a slave machine room of the microservice for the slave machine room to perform the data write operation further comprising:
and writing the operation instruction of the data writing operation into a data access log, and synchronizing the data access log to the slave machine room of the microservice so that the slave machine room executes the data writing operation according to the data access log.
6. An electronic device, comprising: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to:
configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
receiving a data access request for any microservice;
routing the data access request to a main computer room of the microservice according to configuration information of a configuration center;
if the data access request is a data write-in request, executing data write-in operation to write data into a database of a main machine room of the micro service, and synchronizing the data write-in operation to a slave machine room of the micro service so that the slave machine room can execute the data write-in operation;
wherein the executable instructions further cause the processor to: dividing a plurality of micro services with a calling relationship into the same micro service group to obtain a plurality of micro service groups; and configuring the master machine room and the slave machine room for each micro-service group in the configuration center by taking the micro-service group as a unit.
7. The electronic device of claim 6, the executable instructions further cause the processor to:
determining a processing machine room of the micro-service according to configuration information stored in a domain name server, and performing routing processing on the data access request according to the processing machine room of the micro-service;
judging whether the processing machine room of the micro service is consistent with the main machine room of the micro service or not according to configuration information stored in a gateway;
if so, processing the data access request by the mainframe room of the microservice;
if not, the data access request is forwarded to the mainframe room of the microservice for processing.
8. The electronic device of claim 7, the executable instructions further cause the processor to:
and forwarding the data access request to the micro-service host computer room for processing through a public network or a special machine room line arranged between the processing machine room and the micro-service host computer room.
9. The electronic device of claim 8, the executable instructions further cause the processor to:
the data access request is forwarded to the mainframe room of the microservice through the special line of the machine room;
and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through a public network.
10. The electronic device of any of claims 6-9, the executable instructions further cause the processor to:
and writing the operation instruction of the data writing operation into a data access log, and synchronizing the data access log to the slave machine room of the microservice so that the slave machine room executes the data writing operation according to the data access log.
11. A storage medium having stored therein at least one executable instruction that causes a processor to:
configuring a main machine room and a slave machine room for each micro-service in a configuration center; wherein a plurality of microservices having a calling relationship with each other are configured as the same master room and the same slave room;
receiving a data access request for any microservice;
routing the data access request to a main computer room of the microservice according to configuration information of a configuration center;
if the data access request is a data write-in request, executing data write-in operation to write data into a database of a main machine room of the micro service, and synchronizing the data write-in operation to a slave machine room of the micro service so that the slave machine room can execute the data write-in operation;
wherein the executable instructions further cause the processor to: dividing a plurality of micro services with a calling relationship into the same micro service group to obtain a plurality of micro service groups; and configuring the master machine room and the slave machine room for each micro-service group in the configuration center by taking the micro-service group as a unit.
12. The storage medium of claim 11, the executable instructions further causing the processor to:
determining a processing machine room of the micro-service according to configuration information stored in a domain name server, and performing routing processing on the data access request according to the processing machine room of the micro-service;
judging whether the processing machine room of the micro service is consistent with the main machine room of the micro service or not according to configuration information stored in a gateway;
if so, processing the data access request by the mainframe room of the microservice;
if not, the data access request is forwarded to the mainframe room of the microservice for processing.
13. The storage medium of claim 12, the executable instructions further causing the processor to:
and forwarding the data access request to the micro-service host computer room for processing through a public network or a special machine room line arranged between the processing machine room and the micro-service host computer room.
14. The storage medium of claim 13, the executable instructions further causing the processor to:
the data access request is forwarded to the mainframe room of the microservice through the special line of the machine room;
and if the forwarding fails, forwarding the data access request to the mainframe room of the microservice through a public network.
15. The storage medium of any one of claims 11-14, the executable instructions further causing the processor to:
and writing the operation instruction of the data writing operation into a data access log, and synchronizing the data access log to the slave machine room of the microservice so that the slave machine room executes the data writing operation according to the data access log.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927223.5A CN110633175B (en) | 2019-09-27 | 2019-09-27 | Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910927223.5A CN110633175B (en) | 2019-09-27 | 2019-09-27 | Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110633175A CN110633175A (en) | 2019-12-31 |
CN110633175B true CN110633175B (en) | 2020-07-28 |
Family
ID=68973124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910927223.5A Active CN110633175B (en) | 2019-09-27 | 2019-09-27 | Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110633175B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111464592B (en) * | 2020-03-09 | 2023-07-25 | 平安科技(深圳)有限公司 | Load balancing method, device, equipment and storage medium based on micro-service |
WO2021212493A1 (en) * | 2020-04-24 | 2021-10-28 | 深圳市欢太科技有限公司 | Data synchronization method and device, data storage system and computer-readable medium |
CN112015744B (en) * | 2020-08-18 | 2024-05-31 | 广州市百果园信息技术有限公司 | Configuration data access method, device, equipment, configuration center and storage medium |
CN112052091A (en) * | 2020-09-04 | 2020-12-08 | 掌阅科技股份有限公司 | Processing method of service call request under multi-computer-room deployment and computing equipment |
CN113703789B (en) * | 2021-08-04 | 2024-07-26 | 德邦证券股份有限公司 | Method, device and storage medium for deploying micro-service program |
CN113810474B (en) * | 2021-08-30 | 2023-04-28 | 福建天泉教育科技有限公司 | Request distribution method and terminal |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104794155A (en) * | 2015-03-12 | 2015-07-22 | 北京奇虎科技有限公司 | Data loading method, device and system |
CN104980519A (en) * | 2015-06-29 | 2015-10-14 | 北京奇虎科技有限公司 | Multi-computer room storage system |
CN109324942A (en) * | 2018-08-07 | 2019-02-12 | 顺丰科技有限公司 | The dual-active processing method of micro services, apparatus and system, equipment, storage medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107612955A (en) * | 2016-07-12 | 2018-01-19 | 深圳市远行科技股份有限公司 | Micro services provide method, apparatus and system |
US10484410B2 (en) * | 2017-07-19 | 2019-11-19 | Cisco Technology, Inc. | Anomaly detection for micro-service communications |
-
2019
- 2019-09-27 CN CN201910927223.5A patent/CN110633175B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104794155A (en) * | 2015-03-12 | 2015-07-22 | 北京奇虎科技有限公司 | Data loading method, device and system |
CN104980519A (en) * | 2015-06-29 | 2015-10-14 | 北京奇虎科技有限公司 | Multi-computer room storage system |
CN109324942A (en) * | 2018-08-07 | 2019-02-12 | 顺丰科技有限公司 | The dual-active processing method of micro services, apparatus and system, equipment, storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110633175A (en) | 2019-12-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110633175B (en) | Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium | |
CN110673941B (en) | Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium | |
US9378068B2 (en) | Load balancing for a virtual networking system | |
CN108712332B (en) | Communication method, system and device | |
US20170070597A1 (en) | Client-initiated leader election in distributed client-server systems | |
CN106031116A (en) | Method, apparatus and system for associating NS with VNF | |
US11095716B2 (en) | Data replication for a virtual networking system | |
CN107005435B (en) | Network service descriptor shelving method and device | |
CN112910685B (en) | Method and device for realizing unified management of container network | |
CN112035216B (en) | Communication method for Kubernetes cluster network and OpenStack network | |
CN106059946B (en) | Message forwarding method and device | |
CN109995842B (en) | Grouping method and device for distributed server cluster | |
CN105791344A (en) | Grayscale release service processing method, system, load balancer and service bus device | |
US9390156B2 (en) | Distributed directory environment using clustered LDAP servers | |
CN104468150A (en) | Method for realizing fault migration through virtual host and virtual host service device | |
CN110213365B (en) | User access request processing method based on user partition and electronic equipment | |
JP6741872B2 (en) | Resource scheduling | |
CN114172853A (en) | Flow forwarding and bare computer server configuration method and device | |
CN110855488A (en) | Virtual machine access method and device | |
US10243920B1 (en) | Internet protocol address reassignment between virtual machine instances | |
CN104917800A (en) | Method and device for establishing redundancy connection for virtual machine | |
CN114979286A (en) | Access control method, device and equipment for container service and computer storage medium | |
CN114172753B (en) | Address reservation method, network equipment and system | |
EP1589424A2 (en) | Vertical perimeter framework for providing application services in multi-CPU environments | |
CN111600833B (en) | Network operating system and message forwarding method |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |