CN110673941A - Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium - Google Patents

Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium Download PDF

Info

Publication number
CN110673941A
CN110673941A CN201910928042.4A CN201910928042A CN110673941A CN 110673941 A CN110673941 A CN 110673941A CN 201910928042 A CN201910928042 A CN 201910928042A CN 110673941 A CN110673941 A CN 110673941A
Authority
CN
China
Prior art keywords
host computer
migrated
computer room
room
data
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.)
Granted
Application number
CN201910928042.4A
Other languages
Chinese (zh)
Other versions
CN110673941B (en
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.)
Ireader Technology Co Ltd
Zhangyue Technology Co Ltd
Original Assignee
Zhangyue Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhangyue Technology Co Ltd filed Critical Zhangyue Technology Co Ltd
Priority to CN201910928042.4A priority Critical patent/CN110673941B/en
Publication of CN110673941A publication Critical patent/CN110673941A/en
Application granted granted Critical
Publication of CN110673941B publication Critical patent/CN110673941B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • G06F9/4856Task life-cycle, e.g. stopping, restarting, resuming execution resumption being on a different machine, e.g. task migration, virtual machine migration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a migration method of micro-services in multiple machine rooms, electronic equipment and a storage medium, wherein the method comprises the following steps: determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated; utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room; generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room; and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read. According to the scheme, the target host computer room provides external data access aiming at the micro service to be migrated after the data synchronization of the source host computer room and the target host computer room is completed, and data collision caused by migration of the micro service among a plurality of computer rooms is effectively avoided.

