JP2010244117A - Replication system, master server, replica server, replication method, and program - Google Patents

Replication system, master server, replica server, replication method, and program Download PDF

Info

Publication number
JP2010244117A
JP2010244117A JP2009089084A JP2009089084A JP2010244117A JP 2010244117 A JP2010244117 A JP 2010244117A JP 2009089084 A JP2009089084 A JP 2009089084A JP 2009089084 A JP2009089084 A JP 2009089084A JP 2010244117 A JP2010244117 A JP 2010244117A
Authority
JP
Japan
Prior art keywords
master
database
log
update
replica
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
JP2009089084A
Other languages
Japanese (ja)
Other versions
JP5494915B2 (en
Inventor
Nobue Momota
伸江 百田
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.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2009089084A priority Critical patent/JP5494915B2/en
Publication of JP2010244117A publication Critical patent/JP2010244117A/en
Application granted granted Critical
Publication of JP5494915B2 publication Critical patent/JP5494915B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a replication system, a master server, a replica server, a replication method, and a program, for continuing processing when a failure occurs while preventing deterioration of throughput when a replication is executed by using a cluster system. <P>SOLUTION: A database system 2 is provided with: a master database 13; master servers 10-1 to N, and individual databases 11-1 to N. The database system 3 is provided with a replica database 21 and a replica server 20. Each master server stores an update log for processing to the master database 13 in the individual databases, and adds time information to the update log, and transmits the update log with the time information added thereto to the replica server 20. The replica server 20 merges the update log based on the time information, and generates a file for reflecting the update in the replica database 21, and executes the replication by using the file. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、レプリケーションシステム、マスタサーバ、レプリカサーバ、レプリケーション方法、及びプログラムに関する。   The present invention relates to a replication system, a master server, a replica server, a replication method, and a program.

従来から、データベース管理システム(DBMS:Data Base Management System)の分野では、レプリケーションが採用されている(例えば、特許文献1及び2参照)。レプリケーションは、特定のデータベース(マスタ)と同内容のデータベース(レプリカ)をネットワーク上に配置し、一箇所でデータ更新が行われると、マスタとレプリカとの両方で更新を行う仕組みのことをいう。   Conventionally, replication has been employed in the field of database management systems (DBMS) (see, for example, Patent Documents 1 and 2). Replication refers to a mechanism in which a database (replica) having the same content as a specific database (master) is arranged on a network, and when data is updated at one place, the update is performed by both the master and the replica.

また、レプリケーションは、異なるシステム間においても行われ、この場合は、特に、マスタとレプリカとの間の更新時の同一性の確保が重要となる。データベースを他システムの別のデータベースにレプリケーションする場合のデータ更新の方式としては、次の二つがある。   In addition, replication is performed between different systems. In this case, it is particularly important to ensure the identity at the time of update between the master and the replica. There are the following two methods for updating data when a database is replicated to another database in another system.

一の方式は、マスタ及びレプリカいずれかの更新時に出力される更新ログを元にして、更新差分を抽出し、これを用いてレプリケーションを実行する方式である。また、別の方式は、マスタのレプリケーションの対象表にトリガを付加し、対象表が更新されるとトリガが起動し、トリガ経由で更新イメージがレプリカのデータベースに蓄積される方式である。   One method is a method in which an update difference is extracted based on an update log output at the time of update of either the master or the replica, and replication is executed using this. Another method is a method in which a trigger is added to the target table for replication of the master, the trigger is activated when the target table is updated, and the update image is accumulated in the replica database via the trigger.

このうち、トリガを用いるレプリケーションは、特許文献1に開示されている。また、トリガを用いるレプリケーションは、レプリケーションの対象となるDBMSが、トリガ機能をサポートしていれば、DBMSの種別に依存することなく、実現可能であり、汎用性を備えている。   Among these, replication using a trigger is disclosed in Patent Document 1. In addition, replication using a trigger can be realized without depending on the type of DBMS if the DBMS to be replicated supports the trigger function, and has versatility.

また、大規模で更新回数が非常に多いデータベースシステムでは、可用性と信頼性とを向上させるため、負荷分散型のクラスタシステムが導入されている。クラスタシステムは、複数のサーバを備え、各サーバに並列処理を行わせることで負荷を分散する。更に、クラスタシステムでは、データベースは共有ディスクに構築される。そして、トリガを用いたレプリケーションをクラスタシステム上で実現する場合は、トリガが付加されたレプリケーションの対象表は共有ディスクに格納される。   Further, in a large-scale database system with a very large number of updates, a load balancing type cluster system is introduced in order to improve availability and reliability. The cluster system includes a plurality of servers, and distributes the load by causing each server to perform parallel processing. Furthermore, in the cluster system, the database is constructed on a shared disk. When the replication using the trigger is realized on the cluster system, the replication target table to which the trigger is added is stored in the shared disk.

特開2005−301329号公報JP 2005-301329 A 特開2006−146299号公報JP 2006-146299 A

ところで、負荷分散型のクラスタシステムにおいて、更新ログまでもが共有ディスクに格納されていると、複数のサーバが共有ディスク内に構築されたデータベースを更新する際に、排他制御による待機命令の回数や、デットロック等の発生回数が増加してしまう。この結果、システム全体のスループットが劣化してしまう。このため、負荷分散型のクラスタシステムでは、更新ログを分散させて格納することが求められる。   By the way, in a load-balanced cluster system, if even the update log is stored on the shared disk, when multiple servers update the database built in the shared disk, The number of occurrences of deadlock and the like will increase. As a result, the throughput of the entire system is degraded. For this reason, in a load distribution type cluster system, it is required to store update logs in a distributed manner.

しかしながら、更新ログを分散させて格納すると、更新の順序を保証するための仕組みや、システムを構成する一部のサーバに、障害が発生した場合に、更新ログがレプリケーションされず、レプリケーションシステム全体が停止してしまうという問題が発生する。   However, if the update log is distributed and stored, the update log is not replicated when a failure occurs in the mechanism for guaranteeing the update order or some of the servers that make up the system. The problem of stopping will occur.

本発明の目的は、上記問題を解消し、クラスタシステムを用いてレプリケーションを実行する際におけるスループットの劣化を抑制しつつ、障害発生時の継続処理を実現し得る、レプリケーションシステム、マスタサーバ、レプリカサーバ、レプリケーション方法、及びプログラムを提供することにある。   An object of the present invention is a replication system, a master server, and a replica server that can solve the above-described problems and can realize continuous processing when a failure occurs while suppressing deterioration in throughput when replication is performed using a cluster system. , Replication method, and program.

上記目的を達成するため、本発明におけるレプリケーションシステムは、第1のデータベースシステムと、第2のデータベースシステムとを備えたレプリケーションシステムであって、
前記第1のデータベースシステムは、レプリケーション元となるマスタデータベースと、前記マスタデータベースに対して処理を行う複数のマスタサーバと、前記複数のマスタサーバそれぞれ毎に設けられた個別データベースとを備え、
前記第2のデータベースシステムは、レプリケーション先となるレプリカデータベースと、前記レプリカデータベースに対して処理を行うレプリカサーバとを備え、
前記複数のマスタサーバそれぞれは、前記マスタデータベースに対して処理を行った場合に得られる更新ログを、それぞれの前記個別データベースに格納し、更に、前記更新ログに時間情報を付加し、そして、前記時間情報が付加された更新ログを前記レプリカサーバに送信し、
前記レプリカサーバは、前記複数のマスタサーバそれぞれから送信されてきた前記更新ログを、各更新ログに付加された時間情報に基づいてマージし、それによって、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成し、生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ことを特徴とする。
In order to achieve the above object, a replication system according to the present invention is a replication system including a first database system and a second database system,
The first database system includes a master database serving as a replication source, a plurality of master servers that perform processing on the master database, and individual databases provided for each of the plurality of master servers,
The second database system includes a replica database serving as a replication destination, and a replica server that performs processing on the replica database.
Each of the plurality of master servers stores an update log obtained when processing is performed on the master database in each individual database, further adds time information to the update log, and Send the update log with the time information added to the replica server,
The replica server merges the update log transmitted from each of the plurality of master servers based on time information added to each update log, and thereby updates the master database to the replica database. A file to be reflected is generated, and the replica database is replicated using the generated file.

また、上記目的を達成するため、本発明におけるマスタサーバは、マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいて、前記マスタデータベースに対して処理を行うマスタサーバであって、
前記マスタデータベースに対して処理を行い、それによって得られた更新ログを記憶装置に格納させる、更新処理部と、
前記更新ログに時間情報を付加する、時間情報付加部と、
前記時間情報を付加した前記更新ログを、前記レプリカデータベースに対して処理を行うレプリカサーバに送信する、更新ログ送信処理部と、
を備えていることを特徴とする。
In order to achieve the above object, the master server in the present invention is a master server that performs processing on the master database in a replication system having a master database and a replica database.
An update processing unit that performs processing on the master database and stores an update log obtained thereby in a storage device;
A time information adding unit for adding time information to the update log;
An update log transmission processing unit that transmits the update log to which the time information is added to a replica server that performs processing on the replica database;
It is characterized by having.

更に、上記目的を達成するため、本発明におけるレプリカサーバは、マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいて、前記レプリカデータベースに対して処理を行うレプリカサーバであって、
前記マスタデータベースに対して処理を行う複数のマスタサーバから送信されてきた更新ログを受信する、更新ログ受信処理部と、
受信した前記複数のマスタサーバそれぞれの更新ログを、各更新ログに付加されている時間情報に基づいてマージし、それによって、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、更新ログマージ処理部と、
生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、更新ログ反映処理部と、
を備えていることを特徴とする。
Furthermore, in order to achieve the above object, the replica server in the present invention is a replica server that performs processing on the replica database in a replication system having a master database and a replica database.
An update log reception processing unit that receives update logs transmitted from a plurality of master servers that perform processing on the master database;
The received update logs of the plurality of master servers are merged based on the time information added to each update log, thereby generating a file for reflecting the update in the master database to the replica database. An update log merge processing unit,
An update log reflection processing unit that replicates the replica database using the generated file;
It is characterized by having.

上記目的を達成するため、本発明におけるレプリケーション方法は、第1のデータベースシステムと、第2のデータベースシステムとを備え、
前記第1のデータベースシステムは、レプリケーション元となるマスタデータベースと、前記マスタデータベースに対して処理を行う複数のマスタサーバと、前記複数のマスタサーバそれぞれ毎に設けられた個別データベースとを備え、
前記第2のデータベースは、レプリケーション先となるレプリカデータベースと、前記レプリカデータベースに対して処理を行うレプリカサーバとを備えている、レプリケーションシステムを用いたレプリケーション方法であって、
(a)前記複数のマスタサーバそれぞれが前記マスタデータベースに対して処理を行った場合に得られる更新ログを、それぞれの前記個別データベースに格納する、ステップと、(b)前記更新ログに時間情報を付加する、ステップと、
(c)前記複数のマスタサーバそれぞれ毎に、前記時間情報が付加された更新ログを、前記レプリカサーバに送信する、ステップと、
(d)前記複数のマスタサーバそれぞれから前記レプリカサーバに送信されてきた前記更新ログを、各更新ログに付加された時間情報に基づいてマージする、ステップと、
(e)前記(d)のステップによるマージの結果から、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、ステップと、
(f)前記(e)のステップで生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ステップと、
を有することを特徴とする。
In order to achieve the above object, a replication method according to the present invention comprises a first database system and a second database system,
The first database system includes a master database serving as a replication source, a plurality of master servers that perform processing on the master database, and individual databases provided for each of the plurality of master servers,
The second database is a replication method using a replication system including a replica database serving as a replication destination and a replica server that performs processing on the replica database.
(A) storing an update log obtained when each of the plurality of master servers performs processing on the master database in each individual database; and (b) time information in the update log. Add, step,
(C) transmitting the update log to which the time information is added to each of the plurality of master servers to the replica server;
(D) merging the update log transmitted from each of the plurality of master servers to the replica server based on time information added to each update log;
(E) generating a file for reflecting the update in the master database in the replica database from the result of the merge in the step (d);
(F) replicating the replica database using the file generated in the step (e);
It is characterized by having.

また、上記目的を達成するため、本発明における第1のプログラムは、マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおける前記マスタデータベースに対する処理を、コンピュータに実行させるためのプログラムであって、
前記コンピュータに、
(a)前記マスタデータベースに対して処理を行った場合に得られる更新ログを取得する、ステップと、
(b)前記更新ログに時間情報を付加する、ステップと、
(c)前記時間情報を付加した前記更新ログを、前記レプリカデータベースに対して処理を行うレプリカサーバに送信する、ステップと、
を実行させることを特徴とする。
In order to achieve the above object, a first program in the present invention is a program for causing a computer to execute processing for the master database in a replication system having a master database and a replica database.
In the computer,
(A) obtaining an update log obtained when processing is performed on the master database;
(B) adding time information to the update log; and
(C) transmitting the update log to which the time information is added to a replica server that processes the replica database; and
Is executed.

更に、上記目的を達成するため、本発明における第2のプログラムは、マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいける前記レプリカデータベースに対する処理を、コンピュータに実行させるためのプログラムであって、前記コンピュータに、
(a)前記マスタデータベースに対して処理を行う複数のマスタサーバから送信されてきた更新ログを受信する、ステップと、
(b)受信した前記複数のマスタサーバそれぞれの更新ログを、各更新ログに付加されている時間情報に基づいてマージするステップと、
(c)前記(b)のステップによるマージの結果から、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、ステップと、
(d)前記(c)のステップで生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ステップと、
を実行させることを特徴とする。
Furthermore, in order to achieve the above object, a second program in the present invention is a program for causing a computer to execute processing for the replica database in a replication system having a master database and a replica database. On the computer,
(A) receiving an update log transmitted from a plurality of master servers that perform processing on the master database;
(B) merging the received update logs of the plurality of master servers based on time information added to the update logs;
(C) generating a file for reflecting the update in the master database to the replica database from the result of the merge in the step (b);
(D) replicating the replica database using the file generated in the step (c);
Is executed.

以上の特徴により、本発明によれば、クラスタシステムを用いてレプリケーションを実行する際におけるスループットの劣化を抑制しつつ、障害発生時の継続処理を実現できる
With the above features, according to the present invention, it is possible to realize continuous processing when a failure occurs while suppressing deterioration in throughput when performing replication using a cluster system.

図1は、本発明の実施の形態におけるレプリケーションシステムの全体構成を示す図である。FIG. 1 is a diagram showing an overall configuration of a replication system according to an embodiment of the present invention. 図2は、本発明の実施の形態におけるマスタサーバ及びレプリカサーバの構成を示すブロック図である。FIG. 2 is a block diagram showing a configuration of the master server and the replica server in the embodiment of the present invention. 図3は、本発明の実施の形態におけるレプリケーションシステムの動作を示すフロー図である。FIG. 3 is a flowchart showing the operation of the replication system according to the embodiment of the present invention. 図4は、マスタデータベースシステムで利用される各種ログ及び情報の一例を示す図である。FIG. 4 is a diagram illustrating an example of various logs and information used in the master database system. 図5は、本発明の実施の形態におけるマスタサーバによるCOMMITログの生成処理を示すフロー図である。FIG. 5 is a flowchart showing generation processing of the COMMIT log by the master server according to the embodiment of the present invention. 図6は、本発明の実施の形態におけるマスタサーバによる制御ログの生成処理を示すフロー図である。FIG. 6 is a flowchart showing a control log generation process by the master server in the embodiment of the present invention. 図7は、本発明の実施の形態におけるレプリカサーバによる更新ログファイルの受信処理を示すフロー図である。FIG. 7 is a flowchart showing the reception process of the update log file by the replica server in the embodiment of the present invention. 図8は、本発明の実施の形態におけるレプリカサーバによるマージ処理を示すフロー図である。FIG. 8 is a flowchart showing merge processing by the replica server in the embodiment of the present invention. 図9は、本発明の実施の形態におけるレプリカサーバによる各種要求処理を示すフロー図である。FIG. 9 is a flowchart showing various request processes by the replica server in the embodiment of the present invention. 図10は、本発明の実施例において各マスタサーバが生成した各種ログを示す図である。FIG. 10 is a diagram illustrating various logs generated by each master server in the embodiment of the present invention. 図11は、本発明の実施例においてレプリカサーバが実行したマージ処理の結果を示す図である。FIG. 11 is a diagram illustrating a result of the merge process executed by the replica server in the embodiment of the present invention.

(発明の概要)
本発明のレプリケーションシステムは、例えば、レプリケーション元のマスタデータベースに格納される表(マスタ表)に対して業務Aが行われ、レプリケーション先のレプリカデータベースに格納される表(レプリカ表)に対して業務Bが行われる場合に適用される(図1参照)。
(Summary of Invention)
In the replication system of the present invention, for example, business A is performed on a table (master table) stored in a replication source master database, and business is performed on a table (replica table) stored in a replication destination replica database. This is applied when B is performed (see FIG. 1).

マスタ表には、更新ログを採取するためのトリガが登録されている。本発明では、トリガの出力先は、マスタサーバ毎に設けられた個別データベースに設定される。個別データベースは、通常の状態では、対応するマスタサーバからのみアクセス可能となっているが、マスタサーバに障害が発生した場合では、ネットワーク上の他のサーバからもアクセス可能となっている。   In the master table, a trigger for collecting an update log is registered. In the present invention, the trigger output destination is set in an individual database provided for each master server. The individual database can be accessed only from the corresponding master server in a normal state, but can also be accessed from other servers on the network when a failure occurs in the master server.

また、複数のクライアントコンピュータによって業務Aが実行されると、業務Aに伴うSQL命令による操作要求が入力される。そして、操作要求は、ロードバランス装置の振り分け処理に従って、各マスタサーバに送られる。そして、マスタサーバは、SQL命令を実行して、求められる処理を行い、マスタデータベースに格納されているデータを更新する。   Further, when the job A is executed by a plurality of client computers, an operation request based on the SQL command accompanying the job A is input. Then, the operation request is sent to each master server according to the distribution process of the load balancer. Then, the master server executes the SQL command, performs the required processing, and updates the data stored in the master database.

マスタデータベースに対してCOMMIT命令(処理終了命令)が発行されると、DBMSを構成するマスタデータベースサーバが、発行されたCOMMIT命令にシーケンス番号を割り当ててCOMMITログを生成し、そのCOMMITログを更新ログと共に個別デーベースに登録する。   When a COMMIT command (process end command) is issued to the master database, the master database server that constitutes the DBMS assigns a sequence number to the issued COMMIT command, generates a COMMIT log, and updates the COMMIT log. And register in the individual database.

また、各マスタサーバは、同一の時間単位に基づいて、シーケンス番号(時間番号)が時刻情報として登録された制御ログを生成し、これを更新ログと共に個別データベースに登録する。制御ログの登録を契機に、更新ログは、COMMITログ及び制御ログと共に、更新ログファイルとして、レプリケーション先に送信される。   Further, each master server generates a control log in which a sequence number (time number) is registered as time information based on the same time unit, and registers this in an individual database together with an update log. When the control log is registered, the update log is transmitted to the replication destination as an update log file together with the COMMIT log and the control log.

レプリケーション先のレプリカサーバは、複数のマスタサーバから送信されてきた更新ログファイルをマージする。また、レプリカサーバは、マスタサーバ毎に、更新ログファイルに含まれる制御ログを取り出し、時間番号が同一となる制御ログの有無を確認する。   The replication destination replica server merges the update log files transmitted from the plurality of master servers. In addition, the replica server retrieves the control log included in the update log file for each master server, and checks whether there is a control log having the same time number.

確認の結果、各マスタサーバから、制御ログの時間番号が同一の更新ログファイルが得られている場合は、レプリカサーバは、制御ログ以前に登録された更新ログを有効な更新ログと見なす。そして、レプリカサーバは、各マスタサーバの更新ログファイルから、COMMIT命令の発行時に出力されたシーケンス番号を取得し、このシーケンス番号の順に、各マスタサーバの更新ログファイルに含まれるログの順序を並べ替える。   As a result of the confirmation, if an update log file having the same control log time number is obtained from each master server, the replica server regards an update log registered before the control log as a valid update log. Then, the replica server acquires the sequence number output when the COMMIT instruction is issued from the update log file of each master server, and arranges the order of the logs included in the update log file of each master server in the order of this sequence number. Change.

更新ログファイルのマージが完了すると、レプリカサーバは、該当の時間番号の制御ログまでの更新ログを、マスタサーバの個別データベースから削除する命令を発行することができる。   When the merge of the update log files is completed, the replica server can issue an instruction to delete the update log up to the control log of the corresponding time number from the individual database of the master server.

また、何からの障害が発生した場合は、いずれかのサーバから更新ログが送信されないため、制御ログの時間番号が、全てのマスタサーバにおいて揃わない状態となる。この場合、レプリカサーバは、マージ処理を一旦中断し、未送信のマスタサーバに対して再度転送を指示することもできる。   In addition, when any failure occurs, the update log is not transmitted from any of the servers, so that the time numbers of the control logs are not aligned on all the master servers. In this case, the replica server can interrupt the merge process once and instruct transfer to the untransmitted master server again.

更に、指示をしたにもかかわらず、マスタサーバからの応答がない場合には、レプリカサーバは、他のマスタサーバに対して、送信を待っている制御ログの時間番号を渡し、この時間番号に関連する更新ログを送信するよう指示を出すことができる。この場合、マスタサーバは、ネットワーク経由にて、未送信のマスタサーバの個別データベースにアクセスして更新ログを取得し、これをレプリカサーバに送信する。   In addition, if there is no response from the master server despite the instruction, the replica server passes the time number of the control log waiting for transmission to the other master server, and this time number is An instruction can be issued to send the associated update log. In this case, the master server accesses the individual database of the untransmitted master server via the network, acquires the update log, and transmits it to the replica server.

全てのマスタサーバからの更新ログファイルで、時間番号が揃った場合は、レプリカサーバは、マージされた更新ログファイルを元に、レプリケーション先のレプリカデータベースにおいて、マスタサーバでの更新を反映させる。   If the update log files from all the master servers have the same time numbers, the replica server reflects the update at the master server in the replication destination replica database based on the merged update log file.

このようにして、本発明によれば、共有ディスク上に配置されたマスタデータベースをレプリケーションする際に、更新ログが分散するため、排他制御待ちや、デットロックなどの発生を抑制し、システム全体のスループットが向上する。また、障害発生時においては、別のマスタサーバ経由にて、未反映の更新ログを転送する処理を行うことができるので、レプリケーションシステムは継続動作でき、システム全体の可用性が向上する。   In this way, according to the present invention, when replicating a master database arranged on a shared disk, update logs are distributed, so that the occurrence of waiting for exclusive control, deadlock, etc. is suppressed, and the entire system is Throughput is improved. In addition, when a failure occurs, a process of transferring an unreflected update log can be performed via another master server, so that the replication system can continue to operate, improving the availability of the entire system.

(実施の形態)
以下、本発明の実施の形態における、レプリケーションシステム、マスタサーバ、レプリカサーバ、レプリケーション方法、及びプログラムについて、図1〜図9を参照しながら説明する。最初に、本実施の形態におけるレプリケーションシステム、マスタサーバ、レプリカサーバの構成について図1及び図2を用いて説明する。図1は、本発明の実施の形態におけるレプリケーションシステムの全体構成を示す図である。図2は、本発明の実施の形態におけるマスタサーバ及びレプリカサーバの構成を示すブロック図である。
(Embodiment)
Hereinafter, a replication system, a master server, a replica server, a replication method, and a program according to an embodiment of the present invention will be described with reference to FIGS. First, the configuration of the replication system, the master server, and the replica server in this embodiment will be described with reference to FIGS. FIG. 1 is a diagram showing an overall configuration of a replication system according to an embodiment of the present invention. FIG. 2 is a block diagram showing a configuration of the master server and the replica server in the embodiment of the present invention.

図1に示すように、本実施の形態におけるレプリケーションシステム1は、データベースシステム2と、データベースシステム3とを備えている。このうち、データベースシス
テム2は、レプリケーション元(配信元)となるマスタデータベース13と、複数のマスタサーバ10−1〜10−N(Nは任意の整数)と、個別データベース11−1〜11−Nとを備えている。
As shown in FIG. 1, the replication system 1 in this embodiment includes a database system 2 and a database system 3. Among these, the database system 2 includes a master database 13 serving as a replication source (distribution source), a plurality of master servers 10-1 to 10-N (N is an arbitrary integer), and individual databases 11-1 to 11-N. And.

マスタサーバ10−1〜10−Nは、それぞれ、マスタデータベース13に対して処理を実行し、マスタデータベースに格納されているデータを更新する。個別データベース11−1〜11−Nは、マスタサーバ毎に設けられている。各個別データベース11−1〜11−Nは、対応するマスタサーバ専用の記憶装置として機能する。   Each of the master servers 10-1 to 10-N executes a process on the master database 13 and updates data stored in the master database. The individual databases 11-1 to 11-N are provided for each master server. Each individual database 11-1 to 11-N functions as a storage device dedicated to the corresponding master server.

データベースシステム3は、レプリケーション先(配信先)となるレプリカデータベース21と、レプリカサーバ20とを備えている。レプリカサーバ20は、レプリカデータベース21に対して処理を実行するサーバである。   The database system 3 includes a replica database 21 serving as a replication destination (distribution destination) and a replica server 20. The replica server 20 is a server that executes processing for the replica database 21.

また、図2に示すように、マスタサーバ10−1〜10−Nは、それぞれ、主に、更新処理部120と、時間情報付加部123と、更新ログ送信処理部124とを備えている。更新処理部120は、マスタデータベース13に対して処理を行い、それによって得られる更新ログを、対応する個別データベースに格納する。時間情報付加部123は、更新ログに時間情報を付加する。更新ログ送信処理部124は、時間情報が付加された更新ログをレプリカサーバ20に送信する。   Further, as illustrated in FIG. 2, each of the master servers 10-1 to 10-N mainly includes an update processing unit 120, a time information adding unit 123, and an update log transmission processing unit 124. The update processing unit 120 performs processing on the master database 13 and stores an update log obtained thereby in a corresponding individual database. The time information adding unit 123 adds time information to the update log. The update log transmission processing unit 124 transmits the update log to which the time information is added to the replica server 20.

更に、図2に示すように、レプリカサーバ20は、更新ログ受信処理部130と、更新ログマージ処理部129と、更新ログ反映処理部128とを備えている。更新ログ受信処理部130は、マスタサーバ10−1〜10−Nそれぞれから送信されてきた更新ログを受信する。   Further, as illustrated in FIG. 2, the replica server 20 includes an update log reception processing unit 130, an update log merge processing unit 129, and an update log reflection processing unit 128. The update log reception processing unit 130 receives the update log transmitted from each of the master servers 10-1 to 10-N.

更新ログマージ処理部129は、受信したマスタサーバそれぞれからの更新ログを、各更新ログに付加された時間情報に基づいてマージする。また、更新ログマージ処理部129は、マージの結果、マスタデータベース13での更新をレプリカデータベース21に反映させるためのファイル(更新反映用の一時ファイル)を生成する。更新ログ反映処理部128は、更新反映用の一時ファイルを用いてレプリカデータベース21をレプリケーションする。   The update log merge processing unit 129 merges the received update logs from the respective master servers based on the time information added to each update log. In addition, the update log merge processing unit 129 generates a file (temporary file for update reflection) for reflecting the update in the master database 13 to the replica database 21 as a result of the merge. The update log reflection processing unit 128 replicates the replica database 21 using the temporary file for update reflection.

このように、本実施の形態では、更新ログは分散した状態で格納される。よって、レプリケーションの実行時における、排他制御による待機命令の発行や、デットロック等の発生が、抑制される。この結果、レプリケーションシステム1におけるスループットの劣化も抑制される。   Thus, in the present embodiment, the update log is stored in a distributed state. Therefore, the issuance of a standby command by exclusive control, the occurrence of a deadlock, etc. during the execution of replication is suppressed. As a result, throughput degradation in the replication system 1 is also suppressed.

また、本実施の形態では、更新ログに、時間情報が付加されており、これを基準にマージが行われる。よって、いずれかのサーバに障害が発生し、更新ログが送信されてこなくても、後から更新ログを取り出してレプリカデータベース20を更新することができる。また、障害が発生していないサーバに、障害が発生しているサーバの更新ログを取得させることで、レプリカデータベース20を更新することもできる。この結果、レプリケーションシステム1では、障害発生した場合でも、継続して処理を行うことができる。   Further, in the present embodiment, time information is added to the update log, and merging is performed based on this. Therefore, even if a failure occurs in any of the servers and the update log is not transmitted, the replica database 20 can be updated by taking out the update log later. The replica database 20 can also be updated by causing a server in which a failure has not occurred to acquire an update log of the server in which the failure has occurred. As a result, the replication system 1 can continue processing even when a failure occurs.

ここで、本発明の実施の形態におけるレプリケーションシステム、これを構成するマスタサーバ及びレプリカサーバの構成を更に具体的に説明する。図1に示すように、本実施の形態では、マスタデータベース13に格納されているマスタ表(図示せず)に対して業務Aが行われ、レプリカデータベース21に格納されるレプリカ表に対して業務Bが実施される。業務A及び業務Bは、それぞれ、複数のクライアントコンピュータ(図示せず)によって実行される。   Here, the configuration of the replication system according to the embodiment of the present invention, and the master server and replica server constituting the replication system will be described more specifically. As shown in FIG. 1, in the present embodiment, a job A is performed on a master table (not shown) stored in the master database 13, and a job is performed on a replica table stored in the replica database 21. B is implemented. Business A and business B are each executed by a plurality of client computers (not shown).

また、本実施の形態では、マスタ表には、マスタサーバ10−1〜10−Nそれぞれが更新ログを採取するためのトリガが登録されている。トリガの出力先は、個別データベース11−1〜11−Nである。また、個別データベース11−1〜11−Nは、通常の状態では、対応するマスタサーバからのみアクセス可能となっているが、マスタサーバに障害が発生した場合は、ネットワーク上の他のマスタサーバからもアクセス可能となる。   In the present embodiment, a trigger for each master server 10-1 to 10-N to collect an update log is registered in the master table. The trigger output destinations are the individual databases 11-1 to 11-N. In addition, the individual databases 11-1 to 11-N can be accessed only from the corresponding master server in a normal state. However, if a failure occurs in the master server, the individual databases 11-1 to 11-N can be accessed from other master servers on the network. Will also be accessible.

データベースシステム2は、負荷分散型のクラスタシステムであり、ロードバランス装置12を備えている。ロードバランス装置12は、業務Aを実行するクライアントコンピュータ(図1において図示せず)から、SQL命令による操作要求が入力されると、操作要求に対して振り分け処理を実行する。これにより、各操作要求は、各マスタサーバに送られる。そして、マスタサーバ10−1〜10−Nそれぞれは、SQL命令を実行して、マスタデータベース13に格納されているデータを更新する。   The database system 2 is a load balancing cluster system and includes a load balancer 12. When an operation request based on an SQL command is input from a client computer (not shown in FIG. 1) that executes the job A, the load balancer 12 executes a distribution process for the operation request. Thereby, each operation request is sent to each master server. Then, each of the master servers 10-1 to 10 -N executes the SQL command and updates the data stored in the master database 13.

また、図2に示すように、本実施の形態では、マスタサーバ10−x(xは1〜Nまでの任意の整数)は、更新処理部120、時間情報付加部123、及び更新ログ送信処理部124に加え、静止点制御部121と、更新ログ出力部122と、指示受信部126と、更新ログ削除処理部125とを備えている。また、レプリカサーバ20は、更新ログ受信処理部130、更新ログマージ処理部129、及び更新ログ反映処理部128に加え、指示送信部127を備えている。   As shown in FIG. 2, in this embodiment, the master server 10-x (x is an arbitrary integer from 1 to N) includes an update processing unit 120, a time information addition unit 123, and an update log transmission process. In addition to the unit 124, a quiescent point control unit 121, an update log output unit 122, an instruction reception unit 126, and an update log deletion processing unit 125 are provided. Further, the replica server 20 includes an instruction transmission unit 127 in addition to the update log reception processing unit 130, the update log merge processing unit 129, and the update log reflection processing unit 128.

更新処理部120は、本実施の形態では、上述したように、業務Aを実行するクライアントコンピュータからの操作要求にしたがって、マスタデータベース13に対して処理を実行する。そして、処理の実行により、更新処理部120は、登録されているトリガから更新ログを取得し、これを個別データベース11−xに格納する。   In this embodiment, as described above, the update processing unit 120 executes processing on the master database 13 in accordance with an operation request from a client computer that executes the job A. And by execution of a process, the update process part 120 acquires an update log from the registered trigger, and stores this in the separate database 11-x.

静止点制御部121は、更新処理部120が、一連の関連する処理(トランザクション)の終了の際に、マスタデータベース13に対してCOMMIT命令を発行すると、CALLBACK関数により、起動する。静止点制御部121は、起動すると、静止点を確立し、シーケンス制御表を参照して、シーケンス番号を取得し、これをCOMMIT命令に付加する。つまり、静止点制御部121は、COMMIT命令の発行順に、各COMMIT命令にシーケンス番号を付加して、COMMITログを生成し、これを更新ログに付加する。   When the update processing unit 120 issues a COMMIT command to the master database 13 at the end of a series of related processes (transactions), the quiesce point control unit 121 is activated by a CALLBACK function. When activated, the quiesce point control unit 121 establishes a quiesce point, obtains a sequence number by referring to the sequence control table, and adds this to the COMMIT instruction. That is, the quiesce point control unit 121 generates a COMMIT log by adding a sequence number to each COMMIT instruction in the order in which the COMMIT instructions are issued, and adds this to the update log.

時間情報付加部123は、本実施の形態では、設定された時間間隔で、基準時からの経過時間を示す時間番号を含む制御ログを生成し、時間情報として制御ログを更新ログに付加する。時間情報付加部123は、制御ログ生成部としても機能している。   In the present embodiment, the time information adding unit 123 generates a control log including a time number indicating an elapsed time from the reference time at a set time interval, and adds the control log to the update log as time information. The time information addition unit 123 also functions as a control log generation unit.

具体的には、時間情報付加部123は、レプリケーション処理のプロセススタート時刻が経過した後、レプリケーションシステム1に設定された時間間隔が経過したタイミングで起動する。そして、時間情報付加部123は、マスタサーバのメモリ(図示せず)に作成されている時刻制御表にアクセスし、そこに登録されている時間番号をカウントアップする。また、時間情報付加部123は、カウントアップ後の時間番号を埋め込んだ制御ログを生成し、これとマスタサーバの情報とを更新ログに付加する。   Specifically, the time information adding unit 123 is activated at the timing when the time interval set in the replication system 1 has elapsed after the process start time of the replication processing has elapsed. Then, the time information adding unit 123 accesses a time control table created in a memory (not shown) of the master server, and counts up the time numbers registered there. Further, the time information adding unit 123 generates a control log in which the time number after counting is embedded, and adds this and the master server information to the update log.

更新ログ出力部122は、COMMITログ、制御ログ、及び更新ログを、一つの更新ログファイルとし、この更新ログファイルを更新ログ送信処理部124に送る。更新ログ送信処理部124は、更新ログファイルをレプリカサーバ20の更新ログ受信処理部130に送信する。なお、更新ログ出力部122は、COMMITログ及び制御ログが個別データベース11−xに格納されている場合は、これらのログを更新ログと共に、個別デー
タベース11−xから抽出し、更新ログファイルを生成する。
The update log output unit 122 sets the COMMIT log, the control log, and the update log as one update log file, and sends this update log file to the update log transmission processing unit 124. The update log transmission processing unit 124 transmits the update log file to the update log reception processing unit 130 of the replica server 20. When the COMMIT log and the control log are stored in the individual database 11-x, the update log output unit 122 extracts these logs together with the update log from the individual database 11-x and generates an update log file. To do.

また、レプリカサーバ20において、更新ログ受信処理部130は、本実施の形態では、上述した更新ログファイルを受信し、これを、レプリカサーバ20のメモリに設けられた転送一時ファイルに格納し、登録する。その後、更新ログ受信処理部130は、更新ログマージ処理部129を起動させる。   In the replica server 20, the update log reception processing unit 130 receives the update log file described above in this embodiment, stores it in a temporary transfer file provided in the memory of the replica server 20, and registers it. To do. Thereafter, the update log reception processing unit 130 activates the update log merge processing unit 129.

更新ログマージ処理部129は、本実施の形態では、マスタサーバ毎に、転送一時ファイルに登録されているログを一つずつ読み出し、制御ログの検出を行う。そして、更新ログマージ処理部129は、検出した制御ログの時間番号より時間番号が1つ小さい制御ログの後の更新ログから、検出した制御ログの手前のログまでを組データとして取り出し、これをマージ用一時ファイルに移送する。マージ用一時ファイルも、レプリカサーバ20のメモリに設けられている。   In this embodiment, the update log merge processing unit 129 reads out the logs registered in the temporary transfer file one by one for each master server, and detects the control log. Then, the update log merge processing unit 129 extracts from the update log after the control log whose time number is one smaller than the time number of the detected control log to the log before the detected control log as set data, and merges them. To a temporary file. A temporary merge file is also provided in the memory of the replica server 20.

更新ログマージ処理部129が、上記処理を、各マスタサーバについて実行すると、マージ用一時ファイルには、制御ログの時間番号が同一の組データが集められることとなり、組データがマージされる。また、本実施の形態では、更新ログマージ処理部129は、マージ対象となる各組データについて、組データに含まれるCOMMIT命令のシーケンス番号を抽出し、抽出した番号に基づいてマージを行う。具体的には、更新ログマージ処理部129は、COMMIT命令によってデータを区切り、区切られたデータを単位として、COMMIT命令のシーケンス番号の順に、ソートをかける。   When the update log merge processing unit 129 executes the above processing for each master server, the set data having the same control log time number is collected in the merge temporary file, and the set data is merged. Further, in the present embodiment, the update log merge processing unit 129 extracts the sequence number of the COMMIT instruction included in the set data for each set data to be merged, and performs merging based on the extracted number. Specifically, the update log merge processing unit 129 delimits data by the COMMIT instruction, and performs sorting in the order of the sequence number of the COMMIT instruction in units of the delimited data.

また、本実施の形態では、更新ログマージ処理部129によって、マージ用一時ファイルに格納されたデータが、更新用一時ファイルとなる。更新ログ反映処理部128は、本実施の形態では、マージ用一時ファイルからデータを取り出し、これをレプリカデータベース21に反映させる。   In the present embodiment, the data stored in the merge temporary file by the update log merge processing unit 129 becomes the temporary update file. In this embodiment, the update log reflection processing unit 128 takes out data from the merge temporary file and reflects it in the replica database 21.

更に、更新ログマージ処理部129は、制御ログの時間番号によって特定される時間が同一と見なされる更新ログが、マスタサーバ10−1〜10−N全てから取得されているかどうかを判定する。判定の結果、取得されていない場合は、更新ログマージ処理部129は、指示送信部127を介して、取得できていなマスタサーバに更新ログの送信を通知する。   Further, the update log merge processing unit 129 determines whether or not update logs that are considered to have the same time specified by the time number of the control log are acquired from all the master servers 10-1 to 10-N. As a result of the determination, if it has not been acquired, the update log merge processing unit 129 notifies the master server that has not been acquired of the update log transmission via the instruction transmission unit 127.

具体的には、指示送信部127は、更新ログマージ処理部129の指示に従い、マスタサーバの指示受信部126に、送信されていない制御ログの時間番号を通知して、送信を要求する。この場合、マスタサーバでは、指示受信部126は、更新ログ送信処理部124に、未送信の更新ログファイルを送信するように指示を行う。   Specifically, in accordance with the instruction from the update log merge processing unit 129, the instruction transmission unit 127 notifies the instruction reception unit 126 of the master server of the time number of the control log that has not been transmitted, and requests transmission. In this case, in the master server, the instruction receiving unit 126 instructs the update log transmission processing unit 124 to transmit an unsent update log file.

また、指示送信部127は、更新ログマージ処理部129の指示に従い、取得てきていないマスタサーバから更新ログファイルが送信されない場合は、別のマスタサーバの指示受信部127に対して、取得てきていないマスタサーバの更新ログファイルを取得し、これを送信する旨の指示を送信する。   Further, in accordance with the instruction from the update log merge processing unit 129, the instruction transmission unit 127 has not acquired the update log file from the master server that has not been acquired to the instruction reception unit 127 of another master server. An update log file of the master server is acquired and an instruction to send it is sent.

更に、本実施の形態では、更新ログマージ処理部129の指示に従い、マージ処理が正常に終了した場合は、指示送信部127を介して、指示受信部126に対して、制御ログの時間番号を指定して、更新ログファイルの削除を要求することもできる。この場合、マスタサーバでは、指示受信部126は、更新ログ削除処理部126に、指定された時間番号の制御ログと、これと一つの更新ログファイルを構成している更新ログ及びCOMMITログとを、個別データベース11−xから削除させる。   Further, according to the present embodiment, when the merge process is normally completed according to the instruction of the update log merge processing unit 129, the time number of the control log is designated to the instruction receiving unit 126 via the instruction transmission unit 127. It is also possible to request deletion of the update log file. In this case, in the master server, the instruction receiving unit 126 sends the update log deletion processing unit 126 the control log of the designated time number, and the update log and the COMMIT log constituting one update log file. And deleting from the individual database 11-x.

また、指示送信部127は、削除を指示したマスタサーバから応答がない場合は、別のマスタサーバの指示受信部127に対し、応答がないマスタサーバの個別データベースにアクセスして、更新ログ、制御ログ及びCOMMITログを削除する旨の指示を送信する。   In addition, when there is no response from the master server instructing the deletion, the instruction transmitting unit 127 accesses the individual database of the master server that does not respond to the instruction receiving unit 127 of another master server, and updates the log and control. An instruction to delete the log and the COMMIT log is transmitted.

続いて、本発明の実施の形態におけるレプリケーションシステム1の動作を、図3及び図4を用いて説明する。図3は、本発明の実施の形態におけるレプリケーションシステムの動作を示すフロー図である。図4は、マスタデータベースシステムで利用される各種ログ及び情報の一例を示す図である。   Next, the operation of the replication system 1 according to the embodiment of the present invention will be described with reference to FIGS. FIG. 3 is a flowchart showing the operation of the replication system according to the embodiment of the present invention. FIG. 4 is a diagram illustrating an example of various logs and information used in the master database system.

また、本実施の形態においては、レプリケーション方法は、レプリケーションシステム1を動作させることによって実行される。よって、本実施の形態におけるレプリケーション方法の説明は、以下の実施の形態におけるレプリケーションシステムの動作の説明に代える。なお、以下の説明においては、適宜図1及び図2を参酌する。   In the present embodiment, the replication method is executed by operating the replication system 1. Therefore, the description of the replication method in the present embodiment is replaced with the description of the operation of the replication system in the following embodiment. In the following description, FIGS. 1 and 2 are referred to as appropriate.

図3に示すように、先ず、マスタサーバ10−1〜10−Nそれぞれによって、処理が実行され、マスタデータベース13の更新が行われると共に、各マスタサーバの個別データベース11−1〜11−Nには更新ログ(図4参照)が格納される(ステップS1)。   As shown in FIG. 3, first, processing is executed by each of the master servers 10-1 to 10-N, the master database 13 is updated, and the individual databases 11-1 to 11-N of each master server are updated. Stores an update log (see FIG. 4) (step S1).

次に、各マスタサーバでは、更新ログに、時間番号を含む制御ログ(図4参照)が付加される(ステップS2)。本実施の形態では、制御ログも、個別データベースに格納される。また、COMMIT命令が発行されたときは、COMMITログ(図4参照)が取得され、COMMITログも個別データベースに格納される。   Next, in each master server, a control log (see FIG. 4) including a time number is added to the update log (step S2). In the present embodiment, the control log is also stored in the individual database. When a COMMIT instruction is issued, a COMMIT log (see FIG. 4) is acquired and the COMMIT log is also stored in the individual database.

次に、マスタサーバ10−1〜10−Nそれぞれは、更新ログに制御ログ及びCOMMITログを付加して、更新ログファイルを生成し、これをレプリカサーバ20に向けて送信する(ステップS3)。   Next, each of the master servers 10-1 to 10-N adds a control log and a COMMIT log to the update log, generates an update log file, and transmits this to the replica server 20 (step S3).

次に、レプリカサーバ20では、更新ログマージ処理部129は、全てのマスタサーバについて更新ログファイルの時間番号が揃っているかどうかを判定する(ステップS4)。つまり、更新ログマージ処理部129は、制御ログの時間番号によって特定される時間が同一と見なされる更新ログが、マスタサーバ10−1〜10−N全てから取得されているかどうかを判定する。   Next, in the replica server 20, the update log merge processing unit 129 determines whether or not the time numbers of the update log files are aligned for all the master servers (step S4). That is, the update log merge processing unit 129 determines whether or not the update logs that are considered to have the same time specified by the time number of the control log are acquired from all the master servers 10-1 to 10-N.

ステップS4の判定の結果、全てのマスタサーバについて更新ログファイルの時間番号が揃っている場合は、ステップS8が実行される。一方、ステップS4の判定の結果、全てのマスタサーバについて更新ログファイルの時間番号が揃っていない場合は、更新ログマージ処理部129は、指示送信部127を介して、取得できていなマスタサーバに更新ログの送信を通知する(ステップS5)。   As a result of the determination in step S4, when the time numbers of the update log files are all set for all the master servers, step S8 is executed. On the other hand, as a result of the determination in step S4, if the update log file time numbers are not complete for all the master servers, the update log merge processing unit 129 updates to the master server that could not be acquired via the instruction transmission unit 127. The log transmission is notified (step S5).

なお、ステップS5では、取得てきていないマスタサーバから応答が無い場合、更新ログマージ処理部129は、指示送信部127を介し、別のマスタサーバの指示受信部127に対し、取得てきていないマスタサーバの更新ログファイルを取得し、これを送信するよう指示を行う。   In step S5, if there is no response from the master server that has not been acquired, the update log merge processing unit 129 sends the master server that has not been acquired to the instruction reception unit 127 of another master server via the instruction transmission unit 127. An update log file is obtained and an instruction is sent to send it.

ステップS5の実行により、更新ログ受信処理部130は、未送信であった更新ログファイルを受信する(ステップS6)。次に、更新ログマージ処理部129により、更新ログファイルのマージが行われ、更新用一時ファイルが生成される(ステップS7)。その後、更新ログ反映処理部128により、レプリカデータベースにおいて更新用一時ファイルが反映され、レプリケーションが実行される(ステップS8)。レプリケーションシス
テムでは、データベースシステム2及び3が稼動している間、ステップS1〜S8は繰り返し実行される。
By executing step S5, the update log reception processing unit 130 receives an update log file that has not been transmitted (step S6). Next, the update log merge processing unit 129 merges the update log files and generates a temporary file for update (step S7). Thereafter, the update log reflection processing unit 128 reflects the temporary file for update in the replica database and executes replication (step S8). In the replication system, steps S1 to S8 are repeatedly executed while the database systems 2 and 3 are operating.

次に、レプリケーションシステム1構成するマスタサーバ10−1〜10−Nそれぞれの動作について図5〜図6を用いて更に具体的に説明する。図5は、本発明の実施の形態におけるマスタサーバによるCOMMITログの生成処理を示すフロー図である。図6は、本発明の実施の形態におけるマスタサーバによる制御ログの生成処理を示すフロー図である。   Next, the operations of the master servers 10-1 to 10-N constituting the replication system 1 will be described more specifically with reference to FIGS. FIG. 5 is a flowchart showing generation processing of the COMMIT log by the master server according to the embodiment of the present invention. FIG. 6 is a flowchart showing a control log generation process by the master server in the embodiment of the present invention.

図5に示すように、COMMITログの生成においては、先ず、業務Aのトランザクション終了タイミング時に、更新処理部120が、COMMIT命令を発行する(ステップA1)。次に、COMMIT命令発行されると、CALLBACK関数によって、静止点制御部121が動作し、静止点が確立される(ステップA2)。   As shown in FIG. 5, in generating the COMMIT log, first, the update processing unit 120 issues a COMMIT command at the transaction end timing of the job A (step A1). Next, when a COMMIT instruction is issued, the static point control unit 121 operates by the CALLBACK function, and a static point is established (step A2).

次に、静止点制御部121は、マスタデータベース13にシーケンス番号の取得を要求する(ステップA3)。ステップA3により、静止点制御部121は、シーケンス制御表を参照できるようになる。そして、静止点制御部121は、データベース13によって一意に処理順にカウントアップされたシーケンス番号を取得する(ステップA4)。   Next, the stationary point control unit 121 requests the master database 13 to acquire a sequence number (step A3). By step A3, the stationary point control unit 121 can refer to the sequence control table. Then, the stationary point control unit 121 acquires a sequence number that is uniquely counted up in the processing order by the database 13 (step A4).

なお、シーケンス制御表は、マスタデータベース13内に設けられている。マスタデータベース13は、COMMIT処理の度に、シーケンス制御表を更新し、その際、シーケンス番号をカウントアップする。   The sequence control table is provided in the master database 13. The master database 13 updates the sequence control table every time the COMMIT process is performed, and increments the sequence number at that time.

次に、静止点制御部121は、取得したシーケンス番号とサーバ情報(図4参照)とでCOMMITログを作成する(ステップA5)。更に、静止点制御部121は、生成したCOMMITログを個別データベース11−xに出力し、これを対応する更新ログに付加する(ステップA6)。   Next, the stationary point control unit 121 creates a COMMIT log with the acquired sequence number and server information (see FIG. 4) (step A5). Furthermore, the quiesce point control unit 121 outputs the generated COMMIT log to the individual database 11-x and adds it to the corresponding update log (step A6).

また、図6に示すように、制御ログの生成においては、先ず、レプリケーション処理のプロセスのスタート時刻となり、レプリケーション処理が開始され、各マスタサーバ10−xの更新処理部120では、タイマー監視が実行される(ステップB1)。   As shown in FIG. 6, in the generation of the control log, first, the replication processing process start time is reached, the replication processing is started, and the update monitoring unit 120 of each master server 10-x performs timer monitoring. (Step B1).

次に、更新処理部120は、タイマー監視において、レプリケーションシステム1上で予め設定された時間が経過したかどうかを判定する(ステップB2)。経過していない場合は、更新処理部120は待機状態となる。一方、経過している場合は、更新処理部120は、設定された時間が経過するタイミングで、時間情報付加部123を起動させる。   Next, the update processing unit 120 determines whether a preset time has elapsed on the replication system 1 in the timer monitoring (step B2). If the time has not elapsed, the update processing unit 120 enters a standby state. On the other hand, if the time has elapsed, the update processing unit 120 activates the time information adding unit 123 at the timing when the set time elapses.

時間情報付加部123は、起動すると、マスタサーバのメモリ(図示せず)に作成されている時刻制御表にアクセスし、そこに登録されている時間番号をカウントアップし、カウントアップ後の時間番号を埋め込んだ制御ログを生成する(B3)。次に、時間情報付加部123は、制御ログとマスタサーバの情報(サーバ情報:図4参照)とを更新ログに付加するため、制御ログを個別データベース11−xに出力し、それに登録させる(ステップB4)。   When activated, the time information adding unit 123 accesses a time control table created in the memory (not shown) of the master server, counts up the time number registered therein, and the time number after counting up A control log in which is embedded is generated (B3). Next, in order to add the control log and master server information (server information: see FIG. 4) to the update log, the time information adding unit 123 outputs the control log to the individual database 11-x and registers it ( Step B4).

図5に示したステップA1〜A5と、図6に示したステップB1〜B4とが終了すると、更新ログ出力部122が起動する。更新ログ出力部122は、個別データベース11−1〜11−Nに格納されている全てのログレコードを読み込み、マスタサーバ毎に更新ログファイルを生成し、これを更新ログ送信処理部124に送る。その後、更新ログ送信処理部124により、更新ログファイルが、レプリカサーバ20の更新ログ受信処理部130に送信される。   When steps A1 to A5 shown in FIG. 5 and steps B1 to B4 shown in FIG. 6 are completed, the update log output unit 122 is activated. The update log output unit 122 reads all the log records stored in the individual databases 11-1 to 11 -N, generates an update log file for each master server, and sends this to the update log transmission processing unit 124. Thereafter, the update log transmission processing unit 124 transmits the update log file to the update log reception processing unit 130 of the replica server 20.

次に、レプリケーションシステム1を構成するレプリカサーバ20の動作について図7〜図9を用いて説明する。図7は、本発明の実施の形態におけるレプリカサーバによる更新ログファイルの受信処理を示すフロー図である。図8は、本発明の実施の形態におけるレプリカサーバによるマージ処理を示すフロー図である。図9は、本発明の実施の形態におけるレプリカサーバによる各種要求処理を示すフロー図である。   Next, the operation of the replica server 20 configuring the replication system 1 will be described with reference to FIGS. FIG. 7 is a flowchart showing the reception process of the update log file by the replica server in the embodiment of the present invention. FIG. 8 is a flowchart showing merge processing by the replica server in the embodiment of the present invention. FIG. 9 is a flowchart showing various request processes by the replica server in the embodiment of the present invention.

図7に示す処理は、マスタサーバ10−1〜10−Nから更新ログファイルが転送され、これを更新ログ受信処理部130が受信し、更に、更新ログ受信処理部130が、受信した更新ログファイルを、転送一時ファイルに登録すると開始される。また、図7に示す処理は、更新ログマージ処理部129によって、マスタサーバ単位で行われる。   In the process shown in FIG. 7, the update log file is transferred from the master servers 10-1 to 10-N, the update log reception processing unit 130 receives the update log file, and the update log reception processing unit 130 receives the update log. Triggered when a file is registered in a temporary transfer file. Further, the process illustrated in FIG. 7 is performed by the update log merge processing unit 129 in units of master servers.

図7に示すように、先ず、更新ログマージ処理部129は、転送一時ファイルに登録されている更新ログファイルからログを1件取り出し(ステップC1)、取り出したログが制御ログかどうかを判定する(ステップC2)。   As shown in FIG. 7, first, the update log merge processing unit 129 extracts one log from the update log file registered in the temporary transfer file (step C1), and determines whether or not the extracted log is a control log (step C1). Step C2).

