CN108733699A - Database leader follower replication system, method and apparatus - Google Patents
Database leader follower replication system, method and apparatus Download PDFInfo
- Publication number
- CN108733699A CN108733699A CN201710259734.5A CN201710259734A CN108733699A CN 108733699 A CN108733699 A CN 108733699A CN 201710259734 A CN201710259734 A CN 201710259734A CN 108733699 A CN108733699 A CN 108733699A
- Authority
- CN
- China
- Prior art keywords
- database
- database server
- server
- information
- leader follower
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Abstract
This application discloses database leader follower replication system, method and apparatus, database leader follower replication system includes control server, first database server and the second database server;Server is controlled, the internet protocol address for obtaining first database server and the second database server and the authorization message for carrying out leader follower replication between database;Generation includes the authorized order of the authorization message, and generates configuration-direct;The authorized order is sent to the first database server, and the configuration-direct is sent to second database server;First database server, for the authorization message to be sent to second database server;Second database server stores the authorization message;Locally carrying out leader follower replication configuration;Production Methods establish information, and send the relationship to the first database server and establish information.Embodiments herein, which avoids, repeatedly inputs the low problem of mode efficiency.
Description
Technical field
This application involves field of computer technology, and in particular to Internet technical field more particularly to database principal and subordinate are multiple
System processed, method and apparatus.
Background technology
In Internet era, can all there is a large amount of new information to generate daily, and how by a large amount of information accurately and efficiently
It records, is a problem to be solved.In the prior art, the mode that information backup generally use is repeatedly input, causes
It is less efficient.
Invention content
The purpose of the application is to propose a kind of improved database leader follower replication system, method and apparatus, come solve with
The technical issues of upper background technology part is mentioned.
In a first aspect, the embodiment of the present application provides a kind of database leader follower replication system, database leader follower replication system
Including control server, first database server and the second database server;Server is controlled, for obtaining the first data
The internet protocol address of library server and the second database server and for carrying out leader follower replication between database
Authorization message;According to the IP address of acquisition, generation includes the authorized order of authorization message, and it includes between database to generate
Carry out the configuration-direct of the configuration information of leader follower replication configuration;First database server is transmitted an authorization to, and will be matched
It sets instruction and is sent to the second database server;First database server, in response to receiving authorized order, will authorize
Information is sent to the second database server;Second database server, in response to receiving authorization message, storage to authorize
Information;In the case where being stored with authorization message, in response to receiving information configuration instruction, according to configuration information in local progress
Leader follower replication configures;According to authorization message, production Methods establish information, and send relationship to first database server and establish letter
Breath;First database server is additionally operable to reception relationship and establishes information, establishes and store with the data of first database server
Library is primary database and is the relationship from the leader follower replication of database with the database of the second database server.
In some embodiments, server is controlled, is additionally operable to:It is sent to the first database server where primary database
Parameter including parameter information more new command;First database server is additionally operable to:In response to receiving parameter more new command,
Recording parameters information in local primary database generates and refers to the duplication that the transmission of the second database server includes parameter information
It enables;And second database server be additionally operable to:In response to receiving duplicate instructions, the recording parameters in local slave database
Information.
In some embodiments, control server is additionally operable to:It is multiple to determine that first database server establishes database principal and subordinate
Whether the relationship of system succeeds;It is successfully established in response to determination, successful information is sent to specified display device.
In some embodiments, authorization message includes:Account and password for leader follower replication.
In some embodiments, server is controlled, is specifically used for:Targeting database server cluster is obtained, and by target
The IP address of targeting database server in database server cluster is as first database server and the second database
The IP address of server.
Second aspect, this application provides a kind of database leader follower replication method, this method includes:Obtain first database
The internet protocol address of server and the second database server and for carrying out awarding for leader follower replication between database
Weigh information;According to the IP address of acquisition, generate include authorization message authorized order, and generate include between being used for database into
The configuration-direct of the configuration information of row leader follower replication configuration;First database server is transmitted an authorization to, and will configuration
Instruction is sent to the second database server;Wherein, first database server is believed in response to receiving authorized order by authorizing
Breath is sent to the second database server;Second database server stores authorization message in response to receiving authorization message;?
In the case of being stored with authorization message, the second database server is in response to receiving information configuration instruction, according to configuration information
Locally carrying out leader follower replication configuration;For second database server according to authorization message, production Methods establish information, and to first
Database server sends relationship and establishes information;First database server receives relationship and establishes information, establishes and stores with the
The database of one database server is primary database and is the principal and subordinate from database with the database of the second database server
The relationship of duplication.
In some embodiments, this method further includes:Include to the first database server transmission where primary database
The parameter of parameter information more new command;Wherein, first database server is in response to receiving parameter more new command, in local
Recording parameters information in primary database, generate and to the second database server send include parameter information duplicate instructions;The
Two database servers are in response to receiving duplicate instructions, the recording parameters information in local slave database.
In some embodiments, this method further includes:Determine that first database server establishes database leader follower replication
Whether relationship succeeds;It is successfully established in response to determination, successful information is sent to specified display device.
In some embodiments, with obtaining the Internet protocol IP of first database server and the second database server
Location and between database carry out leader follower replication authorization message, including:Targeting database server cluster is obtained, and will
The IP address of targeting database server in targeting database server cluster is counted as first database server and second
According to the IP address of library server.
The third aspect, this application provides a kind of database leader follower replication device, device includes:Acquiring unit, for obtaining
Take the internet protocol address of first database server and the second database server and for being carried out between database
The authorization message of leader follower replication;Generation unit, for the IP address according to acquisition, generation includes the authorized order of authorization message,
And generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database;Transmission unit, being used for will
Authorized order is sent to first database server, and configuration-direct is sent to the second database server;Wherein, the first number
According to library server in response to receiving authorized order, authorization message is sent to the second database server;Second database takes
Business device stores authorization message in response to receiving authorization message;In the case where being stored with authorization message, the second database service
Device is locally carrying out leader follower replication configuration in response to receiving information configuration instruction, according to configuration information;Second database service
For device according to authorization message, production Methods establish information, and send relationship to first database server and establish information;First data
Library server receives relationship and establishes information, establishes and stores using the database of first database server as primary database and with the
The database of two database servers is the relationship from the leader follower replication of database.
Database leader follower replication system provided by the embodiments of the present application, method and apparatus, pass through IP address and generate and authorize letter
Breath and configuration information are avoided and are repeatedly input later by authorizing and configuring the foundation for the leader follower replication relationship for realizing database
The low problem of mode efficiency.
Description of the drawings
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that this application can be applied to exemplary system architecture figures therein;
Fig. 2 is the sequence diagram according to one embodiment of the database leader follower replication system of the application;
Fig. 3 is the sequence diagram according to another embodiment of the database leader follower replication system of the application;
Fig. 4 is the flow chart according to one embodiment of the database leader follower replication method of the application;
Fig. 5 is the structural schematic diagram according to an embodiment of the database leader follower replication device of the application;
Fig. 6 is adapted for the structural schematic diagram of the computer system of the server for realizing the embodiment of the present application.
Specific implementation mode
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Convenient for description, is illustrated only in attached drawing and invent relevant part with related.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase
Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the implementation of the database leader follower replication method or database leader follower replication device that can apply the application
The exemplary system architecture 100 of example.
As shown in Figure 1, system architecture 100 may include control server 101, and network 107, first database server
102,103 and second database server 104,105,106.Network 107 is in control server 101, first database clothes
It is engaged in providing the medium of communication link between device 102,103 and the second database server 104,105,106.Network 107 can wrap
Include various connection types, such as wired, wireless communication link or fiber optic cables etc..
Control server 101 can be to provide the server of various services, such as to first database server and second
Database server provides the server of data source.Control server 101 can utilize technical staff input or other set
Information that preparation is sent generates instruction, be sent to first database server 102,103 and the second database server 104,105,
106, so that first database server 102,103 and the second database server 104,105,106 are established to carry out data
The relationship of library leader follower replication.
First database server 102,103 and the second database server 104,105,106 are can to carry out data to deposit
The server of storage.Can establish first database server 102,103 database and the second database server 104,105,
The master-slave relationship of 106 database, to carry out leader follower replication.Herein, the database of first database server 102,103
All primary database can be used as to participate in leader follower replication, form the relationship that multi-source replicates.
It should be noted that the database leader follower replication method that the embodiment of the present application is provided can be by control server
101, first database server 102,103 and the second database server 104,105,106 execute jointly, correspondingly, data
Library leader follower replication device is generally positioned at control server 101, first database server 102,103 and the second database service
In device 104,105,106.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realization need
It wants, can have any number of network and server.
If being pointed out that in first database server 102,103 that only there are one servers as master server
Leader follower replication is carried out, at this point, first database server 102 can be not present in Fig. 1.
With continued reference to Fig. 2, Fig. 2 shows the sequential according to an embodiment of the database leader follower replication system of the application
Figure.
The database leader follower replication system of the present embodiment includes:Control server, first database server and the second number
According to library server.Control server, the Internet protocol for obtaining first database server and the second database server
IP address and between database carry out leader follower replication authorization message;According to the IP address of acquisition, generation includes authorizing
The authorized order of information, and generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database;
First database server is transmitted an authorization to, and configuration-direct is sent to the second database server;First data
Library server, in response to receiving authorized order, authorization message to be sent to the second database server;Second database
Server, in response to receiving authorization message, storing authorization message;In the case where being stored with authorization message, in response to
Information configuration instruction is received, leader follower replication configuration is locally being carried out according to configuration information;According to authorization message, production Methods are built
Vertical information, and send relationship to first database server and establish information;First database server is additionally operable to reception relationship and builds
Vertical information, establishes and stores using the database of first database server as primary database and with the number of the second database server
It is the relationship from the leader follower replication of database according to library.
Above-described embodiment of the application generates authorization message and configuration information by IP address, makes the corresponding service of IP address
Device establishes the relationship of leader follower replication.The relationship of the leader follower replication between server can be neatly established by IP address in this way.
Also, the present embodiment only needs once to be manually entered parameter in control server progress, without being repeated on database server
Input.It avoids and repeatedly inputs the low problem of mode efficiency.
As shown in Fig. 2, in step 201, control server obtains first database server and the second database service
The internet protocol address of device and between database carry out leader follower replication authorization message.
In the present embodiment, control server can obtain information that is other equipment transmission or being manually entered.Information
May include the IP address of first database server and the second database server, and for first database server
The database of database and the second database server carries out the authorization message of leader follower replication.The IP address and authorization message of acquisition
It is instructed for generating, to indicate that first database server and the second database server establish the relationship of leader follower replication.
Control server is the server distributed in systems into line command, and technical staff can use control server pair
System is managed.First database server and the second database server are all the server with database, Ke Yi
The information therein being used as in the database of data source is copied to by other databases by leader follower replication between database
On.It needs to carry out establishing the relationship of the leader follower replication of database between database before replicating.The relationship of leader follower replication is number
According to the relationship that can carry out leader follower replication between library.
Authorization message be database leader follower replication relationship establish during, i.e., by as the database of data source (
Here be the database in first database server) where server to will to data source carry out data backup data
What the server where library (being the database in the second database server herein) was sent is used to carry out awarding for leader follower replication
The information of power.
In some optional realization methods of the present embodiment, authorization message includes:For the account of leader follower replication and close
Code.
In step 202, for control server according to the IP address of acquisition, generation includes the authorized order of authorization message, and
Generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database.
In the present embodiment, control server can be according to the IP of the first database server got in step 201
The IP address of address and the second database server generates the authorized order that will be sent to first database server, authorizes
Instruction includes above-mentioned authorization message.And generation includes the configuration-direct of configuration information.Here configuration information is for second
Database carries out the information about leader follower replication relevant configuration.
Authorized order in order to control server sent to first database server, make first database server pair second
The instruction that database server is authorized.Configuration-direct in order to control server send, make the second database server this
Ground carries out the instruction of leader follower replication configuration.Using IP address as the destination address of instruction, and then generation authorized order and configuration refer to
It enables.Specifically, the destination address that the authorized order that control server generates includes is the IP address of first database server,
The destination address that the configuration-direct of generation includes is the IP address of the second database server.
Configuration information may include the related data for carrying out leader follower replication configuration, path of configuration etc..
It should be noted that generating authorized order and not differentiated between herein successively the step of generating configuration-direct.
In step 203, control server transmits an authorization to first database server.
In the present embodiment, the authorized order including authorization message of generation is sent to first database by control server
Server, so that first database server carries out Authorized operation.
In step 204, authorization message is sent to second by first database server in response to receiving authorized order
Database server.
In the present embodiment, after control server sends authorized order to first database server, the first data
Library server receives the authorized order, and responds, according to the second database server of authorized order pair received into
Row authorizes, and is that authorization message is sent to the second database server.
In step 205, the second database server stores authorization message in response to receiving authorization message.
In the present embodiment, the second database server receives the authorization message of first database server transmission, then
It responds, that is, stores the authorization message received.Second database server is after receiving authorization message, it may be determined that obtains
The mandate for carrying out leader follower replication to first database server was obtained, namely was allowed to the database of first database server
As primary database (namely data source), leader follower replication is carried out.
In step 206, configuration-direct is sent to the second database server by control server.
In the present embodiment, the configuration-direct including configuration information is sent to the second database service by control server
Device, so that the second database server carries out and the relevant configuration of leader follower replication.
In step 207, the second database server is in the case where being stored with authorization message, in response to receiving information
Configuration-direct is locally carrying out leader follower replication configuration according to configuration information.
In the present embodiment, even if receiving the mandate of first database server, the second database server can't
Enough carry out leader follower replication, it is also necessary to locally carry out relevant configuration.Specifically, the second database server is receiving mandate letter
After ceasing and being stored, the information configuration instruction that control server is sent is received, and respond, i.e., basis receives
Configuration information in configuration-direct is in the relevant configuration for locally carrying out leader follower replication.
During establishing the relationship of leader follower replication, the relevant configuration of leader follower replication is carried out in the database for backup
It is the common technology means of those skilled in the art, details are not described herein.
In a step 208, the second database server establishes information according to authorization message, production Methods.
In the present embodiment, the authorization message that the second database server is sent according to first database server generates
Relationship to establish the relationship of leader follower replication establishes information.
Relationship establish information be for established on first database server the database of first database server and
The information of the relationship of the leader follower replication of the database of second database server.
In step 209, the second database server sends relationship to first database server and establishes information.
In the present embodiment, which can be established and be believed after production Methods establish information by the second database server
Breath is sent to first database server.
In step 210, first database server receives relationship and establishes information, establishes and stores and is taken with first database
The database of business device is primary database and is the relationship from the leader follower replication of database with the database of the second database server.
In the present embodiment, in the present embodiment, first database server receives the transmission of the second database server
Relationship establish information, it will be able to by the information in the database and the second database that first database server is locally created
The relationship of the leader follower replication of the database of server.First database is in the relationship that leader follower replication is locally created, and to the pass
System is stored.And first database server is using local database as primary database, by the second database server
Database be used as from database.After the relationship of leader follower replication is established, you can to carry out leader follower replication.
In some optional realization methods of the present embodiment, the quantity of first database server is at least two.
In the case where the first database server as data source is two or more, the second database server can
To carry out multi-source duplication to the database of multiple first database servers, therefore, the leader follower replication in this programme can be more
The leader follower replication in source.Here the quantity of the second database server can also be multiple.The principal and subordinate that the present embodiment passes through multi-source
The sources of data can be increased by replicating, and can be managed simultaneously to multiple primary databases and the duplication of data.
Fig. 3 shows the sequence diagram of the another embodiment of the database leader follower replication system of the application.
Database leader follower replication system includes control server, first database server and the second database server;
Control server, internet protocol address and use for obtaining first database server and the second database server
The authorization message of leader follower replication is carried out between database;According to the IP address of acquisition, generation includes that the mandate of authorization message refers to
It enables, and generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database;Authorized order is sent out
First database server is given, and configuration-direct is sent to the second database server;First database server, is used for
In response to receiving authorized order, authorization message is sent to the second database server;Second database server, in response to
Authorization message is received, authorization message is stored;In the case where being stored with authorization message, refer in response to receiving information configuration
It enables, leader follower replication configuration is locally being carried out according to configuration information;According to authorization message, production Methods establish information, and to first
Database server sends relationship and establishes information;First database server is additionally operable to reception relationship and establishes information, establishes and deposit
Storage is from database using the database of first database server as primary database and with the database of the second database server
Leader follower replication relationship.
Server is controlled, is additionally operable to:Include parameter information to the first database server transmission where primary database
Parameter more new command;First database server is additionally operable to:In response to receiving parameter more new command, in local primary database
Middle recording parameters information, generate and to the second database server send include parameter information duplicate instructions;And second number
It is additionally operable to according to library server:In response to receiving duplicate instructions, the recording parameters information in local slave database.
Server is controlled, is additionally operable to:Determine first database server establish database leader follower replication relationship whether at
Work(;It is successfully established in response to determination, successful information is sent to specified display device.
Authorization message includes:Account and password for leader follower replication.
Server is controlled, is specifically used for:Targeting database server cluster is obtained, and by targeting database server cluster
In targeting database server IP address of the IP address as first database server and the second database server.
The present embodiment can be not limited to build between fixed server by obtaining targeting database server cluster
The relationship of vertical leader follower replication, but leader follower replication is established to the database server in arbitrary targeting database server cluster
Relationship.The flexibility for the relationship for establishing leader follower replication can be improved.And the present embodiment is built in the relationship for determining leader follower replication
After standing successfully, it can show that the relationship of leader follower replication has built up success to technical staff by display device.In order to technology
Personnel grasp the progress that the relationship of leader follower replication is established.
As shown in figure 3, in step 301, control server obtains targeting database server cluster, and by target data
The IP address of targeting database server in the server cluster of library is as first database server and the second database service
The IP address of device, and obtain the authorization message for carrying out leader follower replication between database.
In the present embodiment, control server can obtain targeting database server cluster, target database clothes first
Business device cluster is the cluster being made of multiple preassigned database servers.Targeting database server cluster can refer to
Any one fixed database server cluster.Then server is controlled by multiple target databases in destination server cluster
IP address of the IP address of server respectively as the IP address and the second database server of first database server.This
Outside, control server can also obtain the database of database and the second database server for first database server
Carry out the authorization message of leader follower replication.
In step 302, for control server according to the IP address of acquisition, generation includes the authorized order of authorization message, and
Generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database.
In the present embodiment, control server can be according to the IP address and second of the first database server got
The IP address of database server generates the authorized order that will be sent to first database server, and authorized order includes upper
State authorization message.And generation includes the configuration-direct of configuration information.Here configuration information is to be carried out for the second database
Information about leader follower replication relevant configuration.
In step 303, control server transmits an authorization to first database server.
In the present embodiment, the authorized order including authorization message of generation is sent to first database by control server
Server, so that first database server carries out Authorized operation.
In step 304, authorization message is sent to second by first database server in response to receiving authorized order
Database server.
In the present embodiment, after control server sends authorized order to first database server, the first data
Library server receives the authorized order, and responds, according to the second database server of authorized order pair received into
Row authorizes, and is that authorization message is sent to the second database server.
In step 305, the second database server stores authorization message in response to receiving authorization message.
In the present embodiment, the second database server receives the authorization message of first database server transmission, then
It responds, that is, stores the authorization message received.Second database server is after receiving authorization message, it may be determined that obtains
The mandate for carrying out leader follower replication to first database server was obtained, namely was allowed to the database of first database server
As primary database (namely data source), leader follower replication is carried out.
Within step 306, configuration-direct is sent to the second database server by control server.
In the present embodiment, the configuration-direct including configuration information is sent to the second database service by control server
Device, so that the second database server carries out and the relevant configuration of leader follower replication.
In step 307, the second database server is in the case where being stored with authorization message, in response to receiving information
Configuration-direct is locally carrying out leader follower replication configuration according to configuration information.
In the present embodiment, even if receiving the mandate of first database server, the second database server can't
Enough carry out leader follower replication, it is also necessary to locally carry out relevant configuration.Specifically, the second database server is receiving mandate letter
After ceasing and being stored, the information configuration instruction that control server is sent is received, and respond, i.e., basis receives
Configuration information in configuration-direct is in the relevant configuration for locally carrying out leader follower replication.
In step 308, the second database server establishes information according to authorization message, production Methods.
In the present embodiment, the authorization message that the second database server is sent according to first database server generates
Relationship to establish the relationship of leader follower replication establishes information.
In a step 309, the second database server sends relationship to first database server and establishes information.
In the present embodiment, which can be established and be believed after production Methods establish information by the second database server
Breath is sent to first database server.
In the step 310, first database server receives relationship and establishes information, establishes and stores and is taken with first database
The database of business device is primary database and is the relationship from the leader follower replication of database with the database of the second database server.
In the present embodiment, first database server receives the relationship foundation letter of the second database server transmission
Breath, it will be able to by the information the database and the second database server that first database server is locally created data
The relationship of leader follower replication between library.First database is deposited in the relationship that leader follower replication is locally created, and to the relationship
Storage.And first database server is using local database as primary database, by the database of the second database server
As from database.After the relationship of leader follower replication is established, you can to carry out leader follower replication.
In step 311, control server determines that first database server establishes the relationship of leader follower replication and whether succeeds.
In the present embodiment, control server determines that the relationship that first database server establishes database leader follower replication is
Success or failure.Specifically, control server can send check information to first database server.First database takes
If being engaged in device opening relationships success, to control server returns information to indicate its opening relationships success.Then control service
Device can determine first database server opening relationships success.
In step 312, control server is successfully established in response to determination, and successful information is sent to specified display device.
In the present embodiment, server is controlled if it is determined that first database server opening relationships success, then generate
It indicates the successful information that leader follower replication relationship is successfully established, and the successful information is sent to specified display device.Here finger
Determine the device for having communication connection to shown and control server that display device is specified.Successful information can be
To the signal shown on a display screen, indicate that the relationship of leader follower replication is successfully established.Later, the specified display device is aobvious
Show the successful information, to indicate that the relationship of leader follower replication is successfully established.Technical staff can recognize principal and subordinate by display device
The relationship of duplication has built up success.
In step 313, the first database server transmission where controlling server to primary database includes parameter letter
The parameter of breath more new command.
In the present embodiment, after establishing the relationship of leader follower replication, leader follower replication can be carried out.Control server to
First database server send parameter more new command so that the primary database of first database server according to parameter information into
Row parameter updates.
In a step 314, first database server is in response to receiving parameter more new command, in local primary database
Middle recording parameters information, generation include the duplicate instructions of parameter information.
In the present embodiment, first database server is made after receiving the more new command that control server is sent
Response:The recording parameters information in local primary database.Also, first database server generates duplicate instructions.Duplication refers to
Order is to indicate that the second database server carries out the instruction of leader follower replication.May include above-mentioned parameter information in duplicate instructions,
So that the second database server is replicated.
In step 315, first database server sends duplicate instructions to the second database server.
In the present embodiment, first database server sends duplicate instructions to the second database server, to indicate
Second database server carries out leader follower replication.
In step 316, the second database server is remembered in response to receiving duplicate instructions in local slave database
Record parameter information.
In the present embodiment, the second database server receives the duplicate instructions of first database server transmission,
Recording parameters information in local slave database, realizes the leader follower replication of database.
With further reference to Fig. 4, this application provides a kind of one embodiment of database leader follower replication method, this method is real
It is corresponding with system embodiment shown in Fig. 2 to apply example.
As shown in figure 4, in step 401, control server obtains first database server and the second database service
The internet protocol address of device and between database carry out leader follower replication authorization message.
In the present embodiment, control server can obtain other equipment transmission, or the information being manually entered, information
IP address including first database server and the second database server, and the data for first database server
The database of library and the second database server carries out the authorization message of leader follower replication.The IP address and authorization message of acquisition are used for
Instruction is generated, to indicate that first database server and the second database server establish the relationship of leader follower replication.
In some optional realization methods of the present embodiment, authorization message includes:For the account of leader follower replication and close
Code.
In step 402, for control server according to the IP address of acquisition, generation includes the authorized order of authorization message, and
Generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database.
In the present embodiment, control server can be according to the IP of the first database server got in step 401
The IP address of address and the second database server generates the authorized order that will be sent to first database server, authorizes
Instruction includes above-mentioned authorization message.And generation includes the configuration-direct of configuration information.Here configuration information is for second
Database carries out the information about leader follower replication relevant configuration.
In step 403, control server transmits an authorization to first database server.
In the present embodiment, the authorized order including authorization message of generation is sent to first database by control server
Server, so that first database server carries out Authorized operation.
In step 404, configuration-direct is sent to the second database server by control server.
In the present embodiment, the configuration-direct including configuration information is sent to the second database service by control server
Device, so that the second database server carries out and the relevant configuration of leader follower replication.
Wherein, authorization message is sent to the second database by first database server in response to receiving authorized order
Server;Second database server stores authorization message in response to receiving authorization message;In the feelings for being stored with authorization message
Under condition, the second database server is locally carrying out leader follower replication in response to receiving information configuration instruction, according to configuration information
Configuration;For second database server according to authorization message, production Methods establish information, and send and close to first database server
System establishes information;First database server receives relationship and establishes information, establishes and stores with the number of first database server
It is primary database according to library and is the relationship from the leader follower replication of database with the database of the second database server.
Specifically, after control server sends authorized order to first database server, first database service
Device receives the authorized order, and responds, and is authorized according to the second database server of authorized order pair received,
It is that authorization message is sent to the second database server.
Second database server receives the authorization message of first database server transmission, then responds, that is, deposit
Store up the authorization message received.Second database server is after receiving authorization message, it may be determined that obtains and is counted to first
The mandate of leader follower replication is carried out according to library server, namely is allowed to using the database of first database server as primary database
(namely data source) carries out leader follower replication.
Even if receiving the mandate of first database server, it is multiple that the second database server can't carry out principal and subordinate
System, it is also necessary to locally carry out relevant configuration.Specifically, the second database server is receiving authorization message and is being deposited
After storage, the information configuration instruction that control server is sent is received, and respond, i.e., according in the configuration-direct received
Configuration information is in the relevant configuration for locally carrying out leader follower replication.
The authorization message that second database server is sent according to first database server generates multiple to establish principal and subordinate
The relationship of the relationship of system establishes information, and is sent to first database server.
The relationship that first database server receives the transmission of the second database server establishes information, it will be able to by this
Information is in the leader follower replication of the database that first database server is locally created and the database of the second database server
Relationship.First database is stored in the relationship that leader follower replication is locally created, and to the relationship.And first database takes
Device be engaged in using local database as primary database, using the database of the second database server as from database.In principal and subordinate
After the relationship of duplication is established, you can to carry out leader follower replication.
In some optional realization methods of the present embodiment, this method further includes:To the first number where primary database
Include the parameter more new command of parameter information according to the transmission of library server;Wherein, first database server is in response to receiving ginseng
Number more new command, the recording parameters information in local primary database, it includes ginseng to generate and sent to the second database server
The duplicate instructions of number information;Second database server is recorded in response to receiving duplicate instructions in local slave database
Parameter information.
In some optional realization methods of the present embodiment, this method further includes:Determine that first database server is built
Whether the relationship of vertical database leader follower replication succeeds;It is successfully established in response to determination, successful information is sent to specified display device.
In some optional realization methods of the present embodiment, authorization message includes:For the account of leader follower replication and close
Code.
In some optional realization methods of the present embodiment, first database server and the second database service are obtained
The internet protocol address of device and between database carry out leader follower replication authorization message, including:Obtain number of targets
According to library server cluster, and using the IP address of the targeting database server in targeting database server cluster as the first number
According to the IP address of library server and the second database server.
With further reference to Fig. 5, as the realization to method shown in above-mentioned Fig. 4, this application provides a kind of database principals and subordinates
One embodiment of reproducing unit, device embodiment embodiment of the method as shown in fig. 4 is corresponding, which can specifically answer
For in various electronic equipments.
As shown in figure 5, the database leader follower replication device 500 of the present embodiment includes:Acquiring unit 501, generation unit 502
With transmission unit 503.Wherein, acquiring unit 501, for obtaining the mutual of first database server and the second database server
Networking protocol IP address and between database carry out leader follower replication authorization message;Generation unit 502 is obtained for basis
The IP address taken, generation include the authorized order of authorization message, and it includes matching for carrying out leader follower replication between database to generate
The configuration-direct for the configuration information set;Transmission unit 503, for transmitting an authorization to first database server, and will
Configuration-direct is sent to the second database server;Wherein, first database server will be awarded in response to receiving authorized order
Power information is sent to the second database server;Second database server authorizes letter in response to receiving authorization message, storage
Breath;In the case where being stored with authorization message, the second database server is in response to receiving information configuration instruction, according to configuration
Information is locally carrying out leader follower replication configuration;For second database server according to authorization message, production Methods establish information, and to
First database server sends relationship and establishes information;First database server receives relationship and establishes information, establishes and stores
It is from database using the database of first database server as primary database and with the database of the second database server
The relationship of leader follower replication.
In some optional realization methods of the present embodiment, which further includes:Command unit (not shown) is sent, to
First database server transmission where primary database includes the parameter more new command of parameter information;Wherein, first database
Server is in response to receiving parameter more new command, the recording parameters information in local primary database, generates and is counted to second
Include the duplicate instructions of parameter information according to the transmission of library server;Second database server in response to receiving duplicate instructions,
Recording parameters information in local slave database.
In some optional realization methods of the present embodiment, which further includes:Determination unit (not shown) determines
Whether the relationship that one database server establishes database leader follower replication succeeds;Information unit (not shown) is sent, in response to true
Surely it is successfully established, successful information is sent to specified display device.
In some optional realization methods of the present embodiment, authorization message includes:For the account of leader follower replication and close
Code.
In some optional realization methods of the present embodiment, acquiring unit is further used for:Obtain target database clothes
Business device cluster, and taken the IP address of the targeting database server in targeting database server cluster as first database
The IP address of business device and the second database server.
Fig. 6 shows the structural schematic diagram of the computer system of the server suitable for being used for realizing the embodiment of the present application.Such as
Shown in Fig. 6, computer system 600 includes central processing unit (CPU) 601, can be according to being stored in read-only memory (ROM)
Program in 602 executes various suitable from the program that storage section 608 is loaded into random access storage device (RAM) 603
When action and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.CPU 601,
ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to bus 604.
It is connected to I/O interfaces 605 with lower component:Importation 606 including keyboard, mouse etc.;It is penetrated including such as cathode
The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loud speaker etc.;Storage section 608 including hard disk etc.;
And the communications portion 609 of the network interface card including LAN card, modem etc..Communications portion 609 via such as because
The network of spy's net executes communication process.Driver 610 is also according to needing to be connected to I/O interfaces 605.Detachable media 611, such as
Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on driver 610, as needed in order to be read from thereon
Computer program be mounted into storage section 608 as needed.
Particularly, according to an embodiment of the present application, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiments herein includes a kind of computer program product comprising be carried on computer-readable medium
On computer program, which includes the program code for method shown in execution flow chart.In such reality
It applies in example, which can be downloaded and installed by communications portion 609 from network, and/or from detachable media
611 are mounted.When the computer program is executed by central processing unit (CPU) 601, limited in execution the present processes
Above-mentioned function.It should be noted that the computer-readable medium of the application can be computer-readable signal media or calculating
Machine readable storage medium storing program for executing either the two arbitrarily combines.Computer readable storage medium for example can be --- but it is unlimited
In --- electricity, system, device or the device of magnetic, optical, electromagnetic, infrared ray or semiconductor, or the arbitrary above combination.It calculates
The more specific example of machine readable storage medium storing program for executing can include but is not limited to:Being electrically connected, be portable with one or more conducting wires
Formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable programmable read only memory
(EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device or
The above-mentioned any appropriate combination of person.In this application, can be any include computer readable storage medium or storage program
Tangible medium, the program can be commanded execution system, device either device use or it is in connection.And in this Shen
Please in, computer-readable signal media may include in a base band or as the data-signal that a carrier wave part is propagated,
In carry computer-readable program code.Diversified forms may be used in the data-signal of this propagation, including but not limited to
Electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer-readable
Any computer-readable medium other than storage medium, the computer-readable medium can send, propagate or transmit for by
Instruction execution system, device either device use or program in connection.The journey for including on computer-readable medium
Sequence code can transmit with any suitable medium, including but not limited to:Wirelessly, electric wire, optical cable, RF etc. or above-mentioned
Any appropriate combination.
Flow chart in attached drawing and block diagram, it is illustrated that according to the system of the various embodiments of the application, method and computer journey
The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation
A part for a part for one module, program segment, or code of table, the module, program segment, or code includes one or more uses
The executable instruction of the logic function as defined in realization.It should also be noted that in some implementations as replacements, being marked in box
The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually
It can be basically executed in parallel, they can also be executed in the opposite order sometimes, this is depended on the functions involved.Also it to note
Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding
The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction
Combination realize.
As on the other hand, present invention also provides a kind of computer-readable medium, which can be
Included in system described in above-described embodiment;Can also be individualism, and without be incorporated the system in.Above-mentioned calculating
Machine readable medium carries one or more program, when said one or multiple programs are executed by the system so that should
System:Control internet protocol address and use that server obtains first database server and the second database server
The authorization message of leader follower replication is carried out between database;According to the IP address of acquisition, generation includes that the mandate of authorization message refers to
It enables, and generation includes the configuration-direct of the configuration information for carrying out leader follower replication configuration between database;Authorized order is sent out
First database server is given, and configuration-direct is sent to the second database server;First database server responds
In receiving authorized order, authorization message is sent to the second database server;Second database server is in response to receiving
To authorization message, authorization message is stored;In the case where being stored with authorization message, in response to receiving information configuration instruction, root
Leader follower replication configuration is locally being carried out according to configuration information;According to authorization message, production Methods establish information, and to first database
Server sends relationship and establishes information;First database server receives relationship and establishes information, establishes and stores with the first data
The database of library server is primary database and is the leader follower replication from database with the database of the second database server
Relationship.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.People in the art
Member should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic
Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature
Other technical solutions of arbitrary combination and formation.Such as features described above has similar work(with (but not limited to) disclosed herein
Can technical characteristic replaced mutually and the technical solution that is formed.
Claims (12)
1. a kind of database leader follower replication system, which is characterized in that the database leader follower replication system include control server,
First database server and the second database server;
Control server, for obtain the internet protocol address of first database server and the second database server with
And the authorization message for carrying out leader follower replication between database;According to the IP address of acquisition, generation includes the authorization message
Authorized order, and generate include between database carry out leader follower replication configuration configuration information configuration-direct;By institute
It states authorized order and is sent to the first database server, and the configuration-direct is sent to second database service
Device;
The first database server, in response to receiving the authorized order, the authorization message to be sent to institute
State the second database server;
Second database server, in response to receiving the authorization message, storing the authorization message;It is storing
In the case of having the authorization message, in response to receiving described information configuration-direct, according to the configuration information local into
Row leader follower replication configures;According to the authorization message, production Methods establish information, and are sent to the first database server
The relationship establishes information;
The first database server is additionally operable to receive the relationship and establishes information, establishes and store with first data
The database of library server is primary database and is multiple from the principal and subordinate of database with the database of second database server
The relationship of system.
2. database leader follower replication system according to claim 1, which is characterized in that the control server is additionally operable to:
Include the parameter more new command of parameter information to the first database server transmission where the primary database;
The first database server is additionally operable to:
In response to receiving parameter more new command, the parameter information is recorded in local primary database, is generated and to described
The transmission of second database server includes the duplicate instructions of the parameter information;And
Second database server is additionally operable to:
In response to receiving the duplicate instructions, the parameter information is recorded in local slave database.
3. database leader follower replication system according to claim 1, which is characterized in that the control server is additionally operable to:
Determine that the first database server establishes the relationship of the database leader follower replication and whether succeeds;
It is successfully established in response to determination, successful information is sent to specified display device.
4. database leader follower replication system according to claim 1, which is characterized in that the authorization message includes:
Account and password for leader follower replication.
5. database leader follower replication system according to claim 1, which is characterized in that the control server is specifically used for:
Targeting database server cluster is obtained, and by the targeting database server in the targeting database server cluster
IP address of the IP address as first database server and the second database server.
6. a kind of database leader follower replication method, which is characterized in that the method includes:
Obtain first database server and the second database server internet protocol address and for database it
Between carry out leader follower replication authorization message;
According to the IP address of acquisition, generation includes the authorized order of the authorization message, and it includes between database to generate
Carry out the configuration-direct of the configuration information of leader follower replication configuration;
The authorized order is sent to the first database server, and the configuration-direct is sent to second number
According to library server;
Wherein, the authorization message is sent to institute by the first database server in response to receiving the authorized order
State the second database server;Second database server stores the mandate in response to receiving the authorization message
Information;In the case where being stored with the authorization message, second database server is matched in response to receiving described information
Instruction is set, leader follower replication configuration is locally being carried out according to the configuration information;Second database server is awarded according to
Information is weighed, production Methods establish information, and send the relationship to the first database server and establish information;Described first
Database server receives the relationship and establishes information, establishes and stores based on the database of the first database server
Database and be the relationship from the leader follower replication of database with the database of second database server.
7. database leader follower replication method according to claim 6, which is characterized in that the method further includes:
Include the parameter more new command of parameter information to the first database server transmission where the primary database;
Wherein, the first database server is recorded in response to receiving parameter more new command in local primary database
The parameter information, generate and to second database server send include the parameter information duplicate instructions;It is described
Second database server records the parameter information in response to receiving the duplicate instructions in local slave database.
8. database leader follower replication method according to claim 6, which is characterized in that the method further includes:
Determine that the first database server establishes the relationship of the database leader follower replication and whether succeeds;
It is successfully established in response to determination, successful information is sent to specified display device.
9. database leader follower replication method according to claim 6, which is characterized in that the acquisition first database server and
The internet protocol address of second database server and between database carry out leader follower replication authorization message, packet
It includes:
Targeting database server cluster is obtained, and by the targeting database server in the targeting database server cluster
IP address of the IP address as first database server and the second database server.
10. a kind of database leader follower replication device, which is characterized in that described device includes:
Acquiring unit, internet protocol address for obtaining first database server and the second database server and
Authorization message for carrying out leader follower replication between database;
Generation unit, for the IP address according to acquisition, generation includes the authorized order of the authorization message, and it includes using to generate
The configuration-direct of the configuration information of leader follower replication configuration is carried out between database;
Transmission unit for the authorized order to be sent to the first database server, and the configuration-direct is sent out
Give second database server;
Wherein, the authorization message is sent to institute by the first database server in response to receiving the authorized order
State the second database server;Second database server stores the mandate in response to receiving the authorization message
Information;In the case where being stored with the authorization message, second database server is matched in response to receiving described information
Instruction is set, leader follower replication configuration is locally being carried out according to the configuration information;Second database server is awarded according to
Information is weighed, production Methods establish information, and send the relationship to the first database server and establish information;Described first
Database server receives the relationship and establishes information, establishes and stores based on the database of the first database server
Database and be the relationship from the leader follower replication of database with the database of second database server.
11. a kind of server, including:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors so that one or more of processors are real
The now method as described in any in claim 6-9.
12. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor
The method as described in any in claim 6-9 is realized when execution.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710259734.5A CN108733699A (en) | 2017-04-19 | 2017-04-19 | Database leader follower replication system, method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710259734.5A CN108733699A (en) | 2017-04-19 | 2017-04-19 | Database leader follower replication system, method and apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108733699A true CN108733699A (en) | 2018-11-02 |
Family
ID=63925379
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710259734.5A Pending CN108733699A (en) | 2017-04-19 | 2017-04-19 | Database leader follower replication system, method and apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108733699A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101038591A (en) * | 2007-04-11 | 2007-09-19 | 华为技术有限公司 | Method and system for synchronizing data base |
CN104021200A (en) * | 2014-06-16 | 2014-09-03 | 北京京东尚科信息技术有限公司 | Data synchronizing method and device of database |
CN104252502A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Method and device for carrying out data migration on database management platform |
CN105224637A (en) * | 2015-09-24 | 2016-01-06 | 珠海许继芝电网自动化有限公司 | A kind of based on PostgreSQL database active and standby/the comprehensive method of cluster application |
CN105659563A (en) * | 2013-10-18 | 2016-06-08 | 思科技术公司 | System and method for software defined network aware data replication |
US9501544B1 (en) * | 2012-09-25 | 2016-11-22 | EMC IP Holding Company LLC | Federated backup of cluster shared volumes |
CN106383755A (en) * | 2016-09-23 | 2017-02-08 | 北京奇虎科技有限公司 | Method, apparatus and system for recovering slave database from master-slave database system |
CN106407410A (en) * | 2009-10-26 | 2017-02-15 | 亚马逊技术股份有限公司 | Provisioning and managing replicated data instances |
-
2017
- 2017-04-19 CN CN201710259734.5A patent/CN108733699A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101038591A (en) * | 2007-04-11 | 2007-09-19 | 华为技术有限公司 | Method and system for synchronizing data base |
CN106407410A (en) * | 2009-10-26 | 2017-02-15 | 亚马逊技术股份有限公司 | Provisioning and managing replicated data instances |
US9501544B1 (en) * | 2012-09-25 | 2016-11-22 | EMC IP Holding Company LLC | Federated backup of cluster shared volumes |
CN104252502A (en) * | 2013-06-29 | 2014-12-31 | 北京新媒传信科技有限公司 | Method and device for carrying out data migration on database management platform |
CN105659563A (en) * | 2013-10-18 | 2016-06-08 | 思科技术公司 | System and method for software defined network aware data replication |
CN104021200A (en) * | 2014-06-16 | 2014-09-03 | 北京京东尚科信息技术有限公司 | Data synchronizing method and device of database |
CN105224637A (en) * | 2015-09-24 | 2016-01-06 | 珠海许继芝电网自动化有限公司 | A kind of based on PostgreSQL database active and standby/the comprehensive method of cluster application |
CN106383755A (en) * | 2016-09-23 | 2017-02-08 | 北京奇虎科技有限公司 | Method, apparatus and system for recovering slave database from master-slave database system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108683539A (en) | Management method, device, medium and the electronic equipment of block chain network | |
CN109345259A (en) | Virtual resource transfer method, device, medium and electronic equipment based on block chain | |
CN108769214B (en) | Method and apparatus for controlling edge computing device, and method and apparatus for updating data | |
CN108632101A (en) | Method and apparatus for updating configuration object | |
CN106843976B (en) | Method and apparatus for generating image file | |
CN109146490A (en) | block generation method, device and system | |
CN109710236A (en) | Business development and implementation method, device, platform and medium based on shared service | |
CN108694238A (en) | Business data processing method, device based on block chain and storage medium | |
CN108804402A (en) | Report generating system based on big data platform and method | |
CN106303125B (en) | Automated refill system, method and device | |
CN107295607A (en) | Method and apparatus for connecting WAP | |
CN109492013A (en) | Data processing method, device and system applied to data-base cluster | |
CN110096847A (en) | User's specific application for remote session activates | |
CN108363999A (en) | Operation based on recognition of face executes method and apparatus | |
CN107329834A (en) | Method and apparatus for performing calculating task | |
CN108924036A (en) | Method and apparatus for distributing resource, getting resource | |
CN110019158A (en) | A kind of method and apparatus of monitoring data quality | |
CN112613877A (en) | Intelligent contract triggering method and device applied to block chain network and related equipment | |
CN109005208A (en) | Method and apparatus for pushed information | |
CN107347093A (en) | Collocation method and device for distributed server system | |
CN108733527A (en) | System, method and apparatus for test server function | |
CN108390878A (en) | Method, apparatus for verifying network request safety | |
CN110210824A (en) | Operation flow changing process method and device | |
CN108763881A (en) | Method and apparatus for controlling user right | |
CN108733699A (en) | Database leader follower replication system, method and apparatus |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181102 |