Description

Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of information processing, in particular to a migration method of micro-services in multiple machine rooms, 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. In an actual application scenario, a situation that a service needs to be migrated from one machine room to another machine room due to traffic balance, network conditions, and the like may also occur, however, data synchronization between multiple machine rooms is delayed, and once data synchronization is not completed in time between multiple machine rooms when the service is completed, data of multiple machine rooms are not consistent, and a problem of data collision may occur.
Disclosure of Invention
In view of the above, the present invention is proposed to provide a migration method of micro-services in multiple rooms, 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 migration method of micro-services in multiple computer rooms is provided, wherein the method comprises the following steps:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room;
and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
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:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room;
and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
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:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room;
and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
According to the technical scheme provided by the invention, the external data access of each micro-service in a plurality of machine rooms is effectively managed and controlled by the additionally arranged switch assembly, according to the data migration request aiming at the micro-service to be migrated, the external data access of the micro-service to be migrated in the source host room is closed by the switch assembly, then probe data is generated, the probe data is written into the data access log of the source host room, the data access log of the source host room is synchronized to the target host room so that the target host room reads the data access log for database updating, when the target host room reads the probe data, the data synchronization between the source host room and the target host room is completed, the external data access of the micro-service to be migrated in the target host room is started by the switch assembly, thereby ensuring that at most one machine room provides the external data access aiming at the micro-service to be migrated at any moment, and ensuring that the target host computer room provides external data access aiming at the micro service to be migrated after the data synchronization is finished between the source host computer room and the target host computer room, effectively avoiding data conflict caused by the migration of the micro service among a plurality of computer rooms, and optimizing the migration mode of the micro service in the plurality of computer rooms.
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 migration method of microservices in multiple machine rooms according to a first embodiment of the present invention;
fig. 2 is a flowchart illustrating a migration method of micro-services in multiple machine rooms 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 migration method of microservices in multiple rooms according to a first embodiment of the present invention, where as shown in fig. 1, the method includes the following steps:
step S101, according to the data migration request aiming at the micro service to be migrated, determining a source host computer room and a target host computer room corresponding to the micro service to be migrated.
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.
The main machine room of the micro-service is used for providing external data access for each micro-service, and when the main machine room provides the external data access, the auxiliary machine room does not provide the external data access and is used as hot standby. When the traffic of a plurality of machine rooms is unbalanced or a network condition of a certain machine room is abnormal, one or more micro-services need to be migrated from an original host machine room to other machine rooms, and the other machine rooms continue to provide access to external data. In the invention, the micro-service to be migrated is called the micro-service to be migrated, the original host room corresponding to the micro-service to be migrated is called the source host room corresponding to the micro-service to be migrated, and the other machine rooms to which the micro-service to be migrated needs to be migrated are called the target host rooms corresponding to the micro-service to be migrated.
When the micro service migration requirement exists, triggering a data migration request aiming at the micro service to be migrated, wherein the data migration request can comprise: the micro-service identifier to be migrated may be a name of the micro-service to be migrated or a micro-service ID of the micro-service to be migrated. Then, in step S101, a source host room corresponding to the micro service to be migrated may be determined according to the source host room identifier in the data migration request, and a target host room corresponding to the micro service to be migrated may be determined according to the target host room identifier in the data migration request.
And S102, utilizing the switch component to close the external data access of the micro service to be migrated in the source host computer room.
In order to effectively manage and control the external data access of each micro-service in a plurality of machine rooms, the invention adds a switch component on the basis of the existing multi-machine-room management technology, after the configuration center completes the configuration of the main machine room and the slave machine room of each micro-service, for each micro-service, the switch component is utilized to open the external data access of the micro-service in the corresponding main machine room, and close the external data access of the micro-service in the corresponding slave machine room. After the source host computer room corresponding to the micro service to be migrated is determined in step S101, the switch component may be used to close the external data access of the micro service to be migrated in the source host computer room, so that the source host computer room may no longer receive the data access request for the micro service to be migrated.
Step S103, generating probe data, writing the probe data into the data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room.
Data synchronization needs to be completed between the source host computer room and the target host computer room to ensure that the target host computer room can provide reliable service. And due to the influence of the data transmission rate of the network link and the rate of reading the data access logs, the data synchronization among a plurality of computer rooms is delayed. In order to effectively identify whether data synchronization is completed between the source host computer room and the target host computer room, probe data is generated after the switch component is utilized to close the external data access of the micro service to be migrated in the source host computer room, the probe data can be data without actual operation meaning, and a person skilled in the art can set the specific content of the probe data according to actual needs, and the method is not limited herein.
After the probe data is generated, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room. Specifically, in addition to writing the probe data, the data access log of the source host room also writes an operation instruction of a data write operation performed by the source host room for the micro service to be migrated before the write position of the probe data, that is, in the data access log of the source host room, the write position of the probe data is located after the operation instruction of all data write operations performed by the source host room for the micro service to be migrated, and is used for identifying the end of data synchronization between the source host room and the target host room. And synchronizing the data access log of the source host computer room to the target host computer room so that the target host computer room can read the data access log to update the database.
And step S104, reading the data access log by the target host room to update the database, and starting external data access of the micro service to be migrated in the target host room by using the switch assembly when the probe data is read.
And the target host computer room reads the data access log of the source host computer room, and writes the data into the database of the target host computer room by executing the data writing operation recorded in the data access log, thereby realizing the updating of the database. When the target host computer room reads probe data in the data access log, it is indicated that the target host computer room has completed executing all data write-in operations executed by the source host computer room for the micro service to be migrated, that is, data synchronization is completed between the source host computer room and the target host computer room, and the target host computer room can already provide reliable service for the micro service to be migrated, then the switch assembly is used to start external data access of the micro service to be migrated in the target host computer room, so that the target host computer room provides external data access for the micro service to be migrated, and migration of the micro service to be migrated from the source host computer room to the target host computer room is completed. By the processing mode, the target host computer room can provide external data access aiming at the micro service to be migrated after the data synchronization of the source host computer room and the target host computer room is completed, and data conflict caused by the migration of the micro service among a plurality of computer rooms is effectively avoided.
By using the migration method of the microservice in the multiple machine rooms provided by the embodiment, the external data access of each microservice in the multiple machine rooms is effectively managed and controlled through the additionally arranged switch assembly, according to the data migration request aiming at the microservice to be migrated, the external data access of the microservice to be migrated in the source host room is firstly closed through the switch assembly, then probe data is generated, the probe data is written into the data access log of the source host room, the data access log of the source host room is synchronized to the target host room so that the target host room reads the data access log for updating the database, when the target host room reads the probe data, the data synchronization between the source host room and the target host room is completed, the external data access of the microservice to be migrated in the target host room is started through the switch assembly, and therefore, the condition that at most one machine room provides the external data access aiming at the microservice to be migrated at any moment is ensured, and ensuring that the target host computer room provides external data access aiming at the micro service to be migrated after the data synchronization is finished between the source host computer room and the target host computer room, effectively avoiding data conflict caused by the migration of the micro service among a plurality of computer rooms, and optimizing the migration mode of the micro service in the plurality of computer rooms.
Example two
Fig. 2 is a flowchart illustrating a migration method of micro services in multiple machine rooms according to a second embodiment of the present invention, where as shown in fig. 2, the method includes the following steps:
step S201, configuring a master machine room and a slave machine room for each micro service in a configuration center.
And a main machine room and a slave machine room can be configured for each micro-service in the configuration center based on the principles of machine room flow balance and the like. 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. Some micro services need to be called each other, for example, a plurality of micro services related to user production content need to be called each other, or a plurality of micro services related to user account assets need to be called 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 enable a plurality of micro services having a calling relationship with each other to be called in real time, in the present invention, the plurality of micro services having a calling relationship with each other are configured as the same master room and the same slave room. Specifically, a 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 main machine room and a slave machine room are configured for each micro service group in a configuration center by taking the micro service group as a unit. 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.
Step S202, according to the data migration request aiming at the micro service to be migrated, determining a source host computer room and a target host computer room corresponding to the micro service to be migrated.
The data migration request can be triggered according to the updated configuration of the micro service to be migrated in the configuration center. For example, when there is traffic imbalance in multiple machine rooms or when a network condition is abnormal in a certain machine room, the configuration of a master machine room and a slave machine room of the microservice to be migrated needs to be updated, and the microservice to be migrated is migrated from the source machine room to the target machine room, then the data migration request may be triggered according to the updated configuration of the microservice to be migrated in the configuration center. In addition, in the configuration center, other machine rooms except the target main machine room in the plurality of machine rooms can be configured as slave machine rooms corresponding to the micro-service to be migrated.
Wherein, the data migration request may include: in step S202, the source host room and the target host room corresponding to the micro service to be migrated may be determined according to the source host room identifier and the target host room identifier in the data migration request, based on the information such as the micro service identifier, the source host room identifier, and the target host room identifier of the micro service to be migrated.
Specifically, the target host computer room corresponding to the micro service to be migrated may be a slave computer room originally corresponding to the micro service to be migrated, or may be a computer room other than the slave computer room instead of the slave computer room. If the target host machine room corresponding to the micro service to be migrated is the slave machine room, since all data of the micro service to be migrated is stored in the slave machine room, data migration for the micro service to be migrated does not need to be performed between the source host machine room and the target host machine room. If the target host computer room corresponding to the micro service to be migrated is not the slave computer room, the target host computer room may not store all the data of the micro service to be migrated, and the data migration between the source host computer room and the target host computer room for the micro service to be migrated needs to be started.
And step S203, utilizing the switch component to close the external data access of the micro service to be migrated in the source host computer room.
The invention adds a switch component, generates configuration information after the configuration center completes the configuration of the host computer room and the slave computer room of each micro-service, and utilizes the switch component to open the external data access of each micro-service in the corresponding host computer room and close the external data access of each micro-service in the corresponding slave computer room according to the configuration information. After the source host computer room corresponding to the micro service to be migrated is determined in step S203, the switch component may be utilized to close the external data access of the micro service to be migrated in the source host computer room, so that the source host computer room may no longer receive the data access request for the micro service to be migrated.
And step S204, generating probe data, writing the probe data into the data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room.
In order to effectively identify whether data synchronization is finished between a source host computer room and a target host computer room, probe data is generated according to a preset data generation rule after a switch component is utilized to close external data access of a micro service to be migrated in the source host computer room, wherein the probe data is data without actual operation meaning, for example, the specific content of the generated probe data can be "# # # # # abcde # # # # #". And writing the generated probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room so that the target host computer room can read the data access log to update the database. In the data access log of the source host computer room, the writing position of the probe data is located after the operation instruction of all data writing operations executed by the source host computer room for the micro service to be migrated, and is used for identifying the end of data synchronization between the source host computer room and the target host computer room.
And S205, reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
If the target host computer room corresponding to the micro service to be migrated is the slave computer room, the target host computer room can directly read the data access log to update the database; and if the target host computer room corresponding to the micro service to be migrated is not the slave computer room, after the data migration is finished, the target host computer room reads the data access log again to update the database. Specifically, the target host computer room reads the data access log of the source host computer room, and writes the data into the database of the target host computer room by performing data write operation recorded in the data access log, thereby implementing database update. When the target host computer room reads the probe data in the data access log, it is indicated that the target host computer room has completed the execution of all data write-in operations executed by the source host computer room for the micro service to be migrated, that is, data synchronization is completed, then the switch assembly is used to start the external data access of the micro service to be migrated in the target host computer room, so that the target host computer room provides the external data access for the micro service to be migrated, and the migration of the micro service to be migrated from the source host computer room to the target host computer room is completed.
Step S206, receiving a data access request aiming at the micro service to be migrated.
After the switch assembly is used for starting the external data access of the micro-service to be migrated in the target host computer room, the target host computer room can provide the external data access aiming at the micro-service to be migrated. When a user or a business operation and maintenance person and the like want to access data of the micro service to be migrated, a data access request aiming at the micro service to be migrated can be sent, wherein the data access request can carry information such as micro service identification, a request method, request content, a request URL (uniform resource locator), a requested server address and a communication protocol. A data access request for the microservice to be migrated is received in step S206. After receiving the data access request, the data access request is routed to the target host computer room corresponding to the micro service to be migrated according to the configuration information of the configuration center, and the data access request is processed by the target host computer room.
Step S207, if the data access request is a data write request, performing a data write operation to write data into the database of the target host computer room corresponding to the micro service to be migrated, and synchronizing the data write operation to the slave computer room corresponding to the micro service to be migrated, so that the slave computer 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 target host computer room corresponding to the micro service to be migrated; if the data access request is a data write request, performing data write operation to write data into the database of the target host room corresponding to the micro service to be migrated, and updating the data in the database of the target host room by performing the data write operation.
By using the migration method of the micro-services in the multiple machine rooms provided by the embodiment, the configuration center configures the master machine room and the slave machine room for each micro-service, so that the precise configuration of the master machine room and the slave machine room based on the micro-services is realized, and the same master machine room and the same slave machine room are configured for the multiple micro-services with the calling relationship with each other, so that the multiple 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 machine room and a public network; when the micro-service migration requirement exists, the outward data access of the micro-service to be migrated in the source host room is closed by utilizing the additionally arranged switch assembly, the end of data synchronization between the source host room and the target host room is identified by the probe data written in the data access log of the source host room, and when the probe data is read by the target host room, the outward data access of the micro-service to be migrated in the target host room is opened by utilizing the switch assembly, so that the outward data access aiming at the micro-service to be migrated is provided by the target host room after the data synchronization of the source host room and the target host room is finished, and the data conflict caused by the migration of the micro-service among a plurality of machine rooms is effectively avoided; in addition, unidirectional data synchronization from the main machine room to the auxiliary machine room is realized, and data collision in a multi-machine-room scene is effectively avoided.
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 migration method of the micro-service in multiple computer rooms in any of the above method embodiments.
The executable instructions may be specifically configured to cause the processor to: determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated; utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room; generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room; and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
In an alternative embodiment, the executable instructions further 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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
In an alternative embodiment, the executable instructions further cause the processor to: and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro-service to be migrated.
In an alternative embodiment, the executable instructions further cause the processor to: receiving a data access request aiming at the micro service to be migrated; and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so as to enable the slave computer room to execute the data write-in operation.
In an alternative embodiment, the data migration request includes: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.
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 relevant steps in the migration method embodiment of the microservice in multiple computer rooms.
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: determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to the data migration request aiming at the micro service to be migrated; utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room; generating probe data, writing the probe data into a data access log of a source host computer room, and synchronizing the data access log of the source host computer room to a target host computer room; and reading the data access log by the target host computer room to update the database, and starting external data access of the micro service to be migrated in the target host computer room by using the switch assembly when the probe data is read.
In an alternative embodiment, program 310 further causes processor 302 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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
In an alternative embodiment, program 310 further causes processor 302 to: and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro-service to be migrated.
In an alternative embodiment, program 310 further causes processor 302 to: receiving a data access request aiming at the micro service to be migrated; and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so as to enable the slave computer room to execute the data write-in operation.
In an alternative embodiment, the data migration request includes: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.
For specific implementation of each step in the program 310, reference may be made to the description corresponding to the corresponding step in the migration embodiment of the microservice in multiple computer rooms, 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 condition that at most one machine room provides external data access for the micro-service to be migrated at any moment is ensured, the target host machine room provides external data access for the micro-service to be migrated after the data synchronization is completed between the source host machine room and the target host machine room, data collision caused by migration of the micro-service among the machine rooms is effectively avoided, and the migration mode of the micro-service in the machine rooms 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.
The invention discloses: A1. a migration method of micro-services in multiple computer rooms, wherein the method comprises the following steps:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
A2. Before the determining, according to the data migration request for the microservice to be migrated, the source host room and the target host room corresponding to the microservice to be migrated according to a1, the method further includes:
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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
A3. The method of a1, the method further comprising:
and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro service to be migrated.
A4. The method according to a1, wherein after the utilizing a switch component to turn on the external data access of the micro service to be migrated at the target host computer room, the method further comprises:
receiving a data access request aiming at the micro service to be migrated;
and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so that the slave computer room can execute the data write-in operation.
A5. The method of any of A1-A4, the data migration request comprising: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.
The invention also discloses: B6. 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:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
B7. The electronic device of B6, the executable instructions further 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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
B8. The electronic device of B6, the executable instructions further cause the processor to:
and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro service to be migrated.
B9. The electronic device of B6, the executable instructions further cause the processor to:
receiving a data access request aiming at the micro service to be migrated;
and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so that the slave computer room can execute the data write-in operation.
B10. The electronic device of any of B6-B9, the data migration request comprising: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.
The invention also discloses: C11. a storage medium having stored therein at least one executable instruction that causes a processor to:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
C12. The storage medium of C11, the executable instructions further 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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
C13. The storage medium of C11, the executable instructions further cause the processor to:
and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro service to be migrated.
C14. The storage medium of C11, the executable instructions further cause the processor to:
receiving a data access request aiming at the micro service to be migrated;
and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so that the slave computer room can execute the data write-in operation.
C15. The storage medium of any one of C11-C14, the data migration request comprising: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.