ステップC2の判定の結果、制御ログで無い場合は、更新ログマージ処理部129は、次のログを取り出し、判定を行う。一方、ステップC2の判定の結果、制御ログである場合は、更新ログマージ処理部129は、該当マスタサーバの制御ログ管理表にアクセスし、そこに登録されている前回の処理における制御ログの時間番号を取得する(ステップC3)。   If the result of determination in step C2 is not a control log, the update log merge processing unit 129 extracts the next log and performs determination. On the other hand, if the result of determination in step C2 is a control log, the update log merge processing unit 129 accesses the control log management table of the corresponding master server, and the time number of the control log in the previous process registered there Is acquired (step C3).

次に、更新ログマージ処理部12は、ステップC1で取得された制御ログの時間番号が、ステップC3で取得された時間番号に1を加えた番号であるかどうかを判定する(ステップC4)。   Next, the update log merge processing unit 12 determines whether or not the time number of the control log acquired in step C1 is a number obtained by adding 1 to the time number acquired in step C3 (step C4).

ステップC4の結果、1を加えた番号である場合は、更新ログマージ処理部12は、前回読み出した制御ログの後の更新ログから、ステップC1で読み出した制御ログの直前のCOMMITログまでを、組データとして取り出し、これをマージ用一時ファイルに移送する(ステップC5)。そして、更新ログマージ処理部12は、今回の制御ログの時間番号を制御ログ管理表(図4参照)に登録する(ステップC6)。   As a result of step C4, when the number is 1 plus, the update log merge processing unit 12 sets the update log after the previously read control log to the COMMIT log immediately before the control log read in step C1. The data is taken out and transferred to a merge temporary file (step C5). Then, the update log merge processing unit 12 registers the time number of the current control log in the control log management table (see FIG. 4) (step C6).

