JP3612449B2 - Master-slave relationship information synchronization method in distributed database system - Google Patents
Master-slave relationship information synchronization method in distributed database system Download PDFInfo
- Publication number
- JP3612449B2 JP3612449B2 JP21147699A JP21147699A JP3612449B2 JP 3612449 B2 JP3612449 B2 JP 3612449B2 JP 21147699 A JP21147699 A JP 21147699A JP 21147699 A JP21147699 A JP 21147699A JP 3612449 B2 JP3612449 B2 JP 3612449B2
- Authority
- JP
- Japan
- Prior art keywords
- master
- slave
- update
- rdbms
- copy
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は分散データベースシステムにおける主従関係情報同期方式に関し、特に主表(参照表または親表ともいう)と従表(主表の一部のデータ項目を参照することによって関係付けられた表であり、依存表または子表ともいう)との主従関係をもつ複数のサーバからなる分散データベースシステムにおける主従関係情報同期方式に関する。ここで、表の主従関係とは、従表が主表の主キー(表内で一意となるデータ項目をいう)に対して外部キー(主キーを参照する参照整合性制約の定義に含まれている列または列の集合をいう)を作成することにより、主表のレコードと従表のレコードとの間に付けられた関係をいう。
【0002】
【従来の技術】
従来の分散データベースシステムは、たとえば、主表(以下、マスタ主表という)および従表(以下、マスタ従表という)が定義され、マスタ主表とマスタ従表との間に主従関係が定義されたリレーショナルデータベース(以下、マスタリレーショナルデータベースという)ならびにこのマスタリレーショナルデータベースを管理するRDBMS(以下、マスタRDBMSという)を有するサーバ(以下、マスタサーバという)と、主表(以下、コピー主表という)および従表(以下、コピー従表という)が定義されたリレーショナルデータベース(以下、スレーブリレーショナルデータベースという)ならびにこのスレーブリレーショナルデータベースを管理するRDBMS(以下、スレーブRDBMSという)を有するサーバ(以下、スレーブサーバという)とが、LAN(Local Area Network)等の回線を介して接続されて構成されていた。
【0003】
このような従来の分散データベースシステムでは、スレーブサーバにおいて、コピー主表とコピー従表との主従関係の定義が行えない(コピー主表に主キーの定義が行えない)ために、データのレコード内に主従関係の情報を持つなどしてアプリケーションプログラム側でデータの整合性を保証しなければならなかった。すなわち、主従関係をレコード内に情報として持っていたので、アプリケーションプログラム側でデータの整合性を保つための処理をしなければならず、マスタサーバとスレーブサーバとで環境の違いを意識した異なる更新処理を作成しなければならなかった。
【0004】
【発明が解決しようとする課題】
第1の問題点は、更新されたデータについて主従関係を保ちつつ効率的な同期をとることが難しいということである。その理由は、アプリケーションプログラム側で主表および従表の内容の同期をとる処理とは別に主従関係を関係付ける処理が必要であったからである。
【0005】
第2の問題点は、主表に対する従表を新規に追加する場合に、従表の定義を行う(マスタサーバ,スレーブサーバ)とともにデータの更新,アプリケーションプログラム側での整合性の保証の実装(サーバのみ)が必要であるということである。その理由は、アプリケーションプログラム側でデータの整合性を保つための処理をしなければならなかったからである。
【0006】
ところで、リレーショナルデータベースの表は、共通の列で関連付けることができるため、列の関連を管理する規則を守らなければならないが、これらの関連が保たれることを保証する機能として、リレーショナルデータベースマネージメントシステム(以下、RDBMSと略記する)の参照整合性制約がある。この参照整合性制約を利用することにより、スレーブサーバにおいてダミーの主表(以下、ダミー主表という)の定義を行い、ダミー主表とコピー従表との間で主従関係の定義を行うことにより、データの整合性を保証することが考えられる。
【0007】
しかし、スレーブサーバにおいてダミー主表の定義を行い、ダミー主表とコピー従表との間で主従関係の定義を行うことにより、データの整合性を参照整合性制約で保証するようにする場合、さらにマスタ主表とダミー主表とのデータの整合性をどのように図るのかを考慮しなければならない。
【0008】
本発明の目的は、主表と従表との主従関係をもつ複数のサーバからなる分散データベースシステムにおいて、参照整合性制約を利用することにより、更新されたデータについて主従関係を保ちつつ効率的な同期をとることができるようにした分散データベースシステムにおける主従関係情報同期方式を提供することにある。
【0009】
なお、先行技術文献として、たとえば特開平5−135113号公報があるが、この公報に開示された重複データ管理システムでは、クライアントに導出先管理表および導出元管理表を設け、利用者からのデータベース操作言語要求に応答して、管理表制御手段が導出先管理表および導出元管理表を検索し、アクセス対象のデータが重複データとして管理されているか否かを調べて、重複データの管理制御を行っていた。したがって、この重複データ管理システムは、マスタリレーショナルデータベースとスレーブリレーショナルデータベースとで同一データを重複して保持することを前提とする本願発明とは、その目的,構成および効果が全く異なるものである。
【0010】
【課題を解決するための手段】
本発明の分散データベースシステムにおける主従関係情報同期方式は、マスタ主表およびマスタ従表が定義され前記マスタ主表と前記マスタ従表との間に主従関係が定義されたマスタリレーショナルデータベースならびに該マスタリレーショナルデータベースを管理するマスタRDBMSを有するマスタサーバと、コピー主表およびコピー従表が定義されたスレーブリレーショナルデータベースならびに該スレーブリレーショナルデータベースを管理するスレーブRDBMSを有するスレーブサーバとが、回線を介して接続されてなる分散データベースシステムにおいて、ダミー主表がさらに定義されるとともに該ダミー主表と前記コピー従表との間に主従関係が定義された前記スレーブリレーショナルデータベースと、前記マスタサーバに設けられ、前記マスタRDBMSにより前記マスタリレーショナルデータベースの前記マスタ主表が更新されたときに更新ログ情報が蓄積される更新ログファイルと、前記マスタサーバに設けられ、前記更新ログファイルが更新されたか否かを定期的に監視するログ監視手段と、前記ログ監視手段により前記更新ログファイルの更新が検出された場合に前記更新ログファイルの最新の更新ログ情報をもとに前記スレーブリレーショナルデータベース内の前記ダミー主表に対して更新内容の反映を行う更新反映処理手段とを有することを特徴とする。
【0011】
一方、本発明の機械読み取り可能な記録媒体は、コンピュータを、マスタ主表およびマスタ従表が定義され前記マスタ主表と前記マスタ従表との間に主従関係が定義されたマスタリレーショナルデータベース,該マスタリレーショナルデータベースを管理するマスタRDBMS,前記マスタRDBMSにより前記マスタリレーショナルデータベースの前記マスタ主表が更新されたときに更新ログ情報が蓄積される更新ログファイル,前記更新ログファイルが更新されたか否かを定期的に監視するログ監視手段,および前記ログ監視手段により前記更新ログファイルの更新が検出された場合に前記更新ログファイルの最新の更新ログ情報をもとにスレーブリレーショナルデータベース内のダミー主表に対して更新内容の反映を行う更新反映処理手段として機能させるためのプログラムを記録する。
【0012】
以下、本発明の実施の形態について図面を参照して詳細に説明する。
【0013】
図1は、本発明の第1の実施の形態に係る主従関係情報同期方式が適用された分散データベースシステムの構成を示すブロック図である。この分散データベースシステムは、マスタのサーバマシンであるマスタサーバ1と、スレーブのサーバマシンであるスレーブサーバ7と、クライアントマシンであるクライアント10とが、LANを介して接続されて構成されている。
【0014】
マスタサーバ1は、マスタRDBMS2と、マスタリレーショナルデータベース3と、更新ログファイル4と、ログ監視手段5と、更新反映処理手段6とを含んで構成されている。
【0015】
マスタリレーショナルデータベース3は、データを格納したマスタ主表31およびマスタ従表32を備える。マスタ主表31とマスタ従表32との間には、表の主従関係が定義されている。
【0016】
ここで、マスタ主表31とマスタ従表32とが別々の表となっているのは、表の正規化を行っているためである。正規化とは、データの冗長性を排除して、データの一貫性および整合性をもった理解しやすいデータの構造にする手法である。正規化を行うと、主キーの部分だけは重複するが、その他のデータ項目については重複を省くことが可能となり、データ更新時の処理が簡単になる。なお、主キーおよび外部キーは、ともに表の正規化を行った際に表の列自体に設定を行うものである。
【0017】
マスタRDBMS2は、マスタ主表31およびマスタ従表32への更新処理が要求された場合に、更新処理(SQL)が正しいかどうかの妥当性チェックや表の参照整合性制約に違反していないかどうかなどのチェックを行ったり、スレーブRDBMS8に対して更新されたことを通知したりするリレーショナルデータベース管理システムである。また、マスタRDBMS2は、スレーブRDBMS8からコピー主表91およびコピー従表92に対し更新処理が行われたことが通知された場合、マスタ主表31およびマスタ従表32に対して同等の更新処理を行う。
【0018】
更新ログファイル4は、マスタリレーショナルデータベース3においてマスタ主表31が更新された場合に、更新ログ情報を蓄積するファイルである。更新ログファイル4には、マスタ主表31の更新内容が更新ログ情報として格納される。
【0019】
ログ監視手段5は、マスタリレーショナルデータベース3内のマスタ主表31が更新された際にマスタRDBMS2から出力される更新ログ情報により更新ログファイル4が更新されているか否かを定期的に監視し、更新されたことを検知した場合は、更新反映処理手段6の呼び出しを行うアプリケーションプログラム手段である。
【0020】
更新反映処理手段6は、ログ監視手段5から呼び出されたときに、更新ログファイル4の最新の更新ログ情報をもとにスレーブサーバ7のスレーブリレーショナルデータベース9内のダミー主表93に対し更新内容の反映を行うアプリケーションプログラム手段である。
【0021】
スレーブサーバ7は、スレーブRDBMS8と、スレーブリレーショナルデータベース9とを備える。
【0022】
スレーブリレーショナルデータベース9は、マスタ主表31のコピーであるコピー主表91と、マスタ従表32のコピーであるコピー従表92と、マスタ主表31と同じ内容のデータを持つダミー主表93とをもつ。
【0023】
ダミー主表93は、コピー主表91とは異なる名称で定義された表である。
【0024】
コピー主表91およびコピー従表92は、マスタRDBMS2内のマスタリレーショナルデータベース3に定義されたマスタ主表31およびマスタ従表32とまったく同じデータをもち、更新時には、マスタRDBMS2およびスレーブRDBMS8の参照整合性制約により同期的に更新される。
【0025】
しかし、コピー主表91とコピー従表92との間には、主従関係は定義されていない。マスタ主表31およびマスタ従表32と内容が一致しているにもかかわらず、コピー主表91とコピー従表92との間に主従関係が定義されていないのは、分散データベースシステムにおいては、コピー主表91に対して主キーの設定を行うことができないため、コピー主表91とコピー従表92との主従関係を定義することができないからである。
【0026】
このため、本実施の形態では、ダミー主表93とコピー従表92との間に主従関係が定義されている。すなわち、スレーブリレーショナルデータベース9内にあるコピー主表91とコピー従表92との主従関係を定義するために、コピー主表91と同じ内容のデータを持つ表を別名のダミー主表93として定義してコピー従表92との間で主従関係を定義する。このように、ダミー主表93の作成を行い、コピー従表92との間に主従関係を定義するのは、この主従関係を、以下に示す3点を実現するために利用するためである。
【0027】
1) データの整合性を保つ手段としてマスタRDBMS2およびスレーブRDBMS8の参照整合性制約を利用するため。
【0028】
2) マスタリレーショナルデータベース3およびスレーブリレーショナルデータベース9内のマスタ主表31およびマスタ従表32ならびにコピー主表91およびコピー従表92に対するデータの更新処理において、マスタサーバ1,スレーブサーバ7といった環境の違いを意識しないようにするため。
【0029】
3) 1),2)と同じことではあるが、マスタ主表31およびコピー主表91に対するマスタ従表32およびコピー従表92を新規に追加する場合にも従表の定義のみとし、データの整合性を保つのはマスタRDBMS2およびスレーブRDBMS8の参照整合性制約を利用し、データ更新処理の環境の違いを意識しないようにするため。
【0030】
スレーブRDBMS8は、コピー主表91およびコピー従表92への更新処理が要求された場合に、更新処理(SQL)が正しいかどうかの妥当性チェックや表の参照整合性制約に違反していないかどうかなどのチェックを行ったり、マスタRDBMS2に対し更新されたことを通知したりするリレーショナルデータベース管理システムである。また、スレーブRDBMS8は、マスタRDBMS2からマスタ主表31およびマスタ従表32に対し更新処理が行われたことを通知された場合、コピー主表91およびコピー従表92に対して同等の更新処理を行う。
【0031】
クライアントマシン10は、更新処理手段11を有する。
【0032】
更新処理手段11は、LAN経由でマスタサーバ1のマスタリレーショナルデータベース3内のマスタ主表31およびマスタ従表32の更新処理、あるいはスレーブサーバ7のスレーブリレーショナルデータベース9内のコピー主表91およびコピー従表92に対して更新処理を行うアプリケーションプログラム手段である。ここでの更新処理とは、表に対するデータの挿入(Insert),表内のデータの更新(Update),および表内のデータの削除(Delete)を表す。
【0033】
図2を参照すると、第1の実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の処理は、更新ログ情報出力ステップA1と、更新ログファイル更新判定ステップA2と、更新反映処理手段呼び出しステップA3と、ダミー主表更新ステップA4とからなる。
【0034】
図3は、マスタリレーショナルデータベース3,スレーブリレーショナルデータベース9および更新ログファイル4の内容を例示する図である。
【0035】
次に、第1の実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の動作について、図1ないし図3を用いて説明する。
【0036】
図3に示すように、例えば、マスタ主表31およびマスタ従表32に「コード0002」のデータが追加された場合、マスタRDBMS2によりマスタ主表31の更新ログ情報が更新ログファイル4に書き出される(ステップA1)。
【0037】
ログ監視手段5は、更新ログファイル4が更新されているか否かの監視を定期的に行っており、更新ログファイル4が更新されていることを検出すると(ステップA2)、更新反映処理手段6の呼び出しを行う(ステップA3)。
【0038】
更新反映処理手段6は、更新ログファイル4の最新の更新ログ情報を元に「コード0002」のデータをダミー主表93に追加する(ステップA4)。
【0039】
続いて、第1の実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の動作について、図4ないし図7を参照しながらより詳細に説明する。
【0040】
(1) クライアント10からマスタサーバ1のマスタ主表31の更新処理を行った場合(図4参照)
【0041】
丸付き数字1 更新処理手段11からマスタ主表31へのデータの更新処理(SQL;たとえばinsert)をマスタRDBMS2に対し要求する。
【0042】
丸付き数字1' マスタRDBMS2は、更新処理(SQL)の妥当性チェックを行い、要求された更新処理(SQL)に誤りがあった場合、更新処理手段11にエラーを返却する。
【0043】
丸付き数字2 マスタRDBMS2は、更新処理(SQL)の妥当性チェックを行い、要求された更新処理(SQL)が正常であれば、マスタ主表31に対しデータを登録する。
【0044】
丸付き数字3 マスタRDBMS2は、丸付き数字2で更新された内容を更新ログ情報として更新ログファイル4に書き出す(ステップA1)。
【0045】
丸付き数字4 マスタRDBMS2は、更新された内容をスレーブRDBMS8に通知する。
【0046】
丸付き数字5 スレーブRDBMS8は、コピー主表91に対し更新処理(insert)を実行する。
【0047】
丸付き数字6 ログ監視手段5は、定期的に監視を行っていた更新ログファイル4が更新されたことを検知する(ステップA2)。
【0048】
丸付き数字7 ログ監視手段5は、更新反映処理手段6を呼び出す(ステップA3)。
【0049】
丸付き数字8 更新反映処理手段6は、更新ログファイル4から最新の更新ログ情報を取得する。
【0050】
丸付き数字9 更新反映処理手段6は、取得した最新の更新ログ情報を用いてダミー主表93に対し更新処理を行う(ステップA4)。
【0051】
(2) クライアント10からスレーブサーバ7のコピー主表91の更新処理を行った場合(図5参照)
【0052】
丸付き数字1 更新処理手段11は、コピー主表91へのデータの更新処理(SQL;たとえばinsert)をスレーブRDBMS8に対し要求する。
【0053】
丸付き数字1' スレーブRDBMS8は、更新処理(SQL)の妥当性チェックを行い、要求された更新処理(SQL)に誤りがあった場合、更新処理手段11にエラーを返却する。
【0054】
丸付き数字2 スレーブRDBMS8は、更新処理(SQL)の妥当性チェックを行い、要求された更新処理(SQL)が正常であれば、コピー主表91に対しデータを登録する。
【0055】
丸付き数字3 スレーブRDBMS8は、マスタRDBMS2に更新された内容を通知する。
【0056】
丸付き数字4 マスタRDBMS2は、マスタ主表31に対し更新処理(insert)を実行する。
【0057】
丸付き数字5 マスタRDBMS2は、丸付き数字2で更新された内容を更新ログ情報として更新ログファイル4に書き出す(ステップA1)。
【0058】
丸付き数字6 ログ監視手段5は、定期的に監視を行っていた更新ログファイル4が更新されたことを検知する(ステップA2)。
【0059】
丸付き数字7 ログ監視手段5は、更新反映処理手段6を呼び出す(ステップA3)。
【0060】
丸付き数字8 更新反映処理手段6は、更新ログファイル4から最新の更新ログ情報を取得する。
【0061】
丸付き数字9 更新反映処理手段6は、取得した最新の更新ログ情報を用いてダミー主表93に対し更新処理を行う(ステップA4)。
【0062】
(3) クライアント10からマスタサーバ1のマスタ従表32に更新処理を行った場合(図6参照)
【0063】
丸付き数字1 更新処理手段11は、マスタ従表32へのデータの更新処理(SQL;たとえばinsert)をマスタRDBMS2に対し要求する。
【0064】
丸付き数字1' マスタRDBMS2は、要求された更新処理(SQL)の妥当性チェックおよび参照整合性制約のチェックを行い、更新処理(SQL)に誤りがあった場合や参照整合性制約に違反していた場合、更新処理手段11にエラーを返却する。
【0065】
丸付き数字2 マスタRDBMS2は、要求された更新処理(SQL)の妥当性チェックおよび参照整合性制約のチェックを行い、正常であればマスタ従表32に対しデータを登録する。
【0066】
丸付き数字3 マスタRDBMS2は、スレーブRDBMS8に更新された内容を通知する。
【0067】
丸付き数字4 スレーブRDBMS8は、コピー従表92に対し更新処理(insert)を実行する。
【0068】
(4) クライアント10からスレーブサーバ7のコピー従表92に更新処理を行った場合(図7参照)
【0069】
丸付き数字1 更新処理手段11は、コピー従表92へのデータの更新処理(insert)をスレーブRDBMS8に対し要求する。
【0070】
丸付き数字1' スレーブRDBMS8は、要求された更新処理(SQL)の妥当性チェックおよび参照整合性制約のチェックを行い、更新処理(SQL)に誤りがあった場合および参照整合性制約に違反していた場合、更新処理手段11にエラーを返却する。
【0071】
丸付き数字2 スレーブRDBMS8は、要求された更新処理(SQL)の妥当性チェックおよび参照整合性制約のチェックを行い、正常であればコピー従表92に対しデータを登録する。
【0072】
丸付き数字3 スレーブRDBMS8は、マスタRDBMS2に更新された内容を通知する。
【0073】
丸付き数字4 マスタRDBMS2は、マスタ従表32に対し更新処理(insert)を実行する。
【0074】
なお、本実施の形態では、マスタサーバ1およびスレーブサーバ7の2台のサーバを用いる場合を例にとって説明したが、スレーブサーバ7の数は複数台であってもよい。
【0075】
また、スレーブサーバ7側にも更新ログファイル4,ログ監視手段5および更新反映処理手段6を設けるようにすれば、マスタサーバ1とスレーブサーバ7との役割を相互に交換可能とすることができる。
【0076】
次に、本発明の第2の実施の形態について説明する。
【0077】
図8は、本発明の第2の実施の形態に係る主従関係情報同期方式が適用された分散データベースシステムの構成を示すブロック図である。
【0078】
図8を参照すると、本発明の第2の実施の形態は、マスタサーバ1にマスタサーバ側プログラムを記録する記録媒体100を備える構成となっている。この記録媒体100は、磁気ディスク,半導体メモリ,その他の記録媒体であってよい。
【0079】
マスタサーバ側プログラムは、記録媒体100からマスタサーバ1に読み込まれ、マスタRDBMS2,更新ログファイル4,ログ監視手段5,および更新反映処理手段6として動作する。したがって、マスタサーバ1の動作は、図1ないし図7で説明した第1の実施の形態に係る主従関係情報同期方式が適用された分散データベースシステムにおけるマスタサーバ1の動作と全く同様になるので、その詳しい説明を割愛する。
【0080】
【発明の効果】
本発明の効果は、マスタサーバのマスタ主表の更新処理を行うだけで、分散されたスレーブサーバにも内容および表の主従関係を保ちつつ更新処理を行うことができ、この結果、サーバ毎に同様の内容のデータを更新する処理が不要となることである。その理由は、ログ監視手段によりマスタ主表の更新ログ情報の監視を行い、更新が行われた場合のみ分散されたスレーブサーバのダミー主表に対して更新内容の反映を行うようにしたためである。
【0081】
また、主表に対する従表を新規に追加する場合には、従来は、従表の定義を行う(マスタサーバ,スレーブサーバ)とともにデータの更新,アプリケーションプログラム側での整合性の保証の実装(サーバのみ)が必要であったが、本願発明では、従表の定義(マスタサーバ,スレーブサーバ)とダミー主表に対する外部キーの設定(主従関係を結ぶ)とを行うだけでよいため、従表の追加が容易に行えるという利点がある。
【図面の簡単な説明】
【図1】本発明の第1の実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の構成を示すブロック図である。
【図2】本実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の動作を示すフローチャートである。
【図3】図1中のマスタリレーショナルデータベース,スレーブリレーショナルデータベースおよび更新ログファイルの内容を例示する図である。
【図4】図1中のクライアントからマスタサーバのマスタ主表に更新処理を行った場合の動作説明図である。
【図5】図1中のクライアントからスレーブサーバのコピー主表に更新処理を行った場合の動作説明図である。
【図6】図1中のクライアントからマスタサーバのマスタ従表に更新処理を行った場合の動作説明図である。
【図7】図1中のクライアントからスレーブサーバのコピー従表に更新処理を行った場合の動作説明図である。
【図8】本発明の第2の実施の形態に係る分散データベースシステムにおける主従関係情報同期方式の構成を示すブロック図である。
【符号の説明】
1 マスタサーバ
2 マスタRDBMS
3 マスタリレーショナルデータベース
4 更新ログファイル
5 ログ監視手段
6 更新反映処理手段
7 スレーブサーバ
8 スレーブRDBMS
9 マスタリレーショナルデータベース
31 マスタ主表
32 マスタ従表
91 コピー主表
92 コピー従表
93 ダミー主表
100 記録媒体[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a master-slave relationship information synchronization method in a distributed database system, and is particularly a table related by referring to a master table (also referred to as a reference table or a parent table) and a slave table (part of data items of the master table). The present invention relates to a master-slave relationship information synchronization method in a distributed database system comprising a plurality of servers having a master-slave relationship with a dependent table or a child table. Here, the master-detail relationship of the table is included in the definition of the referential integrity constraint that references the primary key to the primary key of the primary table (which means a data item that is unique within the table). The relationship between the primary table record and the secondary table record.
[0002]
[Prior art]
In a conventional distributed database system, for example, a master table (hereinafter referred to as a master slave table) and a slave table (hereinafter referred to as a master slave table ) are defined, and a master- slave relationship is defined between the master master table and the master slave table. A relational database (hereinafter referred to as a master relational database) and a server (hereinafter referred to as a master server) having an RDBMS (hereinafter referred to as a master RDBMS) for managing the master relational database , a main table (hereinafter referred to as a copy main table), and subservient (hereinafter, referred to as copy subservient) relational database is defined (hereinafter, slave referred relational database) as well as the RDBMS (hereinafter, referred to as slave RDBMS) that manages the slave relational database server having a (hereinafter, scan Busaba that), but it had been configured by connecting through a line such as a LAN (Local Area Network).
[0003]
In such a conventional distributed database system, the master-slave relationship between the copy master table and the copy slave table cannot be defined in the slave server (the primary key cannot be defined in the copy master table ). The application program had to guarantee data consistency by having master-slave information. In other words, since the master-slave relationship is stored as information in the record, the application program must perform processing to maintain data consistency, and the master server and slave server are aware of differences in the environment. Had to create a treatment.
[0004]
[Problems to be solved by the invention]
The first problem is that it is difficult to efficiently synchronize the updated data while maintaining the master-slave relationship. The reason is that a process for relating the master-slave relationship is required separately from the process of synchronizing the contents of the master table and the slave table on the application program side.
[0005]
The second problem is that when a sub table is newly added to the main table, the sub table is defined (master server, slave server), data is updated, and consistency is guaranteed on the application program side ( Server only). This is because the application program side had to perform processing for maintaining data consistency.
[0006]
By the way, relational database tables can be related by common columns, so the rules for managing column relationships must be observed. As a function to ensure that these relationships are maintained, the relational database management system There is a referential integrity constraint (hereinafter abbreviated as RDBMS). By using this referential integrity constraint, a slave master server defines a dummy master table (hereinafter referred to as a dummy master table) , and a master-slave relationship is defined between the dummy master table and the copy slave table. It is conceivable to guarantee data integrity.
[0007]
However, if you define the dummy master table on the slave server and define the master-slave relationship between the dummy master table and the copy slave table , to ensure data consistency with referential integrity constraints, Furthermore, it is necessary to consider how data consistency between the master main table and the dummy main table is to be achieved.
[0008]
An object of the present invention is to efficiently maintain a master-slave relationship for updated data by using a referential integrity constraint in a distributed database system including a plurality of servers having a master-slave relationship between a master table and a slave table. It is an object of the present invention to provide a master-slave relationship information synchronization method in a distributed database system that can be synchronized.
[0009]
As a prior art document, there is, for example, Japanese Patent Laid-Open No. 5-135113. In the duplicate data management system disclosed in this publication, a derivation destination management table and a derivation source management table are provided in the client, and a database from the user is provided. In response to the operation language request, the management table control means searches the derivation destination management table and the derivation source management table, checks whether the data to be accessed is managed as duplicate data, and controls the management of duplicate data. I was going. Therefore, this duplicate data management system is completely different in the object, configuration and effect from the present invention which presupposes that the same data is retained redundantly in the master relational database and the slave relational database .
[0010]
[Means for Solving the Problems]
Slave relationship information synchronization method in a distributed database system of the present invention, the master relational database and the master relational master-slave relationship between the master main table and the master subservient defines the master main table and said master subservient is defined A master server having a master RDBMS that manages a database , a slave relational database in which a copy master table and a copy slave table are defined, and a slave server having a slave RDBMS that manages the slave relational database are connected via a line. in becomes distributed database system, and the slave relational database master-slave relationship is defined between the copy subservient and the dummy main table with the dummy main table is further defined, to the master server Vignetting, the update log files the update log information when the master main table is updated in the master relational database by the master RDBMS is stored, provided in the master server, whether the update log file is updated not and log monitor for periodically monitoring whether said in the log the slave relational database based on the latest update log information of the update log file if the update of the update log file is detected by the monitoring means Update update processing means for reflecting update contents to the dummy main table is provided.
[0011]
On the other hand, the machine-readable recording medium of the present invention includes a master relational database in which a master master table and a master slave table are defined, and a master slave table is defined between the master master table and the master slave table. A master RDBMS that manages a master relational database, an update log file in which update log information is accumulated when the master main table of the master relational database is updated by the master RDBMS, and whether or not the update log file has been updated Log monitoring means for periodically monitoring, and when the update of the update log file is detected by the log monitoring means, a dummy main table in the slave relational database based on the latest update log information of the update log file Update reflection processing that reflects the update contents Recording a program for functioning as a stage.
[0012]
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0013]
FIG. 1 is a block diagram showing the configuration of a distributed database system to which the master-slave relationship information synchronization method according to the first embodiment of the present invention is applied. In this distributed database system, a
[0014]
The
[0015]
The master
[0016]
Here, the reason why the master master table 31 and the master slave table 32 are separate tables is because the tables are normalized. Normalization is a technique for eliminating the data redundancy and making the data structure easy to understand with data consistency and consistency. When normalization is performed, only the primary key portion is duplicated, but other data items can be omitted, and the processing at the time of data update is simplified. Both the primary key and the foreign key are set in the table column itself when the table is normalized.
[0017]
When the master RDBMS 2 is requested to update the master master table 31 and the master slave table 32, the master RDBMS 2 does not violate the validity check whether the update process (SQL) is correct or the referential integrity constraint of the table. This is a relational database management system that checks whether or not the slave RDBMS 8 is updated. When the master RDBMS 2 is notified from the slave RDBMS 8 that the update processing has been performed on the copy master table 91 and the copy slave table 92, the master RDBMS 2 updates the master master table 31 and the master slave table 32 equally. Process.
[0018]
The
[0019]
The log monitoring means 5 periodically monitors whether the
[0020]
When the update
[0021]
The
[0022]
Slave
[0023]
The dummy main table 93 is a table defined with a name different from that of the copy main table 91.
[0024]
Copy main table 91 and the copy subservient 92 has exactly the same data as the master main table 31 and the master subservient 32 defined in the master
[0025]
However, a master-slave relationship is not defined between the copy master table 91 and the copy slave table 92. In the distributed database system, the master-slave relationship is not defined between the copy master table 91 and the copy slave table 92 even though the contents of the master master table 31 and the master slave table 32 match. This is because the master key cannot be set for the copy master table 91, and therefore the master-slave relationship between the copy master table 91 and the copy slave table 92 cannot be defined.
[0026]
Therefore, in this embodiment, a master-slave relationship is defined between the dummy master table 93 and the copy slave table 92. That is, in order to define the master-slave relationship between the copy master table 91 and the copy slave table 92 in the slave
[0027]
1) To use the referential integrity constraints of the
[0028]
2) In the data update processing for the master master table 31 and master slave table 32, and the copy master table 91 and copy slave table 92 in the master
[0029]
3) Same as 1) and 2), but when adding a master slave table 32 and a copy slave table 92 to the master master table 31 and the copy master table 91, only the definition of the slave table is used. Consistency is maintained in order to make use of the reference consistency constraint between the
[0030]
When the update processing to the copy master table 91 and the copy slave table 92 is requested, the
[0031]
The
[0032]
The update processing means 11 updates the master master table 31 and master slave table 32 in the master
[0033]
Referring to FIG. 2, the master-slave relationship information synchronization method in the distributed database system according to the first embodiment includes an update log information output step A1, an update log file update determination step A2, and an update reflection processing means calling step. A3 and dummy main table update step A4.
[0034]
FIG. 3 is a diagram illustrating the contents of the master
[0035]
Next, the operation of the master-slave relationship information synchronization method in the distributed database system according to the first embodiment will be described with reference to FIGS.
[0036]
As shown in FIG. 3, for example, when data of “
[0037]
The log monitoring means 5 periodically monitors whether or not the
[0038]
The update reflection processing means 6 adds “
[0039]
Next, the operation of the master-slave relationship information synchronization method in the distributed database system according to the first embodiment will be described in more detail with reference to FIGS.
[0040]
(1) When update processing of the master main table 31 of the
[0041]
The
[0042]
Circled
[0043]
The circled
[0044]
The circled
[0045]
The circled
[0046]
The circled numeral 5
[0047]
The circled numeral 6 log monitoring means 5 detects that the
[0048]
The circled numeral 7 log monitoring means 5 calls the update reflection processing means 6 (step A3).
[0049]
The circled
[0050]
The circled
[0051]
(2) When update processing of the copy main table 91 of the
[0052]
The circled
[0053]
The circled number 1 '
[0054]
The circled numeral 2
[0055]
The circled
[0056]
The circled
[0057]
The circled
[0058]
The circled numeral 6 log monitoring means 5 detects that the
[0059]
The circled numeral 7 log monitoring means 5 calls the update reflection processing means 6 (step A3).
[0060]
The circled
[0061]
The circled
[0062]
(3) When update processing is performed from the
[0063]
The circled numeral 1 update processing means 11 requests the
[0064]
Circled number 1 '
[0065]
The circled
[0066]
The circled
[0067]
The circled numeral 4
[0068]
(4) When update processing is performed from the
[0069]
The circled
[0070]
Circled number 1 '
[0071]
The circled numeral 2
[0072]
The circled
[0073]
The circled
[0074]
In the present embodiment, the case where two servers of the
[0075]
If the
[0076]
Next, a second embodiment of the present invention will be described.
[0077]
FIG. 8 is a block diagram showing a configuration of a distributed database system to which the master-slave relationship information synchronization method according to the second embodiment of the present invention is applied.
[0078]
Referring to FIG. 8, the second embodiment of the present invention is configured to include a recording medium 100 that records a master server side program in the
[0079]
The master server side program is read from the recording medium 100 to the
[0080]
【The invention's effect】
Effect of the present invention, only by performing the process of updating the master main table of the master server, also can perform update processing while maintaining the master-slave relationship of contents and table distributed slave servers, as a result, each server The process of updating data having similar contents is not necessary. The reason is that the log monitoring unit monitors the update log information of the master main table and reflects the updated contents on the distributed slave server's dummy main table only when the update is performed. .
[0081]
In addition, when adding a secondary table to the primary table, conventionally, the secondary table is defined (master server, slave server) and data is updated and consistency is guaranteed on the application program side (server) However, in the present invention, it is only necessary to define the secondary table (master server, slave server) and set the foreign key for the dummy main table (connect the master-slave relationship). There is an advantage that it can be easily added.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a master-slave relationship information synchronization method in a distributed database system according to a first embodiment of the present invention.
FIG. 2 is a flowchart showing the operation of the master-slave relationship information synchronization method in the distributed database system according to the present embodiment.
FIG. 3 is a diagram illustrating contents of a master relational database , a slave relational database, and an update log file in FIG. 1;
4 is an operation explanatory diagram when an update process is performed on the master main table of the master server from the client in FIG. 1. FIG.
FIG. 5 is an operation explanatory diagram when an update process is performed from the client in FIG. 1 to the copy main table of the slave server;
6 is an operation explanatory diagram when the update process is performed on the master slave table of the master server from the client in FIG. 1. FIG.
7 is an operation explanatory diagram when updating processing is performed from the client in FIG. 1 to the copy slave table of the slave server. FIG.
FIG. 8 is a block diagram showing a configuration of a master-slave relationship information synchronization method in a distributed database system according to a second embodiment of the present invention.
[Explanation of symbols]
1
3 master
9 master
Claims (5)
ダミー主表がさらに定義されるとともに該ダミー主表と前記コピー従表との間に主従関係が定義された前記スレーブリレーショナルデータベースと、
前記マスタサーバに設けられ、前記マスタRDBMSにより前記マスタリレーショナルデータベースの前記マスタ主表が更新されたときに更新ログ情報が蓄積される更新ログファイルと、
前記マスタサーバに設けられ、前記更新ログファイルが更新されたか否かを定期的に監視するログ監視手段と、
前記ログ監視手段により前記更新ログファイルの更新が検出された場合に前記更新ログファイルの最新の更新ログ情報をもとに前記スレーブリレーショナルデータベース内の前記ダミー主表に対して更新内容の反映を行う更新反映処理手段と
を有することを特徴とする分散データベースシステムにおける主従関係情報同期方式。A master server having a master relational database in which a master master table and a master slave table are defined and a master slave relation is defined between the master master table and the master slave table, and a master RDBMS that manages the master relational database; In a distributed database system in which a slave relational database in which a table and a copy slave table are defined and a slave server having a slave RDBMS that manages the slave relational database are connected via a line,
The slave relational database in which a dummy master table is further defined and a master-slave relationship is defined between the dummy master table and the copy slave table;
An update log file provided in the master server, in which update log information is accumulated when the master main table of the master relational database is updated by the master RDBMS;
Log monitoring means provided in the master server and periodically monitoring whether or not the update log file has been updated;
When the update of the update log file is detected by the log monitoring unit, the update contents are reflected on the dummy main table in the slave relational database based on the latest update log information of the update log file. A master-slave relationship information synchronization method in a distributed database system, characterized by comprising update reflection processing means.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP21147699A JP3612449B2 (en) | 1999-07-27 | 1999-07-27 | Master-slave relationship information synchronization method in distributed database system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP21147699A JP3612449B2 (en) | 1999-07-27 | 1999-07-27 | Master-slave relationship information synchronization method in distributed database system |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2001034518A JP2001034518A (en) | 2001-02-09 |
JP3612449B2 true JP3612449B2 (en) | 2005-01-19 |
Family
ID=16606589
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP21147699A Expired - Fee Related JP3612449B2 (en) | 1999-07-27 | 1999-07-27 | Master-slave relationship information synchronization method in distributed database system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3612449B2 (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040040938A (en) * | 2002-11-08 | 2004-05-13 | 에스케이 텔레콤주식회사 | The method of synchronizing the information of the client |
KR100503899B1 (en) * | 2002-11-26 | 2005-07-25 | 진진시스템(주) | Database replication system and the replication method |
KR100757338B1 (en) | 2005-05-31 | 2007-09-11 | 엔에이치엔(주) | Method and system for synchronizing status of member servers belongging to same replication group |
KR100839445B1 (en) * | 2007-02-15 | 2008-06-19 | 건국대학교 산학협력단 | System for synchronizating of mobile data base using message digest and method therefor |
US9239767B2 (en) * | 2008-12-22 | 2016-01-19 | Rpx Clearinghouse Llc | Selective database replication |
JP5820902B2 (en) * | 2014-04-25 | 2015-11-24 | 株式会社三菱東京Ufj銀行 | Database server |
CN105989140B (en) * | 2015-02-27 | 2019-09-03 | 阿里巴巴集团控股有限公司 | A kind of data block processing method and equipment |
CN113742321A (en) * | 2020-09-24 | 2021-12-03 | 北京沃东天骏信息技术有限公司 | Data updating method and device |
CN112905707A (en) * | 2021-03-31 | 2021-06-04 | 浙江太美医疗科技股份有限公司 | Method and device for synchronizing relational database and search engine and computer storage medium |
CN116303476B (en) * | 2023-05-18 | 2023-09-01 | 北京合思信息技术有限公司 | Big data storage method, device, electronic equipment and medium |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4933848A (en) * | 1988-07-15 | 1990-06-12 | International Business Machines Corporation | Method for enforcing referential constraints in a database management system |
DE68926422T2 (en) * | 1988-09-23 | 1996-11-07 | Ibm | Database management system |
JPH04342070A (en) * | 1991-05-20 | 1992-11-27 | Nec Corp | Method for retrieving repetition data in distributed type relation data base |
JPH064383A (en) * | 1992-06-16 | 1994-01-14 | Hitachi Ltd | Method and system for managing data base |
JPH0765031A (en) * | 1993-08-27 | 1995-03-10 | Toshiba Corp | Information processing system having duplicate decentralized data base |
JPH07295868A (en) * | 1994-04-27 | 1995-11-10 | Hitachi Ltd | Integrity constraint control method for |
JPH09146804A (en) * | 1995-11-28 | 1997-06-06 | Toshiba Corp | Data matching device |
-
1999
- 1999-07-27 JP JP21147699A patent/JP3612449B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2001034518A (en) | 2001-02-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7053847B2 (en) | Metadata resynchronization in a content management system | |
US6615223B1 (en) | Method and system for data replication | |
US7509354B2 (en) | System, method, and computer program product for multi-master replication conflict resolution | |
JP4880668B2 (en) | Apparatus and method for identifying asynchronous data in a redundant data store and for resynchronizing it | |
JP4993772B2 (en) | Resource freshness and replication | |
JP5918243B2 (en) | System and method for managing integrity in a distributed database | |
US6658589B1 (en) | System and method for backup a parallel server data storage system | |
JP5178822B2 (en) | Data replication method and system in database management system (DBMS) | |
US6873995B2 (en) | Method, system, and program product for transaction management in a distributed content management application | |
JP2948496B2 (en) | System and method for maintaining replicated data consistency in a data processing system | |
US20040193952A1 (en) | Consistency unit replication in application-defined systems | |
US8874516B2 (en) | Semantic replication | |
KR20200100173A (en) | Data replication and data failover within the database system | |
US7437601B1 (en) | Method and system for re-synchronizing an asynchronous mirror without data loss | |
US8533169B1 (en) | Transactional replication | |
US20150347250A1 (en) | Database management system for providing partial re-synchronization and partial re-synchronization method of using the same | |
US8892516B2 (en) | Provisional authority in a distributed database | |
JP2006508473A (en) | Data recovery technology in storage systems | |
JP3612449B2 (en) | Master-slave relationship information synchronization method in distributed database system | |
JP4136615B2 (en) | Database system and database access method | |
US20080010515A1 (en) | Per file dirty region logging | |
JP4299033B2 (en) | Journal acquisition / distribution device, journal acquisition / distribution method, and program for causing computer to execute the method | |
US20230132830A1 (en) | Data migration | |
KR20090041624A (en) | Method and apparatus for synchronizing data in active-active database server system | |
JP7428894B2 (en) | Information processing device, information processing system, and information processing program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20040210 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20040304 |
|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20040304 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20040304 |
|
A911 | Transfer to examiner for re-examination before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20040416 |
|
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: 20041005 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20041025 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
S633 | Written request for registration of reclamation of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313633 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20081029 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091029 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20091029 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20101029 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20111029 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121029 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131029 Year of fee payment: 9 |
|
LAPS | Cancellation because of no payment of annual fees |