Claims (10)

1. A migration method of micro-services in multiple computer rooms, wherein the method comprises the following steps:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
2. The method of claim 1, before the determining, according to the data migration request for the micro service to be migrated, a source host room and a target host room corresponding to the micro service to be migrated, the method further comprising:
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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
3. The method of claim 1, further comprising:
and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro service to be migrated.
4. The method of claim 1, after the utilizing a switch component to turn on outbound data access of the to-be-migrated microservice at the target host computer room, the method further comprising:
receiving a data access request aiming at the micro service to be migrated;
and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so that the slave computer room can execute the data write-in operation.
5. The method of any of claims 1-4, the data migration request comprising: the micro-service identification of the micro-service to be migrated, the source mainframe room identification and the target mainframe room identification.
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:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
7. The electronic device of claim 6, the executable instructions further 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; the data migration request is triggered according to the updated configuration of the micro service to be migrated in the configuration center.
8. The electronic device of claim 6, the executable instructions further cause the processor to:
and configuring other machine rooms except the target main machine room in the plurality of machine rooms as slave machine rooms corresponding to the micro service to be migrated.
9. The electronic device of claim 6, the executable instructions further cause the processor to:
receiving a data access request aiming at the micro service to be migrated;
and if the data access request is a data write-in request, executing data write-in operation to write data into a database of a target host computer room corresponding to the micro service to be migrated, and synchronizing the data write-in operation to a slave computer room corresponding to the micro service to be migrated so that the slave computer room can execute the data write-in operation.
10. A storage medium having stored therein at least one executable instruction that causes a processor to:
determining a source host computer room and a target host computer room corresponding to the micro service to be migrated according to a data migration request aiming at the micro service to be migrated;
utilizing a switch component to close the external data access of the micro service to be migrated in the source host computer room;
generating probe data, writing the probe data into a data access log of the source host computer room, and synchronizing the data access log of the source host computer room to the target host computer room;
and the target host computer room reads the data access log to update the database, and when the probe data are read, the switch assembly is utilized to start the external data access of the micro service to be migrated in the target host computer room.
CN201910928042.4A 2019-09-27 2019-09-27 Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium Active CN110673941B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910928042.4A CN110673941B (en) 2019-09-27 2019-09-27 Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910928042.4A CN110673941B (en) 2019-09-27 2019-09-27 Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110673941A true CN110673941A (en) 2020-01-10
CN110673941B CN110673941B (en) 2020-07-17