一方、ステップC4の結果、1を加えた番号でない場合は、更新ログマージ処理部12は、ステップC1で取得された制御ログの時間番号が、ステップC3で取得された時間番号よりも小さいかどうかを判定する(ステップC7)。ステップC7の結果、小さい場合は、更新ログマージ処理部12は、現在の位置までの更新ログを無効と判断し、処理対象外とする(ステップC8)。   On the other hand, if it is not the number obtained by adding 1 as a result of step C4, the update log merge processing unit 12 determines whether or not the time number of the control log acquired in step C1 is smaller than the time number acquired in step C3. Determine (step C7). If the result of step C7 is small, the update log merge processing unit 12 determines that the update log up to the current position is invalid and excludes it from the processing target (step C8).

また、ステップC7の結果、小さくない場合と、ステップC8を実行した場合は、更新ログマージ処理部12は、再度ステップC1を実行する。このように、ステップC1〜C8の実行により、更新ログマージ処理部12は、次の制御ログを読み出すまで、更新ログファイルからのログの読み出しを繰り返し実行する。また、更新ログマージ処理部12は、今回の時間番号が、前回処理したときの時間番号+2以上の場合は、今回の制御ログを無視して、次の制御ログまで読み出しを繰り返し実行する。   When the result of step C7 is not small and when step C8 is executed, the update log merge processing unit 12 executes step C1 again. In this way, by executing Steps C1 to C8, the update log merge processing unit 12 repeatedly executes reading of the log from the update log file until the next control log is read. Further, if the current time number is equal to or greater than the time number of the previous processing +2, the update log merge processing unit 12 ignores the current control log and repeats reading until the next control log.