Family

ID=69079694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910928042.4A Active CN110673941B (en) 2019-09-27 2019-09-27 Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110673941B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111800462A (en) * 2020-05-28 2020-10-20 中国平安财产保险股份有限公司 Micro-service instance processing method and device, computer equipment and storage medium
CN112068943A (en) * 2020-09-08 2020-12-11 山东省计算中心(国家超级计算济南中心) Micro-service scheduling method based on complex heterogeneous environment and implementation system thereof
CN112131056A (en) * 2020-09-17 2020-12-25 掌阅科技股份有限公司 Control method, system, computing device and storage medium for switching services of multiple machine rooms
CN112632032A (en) * 2020-12-18 2021-04-09 华人运通(上海)云计算科技有限公司 Data migration method and device, storage medium and terminal equipment
CN112817567A (en) * 2021-01-28 2021-05-18 中国科学技术大学 Openwhisk no-service framework migration method for micro-service application
CN112817713A (en) * 2021-01-27 2021-05-18 广州虎牙科技有限公司 Job scheduling method and device and electronic equipment
CN115004662A (en) * 2020-04-24 2022-09-02 深圳市欢太科技有限公司 Data synchronization method, data synchronization device, data storage system and computer readable medium

Citations (10)

* Cited by examiner, † Cited by third party
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
CN105653630A (en) * 2015-12-25 2016-06-08 北京奇虎科技有限公司 Data migration method and apparatus for distributed database
CN106533805A (en) * 2016-12-23 2017-03-22 郑州云海信息技术有限公司 Micro-service request processing method, micro-service controller and micro-service architecture
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
CN107872334A (en) * 2016-09-23 2018-04-03 中兴通讯股份有限公司 The method and device that gray scale upgrades in a kind of micro services architecture system
CN108848092A (en) * 2018-06-20 2018-11-20 中国联合网络通信集团有限公司 The processing method and processing device of micro services gray scale publication based on call chain
CN109324942A (en) * 2018-08-07 2019-02-12 顺丰科技有限公司 The dual-active processing method of micro services, apparatus and system, equipment, storage medium
CN109933632A (en) * 2019-04-04 2019-06-25 杭州数梦工场科技有限公司 A kind of data migration method of database, device and equipment
US20190284961A1 (en) * 2018-03-16 2019-09-19 Uop Llc Steam reboiler with turbine

Patent Citations (10)

* Cited by examiner, † Cited by third party
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
CN105653630A (en) * 2015-12-25 2016-06-08 北京奇虎科技有限公司 Data migration method and apparatus for distributed database
CN107872334A (en) * 2016-09-23 2018-04-03 中兴通讯股份有限公司 The method and device that gray scale upgrades in a kind of micro services architecture system
CN106533805A (en) * 2016-12-23 2017-03-22 郑州云海信息技术有限公司 Micro-service request processing method, micro-service controller and micro-service architecture
CN106656604A (en) * 2016-12-23 2017-05-10 郑州云海信息技术有限公司 Microservice request management method, microservice controller and high-concurrence microservice architecture
US20190284961A1 (en) * 2018-03-16 2019-09-19 Uop Llc Steam reboiler with turbine
CN108848092A (en) * 2018-06-20 2018-11-20 中国联合网络通信集团有限公司 The processing method and processing device of micro services gray scale publication based on call chain
CN109324942A (en) * 2018-08-07 2019-02-12 顺丰科技有限公司 The dual-active processing method of micro services, apparatus and system, equipment, storage medium
CN109933632A (en) * 2019-04-04 2019-06-25 杭州数梦工场科技有限公司 A kind of data migration method of database, device and equipment

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115004662A (en) * 2020-04-24 2022-09-02 深圳市欢太科技有限公司 Data synchronization method, data synchronization device, data storage system and computer readable medium
CN111800462A (en) * 2020-05-28 2020-10-20 中国平安财产保险股份有限公司 Micro-service instance processing method and device, computer equipment and storage medium
CN111800462B (en) * 2020-05-28 2024-04-05 中国平安财产保险股份有限公司 Micro service instance processing method, micro service instance processing device, computer equipment and storage medium
CN112068943A (en) * 2020-09-08 2020-12-11 山东省计算中心(国家超级计算济南中心) Micro-service scheduling method based on complex heterogeneous environment and implementation system thereof
CN112068943B (en) * 2020-09-08 2022-11-25 山东省计算中心(国家超级计算济南中心) Micro-service scheduling method based on complex heterogeneous environment and implementation system thereof
CN112131056A (en) * 2020-09-17 2020-12-25 掌阅科技股份有限公司 Control method, system, computing device and storage medium for switching services of multiple machine rooms
CN112632032A (en) * 2020-12-18 2021-04-09 华人运通(上海)云计算科技有限公司 Data migration method and device, storage medium and terminal equipment
CN112632032B (en) * 2020-12-18 2022-12-27 华人运通(上海)云计算科技有限公司 Data migration method and device, storage medium and terminal equipment
CN112817713A (en) * 2021-01-27 2021-05-18 广州虎牙科技有限公司 Job scheduling method and device and electronic equipment
CN112817713B (en) * 2021-01-27 2023-10-13 广州虎牙科技有限公司 Job scheduling method and device and electronic equipment
CN112817567A (en) * 2021-01-28 2021-05-18 中国科学技术大学 Openwhisk no-service framework migration method for micro-service application