全てのマスタサーバからの更新ログファイルについて、ステップC1〜C6が実行されると、図8に示すマージ処理が実行される。図8に示すように、先ず、更新ログマージ処理部129は、制御ログの時間番号によって特定される時間が同一と見なされる更新ログが、マスタサーバ10−1〜10−N全てから取得されているかどうかを判定する(ステップD1)。具体的には、更新ログマージ処理部129は、制御ログ管理表(図4参照)
を参照し、全てのマスタサーバについて、制御ログの時間番号が揃っているかどうかを判定する。
When Steps C1 to C6 are executed for the update log files from all the master servers, the merge process shown in FIG. 8 is executed. As shown in FIG. 8, first, the update log merge processing unit 129 determines whether update logs that are considered to have the same time specified by the time number of the control log are acquired from all the master servers 10-1 to 10-N. It is determined whether or not (step D1). Specifically, the update log merge processing unit 129 is a control log management table (see FIG. 4).
To determine whether or not the time numbers of the control logs are prepared for all the master servers.

ステップD1の判定の結果、揃っていない場合は、更新ログマージ処理部129は、指示送信部127を呼び出し、図9に示されるステップE1〜E4を実行させる。ステップE1〜E9については後述する。一方、ステップD1の判定の結果、揃っている場合は、更新ログマージ処理部129は、マージ処理を開始する(ステップD2)。   If the result of determination in step D1 is not complete, the update log merge processing unit 129 calls the instruction transmission unit 127 to execute steps E1 to E4 shown in FIG. Steps E1 to E9 will be described later. On the other hand, if it is determined as a result of the determination in step D1, the update log merge processing unit 129 starts the merge process (step D2).

具体的には、ステップD2では、更新ログマージ処理部129は、マスタサーバそれぞれの更新ログファイルを格納するマージ用一時ファイルにアクセスする。そして、更新ログマージ処理部129は、任意の更新ログファイルからCOMMITログを抽出し、COMMITログが出るまでを一単位として、COMMIT命令のシーケンス番号順にソートを行い、これによりマージを行う。   Specifically, in step D2, the update log merge processing unit 129 accesses a merge temporary file that stores an update log file of each master server. Then, the update log merge processing unit 129 extracts a COMMIT log from an arbitrary update log file, sorts the COMMIT instruction in sequence number order until the COMMIT log is output, and performs a merge.

更に、更新ログマージ処理部129は、得られたファイルを更新用一時ファイルとし、レプリカサーバのメモリに登録し、マージ処理を終了する(ステップD3)。そして、更新ログマージ処理部129は、更新ログ反映処理部128を呼び出す。また、マージ処理が正常に終了した場合には、更新ログマージ処理部129は、指示送信部127を呼び出し、制御ログの時間番号を指定して、更新ログファイルの削除を実行するよう要求する。この場合も、指示送信部127は、図9に示されるステップE1〜E4を実行する。ステップE1〜E9については後述する。   Further, the update log merge processing unit 129 sets the obtained file as an update temporary file, registers it in the memory of the replica server, and ends the merge process (step D3). Then, the update log merge processing unit 129 calls the update log reflection processing unit 128. Further, when the merge processing is normally completed, the update log merge processing unit 129 calls the instruction transmission unit 127, specifies the time number of the control log, and requests deletion of the update log file. Also in this case, the instruction transmission unit 127 executes Steps E1 to E4 shown in FIG. Steps E1 to E9 will be described later.