Also Published As

Publication number Publication date
CN110673941B (en) 2020-07-17

Similar Documents

Publication Publication Date Title
CN110673941B (en) Migration method of micro-services in multiple computer rooms, electronic equipment and storage medium
CN110633175B (en) Multi-computer-room data processing method based on micro-service, electronic equipment and storage medium
US11044230B2 (en) Dynamically opening ports for trusted application processes hosted in containers
US11368407B2 (en) Failover management using availability groups
CN107666493B (en) Database configuration method and equipment thereof
CN109361525B (en) Method, device, control terminal and medium for restarting distributed deployment of multiple services
US10673694B2 (en) Private network mirroring
US11336588B2 (en) Metadata driven static determination of controller availability
CN110855488B (en) Virtual machine access method and device
CN113141405B (en) Service access method, middleware system, electronic device, and storage medium
CN112202853B (en) Data synchronization method, system, computer device and storage medium
CN107580032B (en) Data processing method, device and equipment
CN112015595B (en) Master-slave database switching method, computing device and storage medium
CN104468150A (en) Method for realizing fault migration through virtual host and virtual host service device
JP2009237826A (en) Storage system and volume management method therefor
WO2020093976A1 (en) Resource change method and device, apparatus, and storage medium
CN112035216A (en) Communication method for Kubernetes cluster network and OpenStack network
CN110532123A (en) The failover method and device of HBase system
US12026494B2 (en) Dynamic automation of prerequisite component deployment in disconnected environments
CN114356521A (en) Task scheduling method and device, electronic equipment and storage medium
CN113411363A (en) Uploading method of image file, related equipment and computer storage medium
CN114172853A (en) Flow forwarding and bare computer server configuration method and device
CN113885797A (en) Data storage method, device, equipment and storage medium
EP3861445B1 (en) Method and apparatus for secure and verifiable composite service execution and fault management on blockchain
CN109656674B (en) Computer equipment, virtualization chip and data transmission 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