次に、更新ログ反映処理部128は、更新反映用一時ファイルを元に、レプリカデータベース21に対してレプリケーションを実施する(ステップD4)。これにより、レプリカデータベース21に、マスタデータベース13における更新が反映される。   Next, the update log reflection processing unit 128 performs replication on the replica database 21 based on the update reflection temporary file (step D4). Thereby, the update in the master database 13 is reflected in the replica database 21.

上述したように、図9に示すステップE1〜E4は、ステップD1の判定結果により、又はステップD3の実施に伴い、実行される。図9に示すように、先ず、指示送信部127は、更新ログマージ処理部129による指示が、ステップD3におけるマージ処理が正常終了した場合の削除指示かどうかを判定する(ステップE1)。   As described above, steps E1 to E4 shown in FIG. 9 are executed according to the determination result of step D1 or with the execution of step D3. As shown in FIG. 9, first, the instruction transmission unit 127 determines whether or not the instruction from the update log merge processing unit 129 is a deletion instruction when the merge process in step D3 is normally completed (step E1).

ステップE1の判定の結果、削除指示でない場合は、指示送信部127は、更新ログファイルを未だ送信していないマスタサーバに対して、転送一時ファイルに残っている更新ログファイルを送信するよう指示を行う(ステップE5)。具体的には、指示送信部127は、制御ログを受信していないマスタサーバの指示受信部126に対して、時間番号を通知し、送信指示を要求する。   If the result of determination in step E1 is not a delete instruction, the instruction transmission unit 127 instructs the master server that has not yet transmitted the update log file to transmit the update log file remaining in the temporary transfer file. Perform (step E5). Specifically, the instruction transmission unit 127 notifies the instruction reception unit 126 of the master server that has not received the control log of the time number and requests a transmission instruction.

一方、ステップE1の判定の結果、削除指示である場合は、指示送信部127は、全てのマスタサーバ10−1〜10−Nに対して、削除対象となる更新ログファイルの時間番号を通知して、更新ログファイルの削除を要求する(ステップE2)。   On the other hand, if the result of determination in step E1 is a deletion instruction, the instruction transmission unit 127 notifies the time numbers of update log files to be deleted to all master servers 10-1 to 10-N. The deletion of the update log file is requested (step E2).

ステップE2又はステップE5が実行されると、指示送信部127は、指示を送信したマスタサーバの指示受信部126からの応答の有無を判定する(ステップE3)。ステップE3の判定の結果、指示を送信した全てのマスタサーバの指示受信部126から応答がある場合は、指示送信部127は処理を終了する。   When step E2 or step E5 is executed, the instruction transmitting unit 127 determines whether or not there is a response from the instruction receiving unit 126 of the master server that transmitted the instruction (step E3). As a result of the determination in step E3, when there is a response from the instruction receiving unit 126 of all the master servers that transmitted the instruction, the instruction transmitting unit 127 ends the process.

一方、ステップE3の判定の結果、いずれかのマスタサーバの指示受信部126からの応答が無い場合は、指示送信部127は、他のマスタサーバに、更新ログファイルの送信又は削除を実行するよう指示を送信する(ステップE4)。   On the other hand, as a result of the determination in step E3, if there is no response from the instruction receiving unit 126 of any master server, the instruction transmitting unit 127 transmits or deletes the update log file to another master server. An instruction is transmitted (step E4).

具体的には、ステップE4では、指示送信部127は、応答が無いマスタサーバのサーバ情報制御表にアクセスし、接続情報を取得する。そして、指示送信部127は、取得した接続情報を元に、応答が無いマスタサーバとは別のサーバIDを持つマスタサーバに対して、応答が無いマスタサーバの更新ログファイルを送信するように要求する。また、指示送信部127は、マージ処理が正常に終了している場合は、別のサーバIDを持つマスタサーバに対して、応答が無いマスタサーバの更新ログファイルを削除するように要求する。ステップE4の終了後、指示送信部127は処理を終了する。   Specifically, in step E4, the instruction transmission unit 127 accesses the server information control table of the master server that does not respond and acquires connection information. Then, the instruction transmission unit 127 requests the master server having a different server ID from the master server having no response to transmit the update log file of the master server having no response based on the acquired connection information. To do. In addition, when the merge process is normally completed, the instruction transmission unit 127 requests the master server having another server ID to delete the update log file of the master server that does not respond. After the end of step E4, the instruction transmission unit 127 ends the process.

また、本実施の形態におけるプログラムは、マスタサーバ用のプログラムと、レプリカサーバ用のプログラムである。このうち、マスタサーバ用のプログラムは、コンピュータに、図5に示すステップA1〜A6と図6に示すB1〜B4とを実行させるプログラムであれば良い。このプログラムをコンピュータにインストールし、実行することにより、本実施の形態におけるマスタサーバを実現することができる。   The programs in the present embodiment are a master server program and a replica server program. Of these, the master server program may be a program that causes a computer to execute steps A1 to A6 shown in FIG. 5 and B1 to B4 shown in FIG. By installing and executing this program on a computer, the master server in the present embodiment can be realized.

この場合、コンピュータのCPU(central processing unit)は、更新処理部120、静止点制御部121、更新ログ出力部122、時間情報付加部123、更新ログ送信処理部124、更新ログ削除処理部125、及び指示受信部126として機能し、処理を行なう。   In this case, the central processing unit (CPU) of the computer includes an update processing unit 120, a quiesce point control unit 121, an update log output unit 122, a time information addition unit 123, an update log transmission processing unit 124, an update log deletion processing unit 125, And functions as the instruction receiving unit 126 to perform processing.

更に、レプリカサーバ用のプログラムは、コンピュータに、図7に示すステップC1〜C8、図8に示すD1〜D4、及び図9に示すE1〜E4を実行させるプログラムであれば良い。このプログラムをコンピュータにインストールし、実行することにより、本実施の形態におけるレプリカサーバを実現することができる。この場合、コンピュータのCPUは、指示送信部127、更新ログ反映処理部128、更新ログマージ処理部129、及び更新ログ受信処理部130として機能し、処理を行う。   Further, the replica server program may be a program that causes a computer to execute steps C1 to C8 shown in FIG. 7, D1 to D4 shown in FIG. 8, and E1 to E4 shown in FIG. By installing and executing this program on a computer, the replica server in the present embodiment can be realized. In this case, the CPU of the computer functions as an instruction transmission unit 127, an update log reflection processing unit 128, an update log merge processing unit 129, and an update log reception processing unit 130 to perform processing.

以上のように本実施の形態によれば、以下の効果を得ることができる。第1の効果は、レプリケーション元の業務Aを実行するデータベースシステム全体のスループットが向上することである。このような第1の効果が得られるのは、更新ログを分散させた状態でのレプリケーションにより、排他制御に待機命令の発行や、デットロックなどの発生が抑制されるからである。また、分散した更新ログのマージが、業務Aの更新の延長ではなく、レプリケーション転送先で非同期で行われることも第1の効果が得られる理由となる。   As described above, according to the present embodiment, the following effects can be obtained. The first effect is that the throughput of the entire database system that executes the transaction A as the replication source is improved. Such a first effect can be obtained because replication in a state in which the update log is distributed suppresses the generation of a standby instruction for exclusive control and the occurrence of a deadlock. In addition, the merge of the distributed update logs is not an extension of the update of the job A but is performed asynchronously at the replication transfer destination, which is the reason why the first effect can be obtained.

本実施の形態による第2の効果は、クラスタシステムを構成する一部のサーバにてサーバダウンなどの何らかの障害が発生した場合でも、レプリケーションが他のサーバで継続可能なので可用性が向上することである。これは、時刻情報を元にした制御ログをキーにして、障害が発生したマスタサーバで出力を予定していた更新ログが、他のマスタサーバによって出力できるように構成されているためである。また、これにより、クラスタシステムの一部が動作不能になっても、レプリケーション転送先には更新ログファイルが転送されるため、耐障害性が向上する   The second effect of the present embodiment is that availability can be improved because replication can be continued on other servers even when some failure such as server failure occurs in some servers constituting the cluster system. . This is because the control log based on the time information is used as a key so that an update log scheduled to be output by the master server in which the failure has occurred can be output by another master server. As a result, even if a part of the cluster system becomes inoperable, the update log file is transferred to the replication transfer destination, improving fault tolerance.

図10及び図11を用いて、本発明の実施例を説明する。図10は、本発明の実施例において各マスタサーバが生成した各種ログを示す図である。図11は、本発明の実施例においてレプリカサーバが実行したマージ処理の結果を示す図である。なお、図10及び図11は、マスタサーバが三台の例を示している。   An embodiment of the present invention will be described with reference to FIGS. FIG. 10 is a diagram illustrating various logs generated by each master server in the embodiment of the present invention. FIG. 11 is a diagram illustrating a result of the merge process executed by the replica server in the embodiment of the present invention. 10 and 11 show an example in which there are three master servers.

図10には、各マスタサーバが出力した更新ログファイルが示されている。マスタサーバ10−1ではtable1のupdate命令が実行され、COMMIT番号3が割り当てられている。また、マスタサーバ10−1では、12/11の4時10分に、時間番
号(制御シーケンス番号)11のログが出力されている。
FIG. 10 shows an update log file output by each master server. In the master server 10-1, the update instruction of table1 is executed, and COMMIT number 3 is assigned. In the master server 10-1, a log of the time number (control sequence number) 11 is output at 4:10 on December 11th.

また、図10に示すように、マスタサーバ10−2では、table1へのinsert命令が実行され、COMMIT番号2が割り当てられている。また、マスタサーバ10−2でも、12/11の4時10分に、時間番号(制御シーケンス番号)11のログが出力されている。   Also, as shown in FIG. 10, in the master server 10-2, the insert instruction to table1 is executed and COMMIT number 2 is assigned. Also in the master server 10-2, the log of the time number (control sequence number) 11 is output at 4:10 on December 11th.

マスタサーバ10−3では、table1へのdelete命令が実行され、COMMIT命令が実行されていない。但し、12/11の4時10分に、時間番号(制御シーケンス番号)11のログが出力されている。   In the master server 10-3, the delete instruction to table1 is executed, and the COMMIT instruction is not executed. However, the log of the time number (control sequence number) 11 is output at 4:10 on December 11th.

図10に示された更新ログファイルを、上述したレプリケーションシステム1によって、レプリカサーバ20に転送された場合の、マージ結果を図11に示す。図11に示すように、12/11の4時10分の制御ログの時間番号により、3つのマスタサーバの更新ログファイルが、マージ用一時ファイルに登録される。   FIG. 11 shows the merge result when the update log file shown in FIG. 10 is transferred to the replica server 20 by the replication system 1 described above. As shown in FIG. 11, the update log files of the three master servers are registered in the merge temporary file by the time number of the control log at 4:11 on 12/11.

しかしながら、マスタサーバ10−3の更新ログファイルにはCOMMITログが登録されていないため、マージ対象とはならない。この結果、図11に示すように、マスタサーバ10−1及び10−2の更新ログファイルのみがCOMMIT番号の順にソートされ、更新反映用一時ファイルとなる。   However, since the COMMIT log is not registered in the update log file of the master server 10-3, it is not a merge target. As a result, as shown in FIG. 11, only the update log files of the master servers 10-1 and 10-2 are sorted in the order of the COMMIT numbers and become the update reflection temporary files.

以上のように、本発明はレプリケーションシステムに有用であり、クラスタシステムを用いてレプリケーションを実行する際におけるスループットの劣化を抑制しつつ、障害発生時の継続処理を実現できる。本発明は、産業上の利用可能性を有している。   As described above, the present invention is useful for a replication system, and can realize continuous processing when a failure occurs while suppressing deterioration in throughput when replication is performed using a cluster system. The present invention has industrial applicability.

1 レプリケーションシステム
2 マスタデータベースシステム
3 レプリカデータベースシステム
10−1〜10−N マスタサーバ
11−1〜11−N 個別データベース
12 ロードバランス装置
13 マスタデータベース
20 レプリカサーバ
21 レプリカデータベース
120 更新処理部
121 静止点制御部
122 更新ログ出力部
123 時間情報付加部
124 更新ログ送信処理部
125 更新ログ削除処理部
126 指示受信部
127 指示送信部
128 更新ログ反映処理部
129 更新ログマージ処理部
130 更新ログ受信処理部
DESCRIPTION OF SYMBOLS 1 Replication system 2 Master database system 3 Replica database system 10-1 to 10-N Master server 11-1 to 11-N Individual database 12 Load balancer 13 Master database 20 Replica server 21 Replica database 120 Update processing unit 121 Quiescent point control Unit 122 update log output unit 123 time information addition unit 124 update log transmission processing unit 125 update log deletion processing unit 126 instruction reception unit 127 instruction transmission unit 128 update log reflection processing unit 129 update log merge processing unit 130 update log reception processing unit

Claims (18)

第1のデータベースシステムと、第2のデータベースシステムとを備えたレプリケーションシステムであって、
前記第1のデータベースシステムは、レプリケーション元となるマスタデータベースと、前記マスタデータベースに対して処理を行う複数のマスタサーバと、前記複数のマスタサーバそれぞれ毎に設けられた個別データベースとを備え、
前記第2のデータベースシステムは、レプリケーション先となるレプリカデータベースと、前記レプリカデータベースに対して処理を行うレプリカサーバとを備え、
前記複数のマスタサーバそれぞれは、前記マスタデータベースに対して処理を行った場合に得られる更新ログを、それぞれの前記個別データベースに格納し、更に、前記更新ログに時間情報を付加し、そして、前記時間情報が付加された更新ログを前記レプリカサーバに送信し、
前記レプリカサーバは、前記複数のマスタサーバそれぞれから送信されてきた前記更新ログを、各更新ログに付加された時間情報に基づいてマージし、それによって、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成し、生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ことを特徴とするレプリケーションシステム。
A replication system comprising a first database system and a second database system,
The first database system includes a master database serving as a replication source, a plurality of master servers that perform processing on the master database, and individual databases provided for each of the plurality of master servers,
The second database system includes a replica database serving as a replication destination, and a replica server that performs processing on the replica database.
Each of the plurality of master servers stores an update log obtained when processing is performed on the master database in each individual database, further adds time information to the update log, and Send the update log with the time information added to the replica server,
The replica server merges the update log transmitted from each of the plurality of master servers based on time information added to each update log, and thereby updates the master database to the replica database. A replication system, wherein a file to be reflected is generated, and the replica database is replicated using the generated file.
前記レプリカサーバは、前記時間情報によって特定される時間が同一と見なされる更新ログが、前記複数のマスタサーバ全てから取得されているかどうかを判定し、
取得されていない場合は、取得できていなマスタサーバに更新ログの送信を通知し、
更に、前記取得てきていないマスタサーバから更新ログが送信されない場合は、別のマスタサーバに、前記取得てきていないマスタサーバの更新ログを取得させ、送信させる、請求項1に記載のレプリケーションシステム。
The replica server determines whether or not update logs that are considered to have the same time specified by the time information are acquired from all of the plurality of master servers,
If it has not been acquired, notify the master server that was not able to acquire the update log transmission,
2. The replication system according to claim 1, wherein when an update log is not transmitted from the master server that has not been acquired, the update log of the master server that has not been acquired is acquired and transmitted to another master server.
前記複数のマスタサーバそれぞれが、設定された時間間隔で、基準時からの経過時間を示す時間番号を含む制御ログを生成し、前記時間情報として前記制御ログを前記更新ログに付加する、請求項1または2に記載のレプリケーションシステム。   Each of the plurality of master servers generates a control log including a time number indicating an elapsed time from a reference time at a set time interval, and adds the control log to the update log as the time information. The replication system according to 1 or 2. 前記レプリカサーバが、前記複数のマスタサーバそれぞれ毎に、前記制御ログを検出し、検出した前記制御ログの時間番号より時間番号が1つ小さい制御ログの後の更新ログから、検出した制御ログの手間のログまでを組データとして取り出し、前記制御ログの前記時間番号が同一となる組データをマージする、請求項3に記載のレプリケーションシステム。   The replica server detects the control log for each of the plurality of master servers, and from the update log after the control log whose time number is one smaller than the time number of the detected control log, 4. The replication system according to claim 3, wherein up to a troublesome log is taken out as set data, and the set data having the same time number in the control log is merged. 前記複数のマスタサーバそれぞれが、前記処理の終了の際に前記マスタデータベースに対してCOMMIT命令を発行し、発行した順に、各COMMIT命令に番号を付加して、COMMITログを生成し、これを前記更新ログに付加しており、
前記レプリカサーバが、マージ対象となる各組データについて、前記組データに含まれる前記COMMIT命令の番号を抽出し、抽出した番号に基づいてマージを行う、請求項4に記載のレプリケーションシステム。
Each of the plurality of master servers issues a COMMIT instruction to the master database at the end of the processing, and adds a number to each COMMIT instruction in the order of issue, and generates a COMMIT log. Added to the update log,
The replication system according to claim 4, wherein the replica server extracts the number of the COMMIT instruction included in the set data for each set data to be merged, and performs merging based on the extracted number.
マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいて、前記マスタデータベースに対して処理を行うマスタサーバであって、
前記マスタデータベースに対して処理を行い、それによって得られた更新ログを記憶装置に格納させる、更新処理部と、
前記更新ログに時間情報を付加する、時間情報付加部と、
前記時間情報を付加した前記更新ログを、前記レプリカデータベースに対して処理を行うレプリカサーバに送信する、更新ログ送信処理部と、
を備えていることを特徴とするマスタサーバ。
In a replication system having a master database and a replica database, a master server that performs processing on the master database,
An update processing unit that performs processing on the master database and stores an update log obtained thereby in a storage device;
A time information adding unit for adding time information to the update log;
An update log transmission processing unit that transmits the update log to which the time information is added to a replica server that performs processing on the replica database;
A master server comprising:
前記時間情報付加部が、設定された時間間隔で、基準時からの経過時間を示す時間番号を含む制御ログを生成し、前記時間情報として前記制御ログを前記更新ログに付加する、請求項6に記載のマスタサーバ。   The time information adding unit generates a control log including a time number indicating an elapsed time from a reference time at a set time interval, and adds the control log as the time information to the update log. The master server described in マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいて、前記レプリカデータベースに対して処理を行うレプリカサーバであって、
前記マスタデータベースに対して処理を行う複数のマスタサーバから送信されてきた更新ログを受信する、更新ログ受信処理部と、
受信した前記複数のマスタサーバそれぞれの更新ログを、各更新ログに付加されている時間情報に基づいてマージし、それによって、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、更新ログマージ処理部と、
生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、更新ログ反映処理部と、
を備えていることを特徴とするレプリカサーバ。
In a replication system having a master database and a replica database, a replica server that performs processing on the replica database,
An update log reception processing unit that receives update logs transmitted from a plurality of master servers that perform processing on the master database;
The received update logs of the plurality of master servers are merged based on the time information added to each update log, thereby generating a file for reflecting the update in the master database to the replica database. An update log merge processing unit,
An update log reflection processing unit that replicates the replica database using the generated file;
A replica server characterized by comprising:
前記更新ログマージ処理部が、前記時間情報によって特定される時間が同一と見なされる更新ログが、前記複数のマスタサーバ全てから取得されているかどうかを判定し、
取得されていない場合は、取得できていなマスタサーバに更新ログの送信を通知し、
更に、前記取得てきていないマスタサーバから更新ログが送信されない場合は、別のマスタサーバに、前記取得てきていないマスタサーバの更新ログを取得させ、送信させる、請求項8に記載のレプリカサーバ。
The update log merge processing unit determines whether or not update logs that are considered to have the same time specified by the time information are acquired from all of the plurality of master servers,
If it has not been acquired, notify the master server that was not able to acquire the update log transmission,
Furthermore, when the update log is not transmitted from the master server that has not been acquired, the replica server according to claim 8, which causes another master server to acquire and transmit the update log of the master server that has not been acquired.
第1のデータベースシステムと、第2のデータベースシステムとを備え、
前記第1のデータベースシステムは、レプリケーション元となるマスタデータベースと、前記マスタデータベースに対して処理を行う複数のマスタサーバと、前記複数のマスタサーバそれぞれ毎に設けられた個別データベースとを備え、
前記第2のデータベースは、レプリケーション先となるレプリカデータベースと、前記レプリカデータベースに対して処理を行うレプリカサーバとを備えている、レプリケーションシステムを用いたレプリケーション方法であって、
(a)前記複数のマスタサーバそれぞれが前記マスタデータベースに対して処理を行った場合に得られる更新ログを、それぞれの前記個別データベースに格納する、ステップと、(b)前記更新ログに時間情報を付加する、ステップと、
(c)前記複数のマスタサーバそれぞれ毎に、前記時間情報が付加された更新ログを、前記レプリカサーバに送信する、ステップと、
(d)前記複数のマスタサーバそれぞれから前記レプリカサーバに送信されてきた前記更新ログを、各更新ログに付加された時間情報に基づいてマージする、ステップと、
(e)前記(d)のステップによるマージの結果から、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、ステップと、
(f)前記(e)のステップで生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ステップと、
を有することを特徴とするレプリケーション方法。
A first database system and a second database system;
The first database system includes a master database serving as a replication source, a plurality of master servers that perform processing on the master database, and individual databases provided for each of the plurality of master servers,
The second database is a replication method using a replication system, comprising a replica database as a replication destination and a replica server that performs processing on the replica database,
(A) storing an update log obtained when each of the plurality of master servers performs processing on the master database in the individual database; and (b) time information in the update log. Add, step,
(C) transmitting the update log to which the time information is added to each of the plurality of master servers to the replica server;
(D) merging the update log transmitted from each of the plurality of master servers to the replica server based on time information added to each update log;
(E) generating a file for reflecting the update in the master database in the replica database from the result of the merge in the step (d);
(F) replicating the replica database using the file generated in the step (e);
A replication method characterized by comprising:
(g)前記時間情報によって特定される時間が同一と見なされる更新ログが、前記複数のマスタサーバ全てから取得されているかどうかを判定する、ステップと、
(h)前記(g)のステップで取得されていないと判定された場合に、取得できていなマスタサーバに更新ログの送信を通知する、ステップと、
(i)前記(h)のステップの実行後に、前記取得てきていないマスタサーバから更新ログが送信されない場合に、別のマスタサーバに、前記取得てきていないマスタサーバの更
新ログを取得させ、送信させる、ステップと、
を更に有する請求項10に記載のレプリケーション方法。
(G) determining whether update logs that are considered to have the same time specified by the time information are acquired from all of the plurality of master servers;
(H) If it is determined that the update is not acquired in the step (g), the master server that has not been acquired is notified of transmission of the update log; and
(I) After the execution of the step (h), when an update log is not transmitted from the master server that has not been acquired, another master server acquires the update log of the master server that has not been acquired and transmits Let the steps and
The replication method according to claim 10, further comprising:
前記(b)のステップで、設定された時間間隔で、基準時からの経過時間を示す時間番号を含む制御ログを生成し、前記時間情報として前記制御ログを前記更新ログに付加する、請求項10または11に記載のレプリケーション方法。   The step (b) generates a control log including a time number indicating an elapsed time from a reference time at a set time interval, and adds the control log as the time information to the update log. The replication method according to 10 or 11. 前記(d)のステップで、前記複数のマスタサーバそれぞれ毎に、前記制御ログを検出し、検出した前記制御ログの時間番号より時間番号が1つ小さい制御ログの後の更新ログから、検出した制御ログの手前のログまでを組データとして取り出し、前記制御ログの前記時間番号が同一となる組データをマージする、請求項12に記載のレプリケーション方法。   In the step (d), the control log is detected for each of the plurality of master servers, and is detected from the update log after the control log whose time number is one smaller than the detected time number of the control log. 13. The replication method according to claim 12, wherein the data up to the log before the control log is taken out as set data, and the set data having the same time number in the control log is merged. (j)前記(c)のステップの実行前に、前記処理の終了の際に前記マスタデータベースに対してCOMMIT命令を発行し、発行した順に、各COMMIT命令に番号を付加して、COMMITログを生成し、これを前記更新ログに付加するステップを更に有し、
前記(d)のステップで、マージ対象となる各組データについて、前記組データに含まれる前記COMMIT命令の番号を抽出し、抽出した番号に基づいてマージを行う、請求項13に記載のレプリケーション方法。
(J) Before executing the step (c), a COMMIT command is issued to the master database at the end of the process, and a number is added to each COMMIT command in the order of issue, and a COMMIT log is created. Generating and appending it to the update log;
14. The replication method according to claim 13, wherein, in the step (d), for each set data to be merged, a number of the COMMIT instruction included in the set data is extracted and merging is performed based on the extracted number. .
マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおける前記マスタデータベースに対する処理を、コンピュータに実行させるためのプログラムであって、
前記コンピュータに、
(a)前記マスタデータベースに対して処理を行った場合に得られる更新ログを取得する、ステップと、
(b)前記更新ログに時間情報を付加する、ステップと、
(c)前記時間情報を付加した前記更新ログを、前記レプリカデータベースに対して処理を行うレプリカサーバに送信する、ステップと、
を実行させることを特徴とするプログラム。
A program for causing a computer to execute processing for the master database in a replication system having a master database and a replica database,
In the computer,
(A) obtaining an update log obtained when processing is performed on the master database;
(B) adding time information to the update log; and
(C) transmitting the update log to which the time information is added to a replica server that processes the replica database; and
A program characterized by having executed.
前記(b)のステップにおいて、設定された時間間隔で、基準時からの経過時間を示す時間番号を含む制御ログを生成し、前記時間情報として前記制御ログを前記更新ログに付加する、請求項15に記載のプログラム。   The step (b) generates a control log including a time number indicating an elapsed time from a reference time at a set time interval, and adds the control log as the time information to the update log. 15. The program according to 15. マスタデータベースとレプリカデータベースとを有するレプリケーションシステムにおいける前記レプリカデータベースに対する処理を、コンピュータに実行させるためのプログラムであって、
前記コンピュータに、
(a)前記マスタデータベースに対して処理を行う複数のマスタサーバから送信されてきた更新ログを受信する、ステップと、
(b)受信した前記複数のマスタサーバそれぞれの更新ログを、各更新ログに付加されている時間情報に基づいてマージするステップと、
(c)前記(b)のステップによるマージの結果から、前記マスタデータベースでの更新を前記レプリカデータベースに反映させるためのファイルを生成する、ステップと、
(d)前記(c)のステップで生成した前記ファイルを用いて前記レプリカデータベースをレプリケーションする、ステップと、
を実行させることを特徴とするプログラム。
A program for causing a computer to execute processing for the replica database in a replication system having a master database and a replica database,
In the computer,
(A) receiving an update log transmitted from a plurality of master servers that perform processing on the master database;
(B) merging the received update logs of the plurality of master servers based on time information added to the update logs;
(C) generating a file for reflecting the update in the master database to the replica database from the result of the merge in the step (b);
(D) replicating the replica database using the file generated in the step (c);
A program characterized by having executed.
(e)前記時間情報によって特定される時間が同一と見なされる更新ログが、前記複数の
マスタサーバ全てから取得されているかどうかを判定する、ステップと、
(f)前記(e)のステップで取得されていないと判定された場合に、取得できていなマスタサーバに更新ログの送信を通知する、ステップと、
(g)前記(f)のステップの実行後に、前記取得てきていないマスタサーバから更新ログが送信されない場合に、別のマスタサーバに、前記取得てきていないマスタサーバの更新ログを取得させ、送信させる、ステップと、
を更に前記コンピュータに実行させる、請求項17に記載のプログラム。
(E) determining whether update logs that are considered to have the same time specified by the time information are acquired from all of the plurality of master servers;
(F) If it is determined that it has not been acquired in step (e), the master server that has not been acquired is notified of transmission of an update log; and
(G) After the execution of the step (f), when an update log is not transmitted from the master server that has not been acquired, another master server acquires the update log of the master server that has not been acquired and transmits Let the steps and
The program according to claim 17, further causing the computer to execute.
JP2009089084A 2009-04-01 2009-04-01 Replication system, master server, replica server, replication method, and program Expired - Fee Related JP5494915B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009089084A JP5494915B2 (en) 2009-04-01 2009-04-01 Replication system, master server, replica server, replication method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009089084A JP5494915B2 (en) 2009-04-01 2009-04-01 Replication system, master server, replica server, replication method, and program

Publications (2)

Publication Number Publication Date
JP2010244117A true JP2010244117A (en) 2010-10-28
JP5494915B2 JP5494915B2 (en) 2014-05-21

Family

ID=43097099

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009089084A Expired - Fee Related JP5494915B2 (en) 2009-04-01 2009-04-01 Replication system, master server, replica server, replication method, and program

Country Status (1)

Country Link
JP (1) JP5494915B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012190207A (en) * 2011-03-10 2012-10-04 Nec Corp Database replication method
JP2015513333A (en) * 2012-04-04 2015-05-07 エヌイーシー ラボラトリーズ アメリカ インクNEC Laboratories America, Inc. Database workload balancing through migration
CN112783903A (en) * 2019-11-07 2021-05-11 北京沃东天骏信息技术有限公司 Method and device for generating update log
JP2021135828A (en) * 2020-02-27 2021-09-13 富士通株式会社 Request processing system and request processing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH076099A (en) * 1992-12-17 1995-01-10 Internatl Business Mach Corp <Ibm> System and method for duplexing of remote data
JP2001154897A (en) * 1999-11-25 2001-06-08 Nec Corp Data base system and data base updating method
JP2002032254A (en) * 2000-07-19 2002-01-31 Mitsubishi Electric Corp Information compatibility management system
JP2008181288A (en) * 2007-01-24 2008-08-07 Hitachi Ltd Remote copy system
JP2008276553A (en) * 2007-04-27 2008-11-13 Mitsubishi Electric Corp Database equivalence system and database equivalence method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH076099A (en) * 1992-12-17 1995-01-10 Internatl Business Mach Corp <Ibm> System and method for duplexing of remote data
JP2001154897A (en) * 1999-11-25 2001-06-08 Nec Corp Data base system and data base updating method
JP2002032254A (en) * 2000-07-19 2002-01-31 Mitsubishi Electric Corp Information compatibility management system
JP2008181288A (en) * 2007-01-24 2008-08-07 Hitachi Ltd Remote copy system
JP2008276553A (en) * 2007-04-27 2008-11-13 Mitsubishi Electric Corp Database equivalence system and database equivalence method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012190207A (en) * 2011-03-10 2012-10-04 Nec Corp Database replication method
JP2015513333A (en) * 2012-04-04 2015-05-07 エヌイーシー ラボラトリーズ アメリカ インクNEC Laboratories America, Inc. Database workload balancing through migration
CN112783903A (en) * 2019-11-07 2021-05-11 北京沃东天骏信息技术有限公司 Method and device for generating update log
CN112783903B (en) * 2019-11-07 2024-04-05 北京沃东天骏信息技术有限公司 Method and device for generating update log
JP2021135828A (en) * 2020-02-27 2021-09-13 富士通株式会社 Request processing system and request processing method

Also Published As

Publication number Publication date
JP5494915B2 (en) 2014-05-21

Similar Documents

Publication Publication Date Title
Du et al. Orbe: Scalable causal consistency using dependency matrices and physical clocks
CN106991113B (en) Table replication in a database environment
KR100926880B1 (en) Data replication method and system in DVMS
Ananthanarayanan et al. Photon: Fault-tolerant and scalable joining of continuous data streams
US9514208B2 (en) Method and system of stateless data replication in a distributed database system
Das et al. G-store: a scalable data store for transactional multi key access in the cloud
US9613104B2 (en) System and method for building a point-in-time snapshot of an eventually-consistent data store
JP4461147B2 (en) Cluster database using remote data mirroring
JP4283576B2 (en) Transaction synchronization method, database system, and database apparatus
US8856091B2 (en) Method and apparatus for sequencing transactions globally in distributed database cluster
US20090210429A1 (en) System and method for asynchronous update of indexes in a distributed database
JP5686034B2 (en) Cluster system, synchronization control method, server device, and synchronization control program
US9798639B2 (en) Failover system and method replicating client message to backup server from primary server
JP5308403B2 (en) Data processing failure recovery method, system and program
US11567899B2 (en) Managing dependent delete operations among data stores
Zhao et al. Sdpaxos: Building efficient semi-decentralized geo-replicated state machines
Nawab et al. Chariots: A scalable shared log for data management in multi-datacenter cloud environments.
JP5494915B2 (en) Replication system, master server, replica server, replication method, and program
US11995099B2 (en) System and method for switching from consistent database to an eventual consistent database replica in real time while preventing reads of past versions of the data
US20220197761A1 (en) Cloud architecture for replicated data services
JP2011210106A (en) Message queue management system, lock server, message queue management method, and message queue management program
US9355117B1 (en) Techniques for backing up replicated data
Kim et al. A distributed and cooperative NameNode cluster for a highly-available Hadoop distributed file system
Suganuma et al. Distributed and fault-tolerant execution framework for transaction processing
US20210141806A1 (en) Maintain Constant Load on Global Database After Regionalization

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120305

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130729

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130807

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131002

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140205

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140218

R150 Certificate of patent or registration of utility model

Ref document number: 5494915

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees