JP2012078993A - Method and system to scale up and scale down relational database - Google Patents

Method and system to scale up and scale down relational database Download PDF

Info

Publication number
JP2012078993A
JP2012078993A JP2010222316A JP2010222316A JP2012078993A JP 2012078993 A JP2012078993 A JP 2012078993A JP 2010222316 A JP2010222316 A JP 2010222316A JP 2010222316 A JP2010222316 A JP 2010222316A JP 2012078993 A JP2012078993 A JP 2012078993A
Authority
JP
Japan
Prior art keywords
instance
sql
data
sql statement
relational database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2010222316A
Other languages
Japanese (ja)
Inventor
Hideaki Saijo
秀明 才所
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.)
Hitachi Solutions Ltd
Original Assignee
Hitachi Solutions Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Solutions Ltd filed Critical Hitachi Solutions Ltd
Priority to JP2010222316A priority Critical patent/JP2012078993A/en
Publication of JP2012078993A publication Critical patent/JP2012078993A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To realize scale-up/down of an RDB run as an instance on IaaS without stopping Web service, by dynamically performing replacement of the instance at low cost.SOLUTION: This invention comprises: first means to store a copy of an SQL statement performing data update; means to determine whether the copy of the SQL statement performing data update is stored or not; means to send the copy of the SQL statement performing data update to a second relational database different from the relational database of a replacement source of an instance, reflect it and synchronize data stored in the first and second relational databases based on the determination result; and means to change the instance run by the relational database of the replacement source of the instance into an instance having different performance after synchronization establishment of the data in the both relational databases and change an instance run by a relational database of a replacement destination into a different instance.

Description

本発明は、IaaS(Infrastructure as a Service)などで提供する仮想マシンインスタンス上で動作するリレーショナルデータベース(以下、RDB)に対し、SQL問い合わせを中継するプロキシを用いてシステムの停止を必要とせず動的に、スケールアップ及びスケールダウンを実現する技術に関するものである。   In the present invention, a relational database (hereinafter referred to as RDB) operating on a virtual machine instance provided by IaaS (Infrastructure as a Service) or the like is dynamically used by using a proxy that relays an SQL query without stopping the system. In particular, the present invention relates to a technique for realizing scale-up and scale-down.

現在、仮想マシンインスタンスを提供するIaaSが数多く提供されている。その中でもAmazon Web Services(以下、AWSと略す)のEC2のように、様々な性能のインスタンスを時間単位の課金で利用できるIaaSは、サービス利用者の増減に伴う負荷の増減に合わせて、計算資源の利用コストをスケールすることが可能であるため、多くのWebサービスで利用されつつある。
このようなWebサービスは、一般的にWebアプリケーションとデータベースで構成されているが、Webアプリケーションについては、負荷に応じて動的にインスタンスを増減させるスケールOUT/INの手法が一般的に利用されている。また、スケールOUT/IN機能は、既にIaaSベンダ自身やサードーパーティから提供されている。
Currently, there are many IaaSs that provide virtual machine instances. Among them, like EC2 of Amazon Web Services (hereinafter abbreviated as “AWS”), IaaS that can use various performance instances with hourly billing is a computing resource that matches the increase or decrease of the load accompanying the increase or decrease of service users. Since it is possible to scale the usage cost of the Internet, it is being used in many Web services.
Such a web service is generally composed of a web application and a database, but for web applications, a scale OUT / IN method that dynamically increases or decreases instances according to the load is generally used. Yes. The scale OUT / IN function is already provided by the IaaS vendor itself or a third party.

データベースについても、負荷に応じて処理性能を変化させる方法は幾つか提案されている。インスタンス数を増減させて処理性能を変化させるスケールOUT/INを実現する方法としては、非特許文献1に代表されるNoSQLと分類されるデータベースがある。また、従来のRDBクラスタ技術では更新性能が問題となっていたが、非特許文献2や非特許文献3などのように、更新性能も台数に応じてリニアに向上できるクラスタ技術も現れてきている。 As for the database, several methods for changing the processing performance according to the load have been proposed. As a method for realizing the scale OUT / IN for changing the processing performance by increasing or decreasing the number of instances, there is a database classified as NoSQL represented by Non-Patent Document 1. In addition, although update performance has been a problem in the conventional RDB cluster technology, cluster technologies that can improve the update performance linearly according to the number of devices have appeared, such as Non-Patent Document 2 and Non-Patent Document 3. .

しかし、これらの方法は従来のRDBと同様の機能が提供されなかったり、従来のRDBと同様のインタフェースが提供されなかったり、常に3台以上稼動する構成でないと、1台の性能より劣ってしまうなど、様々な問題がある。また、動的に台数を増減させる方法も確立されていない。
一方、RDBが稼動するインスタンス(=仮想マシン)を、性能が異なるインスタンスに入れ替えことで負荷に応じた性能に変更するスケールUP/DOWNを実現する方法もある。例えば、pgpool-IIのレプリケーションとオンラインリカバリ機能を用いれば、インスタンスを入れ替えることは可能である。しかし、オンラインリカバリ中でも、一時的にRDBの接続を止める必要があり、その間はサービスが停止してしまう。
特許文献1を用いれば、停止せずにインスタンスを入れ替えることが可能ではあるが、RDBMS自体に、特許文献1で示された処理を行う機能を持つ必要がある。このため、既存のRDBMSに、この方法を容易に実現することは困難である。
さらに、特許文献1は、実機環境でマシン環境の変化が少ない場面におけるサーバの故障時や、スレーブサーバの追加を想定している。IaaS上で負荷に応じてRDBの処理性能を変化させる場合には、数時間や一日単位でインスタンスを入れ替えなければならない。特許文献1の方法では、データ転送量やコピーなどの処理時間が大きく、データ転送量や入れ替えコストが増大してしまう。そのため、入れ替えのための時間が大きくなる上、データ転送量やインスタンスの起動時間で課金されるIaaSではコスト増となる。従って、このような場合には特許文献1の方法は適さない。
However, these methods are inferior to the performance of one unit unless the same function as the conventional RDB is provided, the same interface as the conventional RDB is not provided, or when three or more units are not always operated. There are various problems. Also, a method for dynamically increasing or decreasing the number has not been established.
On the other hand, there is also a method for realizing scale UP / DOWN in which an instance (= virtual machine) in which RDB operates is replaced with an instance having different performance to change the performance according to the load. For example, using pgpool-II's replication and online recovery functions, it is possible to swap instances. However, even during online recovery, it is necessary to temporarily stop the RDB connection, and the service stops during that time.
If Patent Document 1 is used, it is possible to replace the instance without stopping, but the RDBMS itself needs to have a function of performing the processing shown in Patent Document 1. For this reason, it is difficult to easily implement this method in an existing RDBMS.
Further, Patent Document 1 assumes that a server failure occurs in a scene where there is little change in the machine environment in an actual machine environment, or that a slave server is added. When changing the processing performance of the RDB according to the load on IaaS, the instances must be replaced every few hours or every day. In the method of Patent Document 1, the data transfer amount and the processing time for copying and the like are long, and the data transfer amount and replacement cost increase. As a result, the time required for replacement increases, and the cost of IaaS charged by the data transfer amount and the instance startup time increases. Therefore, in such a case, the method of Patent Document 1 is not suitable.

特開2009−252149号公報JP 2009-252149 A

CouchDB http://oss.infoscience.co.jp/couchdb/main/docs/overview.htmlCouchDB http://oss.infoscience.co.jp/couchdb/main/docs/overview.html Postgres-XC http://postgres-xc.sourceforge.net/Postgres-XC http://postgres-xc.sourceforge.net/ VoltDB http://voltdb.com/content/voltdb-oltp-database-youll-never-outgrowVoltDB http://voltdb.com/content/voltdb-oltp-database-youll-never-outgrow

本発明は上記の問題に鑑みなされたもので、その目的は、IaaS上のインスタンスで動作するRDBのスケールUP/DOWNを、Webサービスを止めることなく動的に、かつ低コストでインスタンスの入れ替えを行うことで実現する方法およびシステムを提供することにある。   The present invention has been made in view of the above problems, and its purpose is to change the scale of an RDB that operates on an instance on IaaS dynamically and at low cost without stopping the Web service. It is to provide a method and a system which are realized by performing.

上記目的を達成するために、本発明は、第1及びは第2のリレーショナルデータベースに対し選択的にSQL文の送受信を中継する中継手段と、データ更新を行うSQL文のコピーを記憶する第1の手段と、データ更新を行うSQL文のコピーが記憶されているかいないかを判定する手段と、その判定結果に基づきデータ更新を行うSQL文のコピーをインスタンスの入れ替え元の前記リレーショナルデータベースとは別の第2のリレーショナルデータベースへ送信して反映させ、第1、第2のリレーショナルデータベースに格納されたデータの同期をとる手段と、両リレーショナルデータベースのデータの同期確立後に前記インスタンス入れ替え元のリレーショナルデータベースが稼動していたインスタンスを異なる性能のインスタンスに変更すると共に、入れ替え先のリレーショナルデータベースが稼動していたインスタンスを異なるインスタンスに変更する手段とを備えることを特徴とする。   In order to achieve the above object, the present invention stores a relay means for selectively relaying transmission and reception of SQL statements to the first and second relational databases, and a first copy for storing SQL statements for updating data. And a means for determining whether or not a copy of the SQL statement that performs data update is stored, and a copy of the SQL statement that performs data update based on the determination result is different from the relational database from which the instance is replaced. Means for synchronizing the data stored in the first and second relational databases, and the relational database from which the instance is replaced after the synchronization of the data of both relational databases is established. Change running instances to instances with different performance Together with further be characterized by comprising a means for changing the instance relational database exchange destination was busy at different instances.

また、本発明に係るシステムは、第1及び第2のリレーショナルデータベースに対し選択的にSQL文の送受信を中継する中継手段と、データ更新を行うSQL文のコピーを記憶する第1の手段と、データ更新を行うSQL文のコピーが記憶されているかいないかを判定する手段と、その判定結果に基づきデータ更新を行うSQL文のコピーをインスタンスの入れ替え元の前記リレーショナルデータベースとは別の第2のリレーショナルデータベースへ送信して反映させ、第1、第2のリレーショナルデータベースに格納されたデータの同期をとる手段と、両リレーショナルデータベースのデータの同期確立後に前記インスタンス入れ替え元のリレーショナルデータベースが稼動していたインスタンスを異なる性能のインスタンスに変更すると共に、入れ替え先のリレーショナルデータベースが稼動していたインスタンスを異なるインスタンスに変更する手段とを備えることを特徴とする。   In addition, the system according to the present invention includes a relay unit that selectively relays transmission and reception of SQL statements to the first and second relational databases, a first unit that stores a copy of the SQL statement that performs data update, A means for determining whether or not a copy of the SQL statement for performing data update is stored, and a second copy that is different from the relational database from which the instance is replaced by replacing the copy of the SQL statement for performing data update based on the determination result A means for synchronizing the data stored in the first and second relational databases by transmitting to the relational database and reflecting it, and the relational database from which the instance was replaced was in operation after the synchronization of the data in both relational databases was established Change an instance to an instance with a different performance Together, characterized in that it comprises a means for changing the instance relational database exchange destination was busy at different instances.

本発明によれば、Webサービス等で利用されているRDBを、サービスを止めることなく動的に、かつ短時間及び低コストで、スケールUP/DOWNできる。   According to the present invention, it is possible to scale up / down an RDB used in a web service or the like dynamically without stopping the service, in a short time and at a low cost.

本発明に係る実施形態を示すシステム構成図である。It is a system configuration figure showing an embodiment concerning the present invention. 入れ替え前のシステム構成図とSQL文のフロー図である。It is the system block diagram before replacement, and the flow figure of the SQL sentence. 入れ替え処理の処理の概要を示すフローチャートである。It is a flowchart which shows the outline | summary of the process of a replacement process. 入れ替え準備処理を示すフローチャートである。It is a flowchart which shows replacement | exchange preparation processing. 入れ替え準備処理後のシステム構成図とSQL文のフロー図である。It is a system configuration figure after exchange preparation processing, and a flow chart of a SQL sentence. DB切り替え処理を示すフローチャートである。It is a flowchart which shows DB switching processing. DB切り替え処理中の制御プロキシ部122のSQL処理フロー図である。It is a SQL process flow figure of the control proxy part 122 in DB switching process. DB切り替え処理中のシステム構成図とSQL文のフロー図(1)である。It is a system block diagram during DB switching processing and a flow diagram (1) of an SQL sentence. DB切り替え処理中のシステム構成図とSQL文のフロー図(2)である。It is a system block diagram during DB switching processing and a flow diagram (2) of the SQL sentence. 入れ替え後処理の処理フロー図である。It is a processing flow figure of processing after exchange.

以下、本発明を実施する場合の一形態を、図面を参照して具体的に説明する。
図1に本発明のシステムの構成図を示す。
本システムは、IaaS100上の仮想マシンサービスを用いたインスタンス群とストレージサービスを用いたストレージ群で構成される。
IaaS100上には、Webアプリ用インスタンス110、コントロール・プロキシ用インスタンス120、DBシステム(A)130を構成するDBMS用インスタンスA140とデータを保管するストレージ(A)150、DBシステム(B)160を構成するDBMS用インスタンスB170とデータを保管するストレージ(B)180を配置する。
Hereinafter, an embodiment for carrying out the present invention will be specifically described with reference to the drawings.
FIG. 1 shows a configuration diagram of the system of the present invention.
This system includes an instance group using a virtual machine service on IaaS 100 and a storage group using a storage service.
On the IaaS 100, a Web application instance 110, a control proxy instance 120, a DBMS instance A140 constituting the DB system (A) 130, a storage (A) 150 for storing data, and a DB system (B) 160 are constituted. A DBMS instance B 170 to be stored and a storage (B) 180 for storing data are arranged.

Webアプリ用インスタンス110には、Webアプリ111及びそれを動作させる一連のプログラムが配置されている。このWebアプリ111は、RDBMSの代わりに後述のコントロール・プロキシ用インスタンス120上の制御プロキシ部122にSQL文を発行し、その結果を受け取る。
コントロール・プロキシ用インスタンス120には、コントロール部121及び制御プロキシ部122、RDBMS123、SQL文ストアX124を配置する。コントロール部121は、IaaS100が提供するAPIなどのインタフェースを通して、インスタンス入れ替え時にインスタンスの起動停止や、インスタンス上のRDBMSの起動停止などのコントロールを行う。
In the web application instance 110, a web application 111 and a series of programs for operating the web application 111 are arranged. The Web application 111 issues an SQL statement to the control proxy unit 122 on the control proxy instance 120 described later instead of the RDBMS, and receives the result.
In the control proxy instance 120, a control unit 121, a control proxy unit 122, an RDBMS 123, and an SQL statement store X124 are arranged. The control unit 121 performs control such as start / stop of an instance or start / stop of an RDBMS on an instance at the time of instance replacement through an interface such as an API provided by the IaaS 100.

制御プロキシ部122は、Webアプリ111から受けたSQL文を、Webアプリ111の代わりに後述するDBシステム(A)130やDBシステム(B)160へ発行し、その結果を受けてWebアプリ111に返したり、Webアプリ111から受けたSQL文の中から更新を含むSQL文(以下、更新系SQL文と略記)を判定し、それを後述する各種SQLストアの中の適切なものに蓄積したりする。
RDBMS123は、コントロール・プロキシ用インスタンス120の処理負荷に余裕がある場合に、蓄積された更新系SQL文を適切なDBデータに反映させる。SQL文ストアX124は、インスタンス入れ替え処理中の更新系SQL文を蓄積するリポジトリである。
The control proxy unit 122 issues the SQL sentence received from the Web application 111 to the DB system (A) 130 or the DB system (B) 160 described later instead of the Web application 111, and receives the result to the Web application 111. Returns or determines an SQL sentence that includes an update from the SQL sentence received from the Web application 111 (hereinafter abbreviated as an update-type SQL sentence), and stores it in an appropriate one of various SQL stores to be described later. To do.
The RDBMS 123 reflects the accumulated update SQL statement in appropriate DB data when the processing load of the control proxy instance 120 is sufficient. The SQL statement store X124 is a repository for accumulating update SQL statements during instance replacement processing.

DBシステム(A)130及びDBシステム(B)160は、入れ替え元及び入れ替え先となるDBシステムである。どちらも同じ構成となっており、DBMS用インスタンス(A)140及びDBMS用インスタンス(B)170には、一般的なRDBMSであるRDBMS−(A)141及びRDBMS−(B)171が各々配置されている。
また、ストレージ(A)150及びストレージ(B)180には、入れ替え処理前及び入れ替え処理後に更新系SQL文を蓄積するSQL文ストアZ151及びSQL文ストアY181と、RDBMS−(A)141及びRDBMS−(B)171が各々利用するDBデータ(A)152及びDBデータ(B)182を配置する。
The DB system (A) 130 and the DB system (B) 160 are DB systems to be replaced and replaced. Both have the same configuration, and RDBMS- (A) 141 and RDBMS- (B) 171 which are general RDBMSs are arranged in the DBMS instance (A) 140 and the DBMS instance (B) 170, respectively. ing.
Further, the storage (A) 150 and the storage (B) 180 are stored in the SQL statement store Z151 and the SQL statement store Y181 that store update SQL statements before and after the replacement process, and RDBMS- (A) 141 and RDBMS-. (B) DB data (A) 152 and DB data (B) 182 used by 171 are arranged.

以下では、入れ替え開始時点で利用されている入れ替え元をDBシステム(A)130、入れ替え終了時に利用されている入れ替え先をDBシステム(B)160として説明する。
ここで、入れ替え処理を説明する前に、入れ替え開始前の状態を図2で説明する。
入れ替え開始前の状態では、DBシステム(A)130が利用され、DBMS用インスタンス(B)170は稼動していない。ただし、ストレージ(B)180には、DBデータ(B)182にSQL文ストアY181を反映させれば、ストレージ(A)150のDBデータ(A)152と同等のデータになるようなDBデータ(B)182とSQL文ストアY181が、予め存在するものとする。これらは、既存のDBデータコピー技術と、以降で説明するSQL文の蓄積を用いれば実現可能である。
In the following description, it is assumed that the replacement source used at the start of replacement is the DB system (A) 130, and the replacement destination used at the end of replacement is the DB system (B) 160.
Here, before explaining the replacement process, the state before the start of the replacement will be described with reference to FIG.
In the state before the start of replacement, the DB system (A) 130 is used, and the DBMS instance (B) 170 is not operating. However, if the SQL statement store Y181 is reflected in the DB data (B) 182 in the storage (B) 180, the DB data (such as the DB data (A) 152 in the storage (A) 150 becomes the same data ( B) Assume that 182 and the SQL statement store Y181 exist in advance. These can be realized by using an existing DB data copy technique and accumulation of SQL sentences described below.

入れ替え開始前の状態では、Webアプリ111が発行したSQL文は、黒矢印201で示すように、コントロール・プロキシ用インスタンス120の制御プロキシ部122に送る。制御プロキシ部122は、黒矢印202で示すように、全てのSQL文を、DBMS用インスタンス(A)140のRDBMS−(A)141に送る。
RDBMS−(A)141はストレージ(A)150のDBデータ(A)152を用いてSQL文を処理し、その結果を、制御プロキシ部122を経由して、Webアプリ111に返答する。
In the state before the start of replacement, the SQL statement issued by the Web application 111 is sent to the control proxy unit 122 of the control proxy instance 120 as indicated by the black arrow 201. The control proxy unit 122 sends all SQL statements to the RDBMS- (A) 141 of the DBMS instance (A) 140 as indicated by the black arrow 202.
The RDBMS- (A) 141 processes the SQL sentence using the DB data (A) 152 of the storage (A) 150 and returns the result to the Web application 111 via the control proxy unit 122.

また、入れ替え開始前の状態では、コントロール・プロキシ用インスタンス120はストレージ(B)180にも接続されており、制御プロキシ部122は、Webアプリ111から受けたSQL文の中で、更新系SQL文をコピーし、白矢印203で示すようにストレージ(B)180中のSQL文ストアY181に蓄積する。
さらに、コントロール・プロキシ用インスタンス120で、処理能力に余裕がある場合には、RDBMS123が、白矢印204及び205に示すように、ストレージ(B)180のSQL文ストアY181に蓄積された更新系SQL文を、ストレージ(B)180のDBデータB182に反映させる。
このように、入れ替え開始前の状態では、DBシステム(A)130が利用され、更新系SQL文のみがストレージ(B)180中のSQL文ストアY181に蓄積され、コントロール・プロキシ用インスタンス120の処理能力の余裕に応じてストレージ(B)180のDBデータ(B)182に、更新系SQL文が反映される。
In the state before the start of replacement, the control proxy instance 120 is also connected to the storage (B) 180, and the control proxy unit 122 updates the update SQL statement among the SQL statements received from the Web application 111. Is stored in the SQL statement store Y181 in the storage (B) 180 as indicated by a white arrow 203.
Furthermore, when the control proxy instance 120 has a sufficient processing capacity, the RDBMS 123 updates the update SQL stored in the SQL statement store Y181 of the storage (B) 180 as indicated by white arrows 204 and 205. The sentence is reflected in the DB data B 182 of the storage (B) 180.
Thus, in the state before the start of replacement, the DB system (A) 130 is used, and only the update SQL statement is accumulated in the SQL statement store Y181 in the storage (B) 180, and the processing of the control proxy instance 120 is performed. The update SQL statement is reflected in the DB data (B) 182 of the storage (B) 180 according to the capacity margin.

次に、入れ替え処理の概要フローを図3に示す。
入れ替え処理は、入れ替え準備処理(ステップ301)、DBシステム切り替え処理(ステップ302)、入れ替え後処理(ステップ303)の3つのフェーズで行われる。
以後、この順序で詳細な処理を説明する。
入れ替え準備処理(ステップ301)の詳細な処理フローを図4に示す。
まず、コントロール・プロキシ用インスタンス120上のコントロール部121は、コントロール・プロキシ用インスタンス120上に、SQL文ストアX140を作成し、これまでコントロール・プロキシ用インスタンス120の制御プロキシ部122がストレージ(B)180上のSQL文ストアY181に蓄積してきた更新系SQL文を、SQL文ストアX124に蓄積するように制御プロキシ部122の設定を変更する(ステップ401)。
Next, an outline flow of the replacement process is shown in FIG.
The replacement process is performed in three phases: a replacement preparation process (step 301), a DB system switching process (step 302), and a post-replacement process (step 303).
Hereinafter, detailed processing will be described in this order.
A detailed processing flow of the replacement preparation process (step 301) is shown in FIG.
First, the control unit 121 on the control proxy instance 120 creates the SQL statement store X140 on the control proxy instance 120, and the control proxy unit 122 of the control proxy instance 120 has previously stored the storage (B). The setting of the control proxy unit 122 is changed so that the update SQL statement stored in the SQL statement store Y181 on 180 is stored in the SQL statement store X124 (step 401).

次に、コントロール部121は、コントロール・プロキシ用インスタンス120とストレージ(B)180の接続を切断し、ストレージ(B)180に接続された形で、DBMS用インスタンス(B)170を起動する(ステップ402)。そして、DBMS用インスタンス(B)170上に、ストレージ(B)180上のDBデータ(B)182を利用する設定で、RDBMS−(B)171を起動する(ステップ403)。
最後に、コントロール部121は、起動したRDBMS−(B)171に対し、ストレージ(B)180上のSQL文ストアY181に蓄積された更新系SQL文を、DBデータ(B)182に反映させる(ステップ404)。
Next, the control unit 121 disconnects the connection between the control proxy instance 120 and the storage (B) 180 and activates the DBMS instance (B) 170 in a form connected to the storage (B) 180 (steps). 402). Then, the RDBMS- (B) 171 is activated on the DBMS instance (B) 170 with settings to use the DB data (B) 182 on the storage (B) 180 (step 403).
Finally, the control unit 121 causes the activated RDBMS- (B) 171 to reflect the updated SQL statement stored in the SQL statement store Y181 on the storage (B) 180 in the DB data (B) 182 ( Step 404).

以上が、入れ替え準備処理(ステップ301)である。入れ替え準備処理が終わった状態を図5に示す。
図2と比べ、DBシステム(B)180が変更され、更新系SQL文は白矢印501で示すように、SQL文ストアX124に蓄積されるようになるが、DBシステム(A)130側は変化せずWebアプリ111が送る全てのSQL文の処理は、依然としてDBシステム(A)130が利用されるため、Webアプリ111は引き続きSQL文処理を含む動作を継続することができる。
The above is the replacement preparation process (step 301). FIG. 5 shows a state where the replacement preparation process is completed.
Compared to FIG. 2, the DB system (B) 180 is changed, and the update SQL statement is accumulated in the SQL statement store X124 as indicated by the white arrow 501, but the DB system (A) 130 side is changed. Since the DB system (A) 130 is still used for the processing of all SQL statements sent by the Web application 111, the Web application 111 can continue the operation including the SQL statement processing.

次に、DBシステム切り替え処理(ステップ302)の詳細な処理フローを図6に示す。
まず、コントロール部121は、制御プロキシ部122の設定を変え、Webアプリ111から受け取ったSQL文を図7に示す処理フローで処理するようにする(ステップ601)。
ここで、図7の処理フローを説明する。Webアプリ111からSQL文を受け取った制御プロキシ部122は、そのSQL文をDBシステム(A)130に送る(ステップ701)。次に、更新系SQL文かどうかを判断する(ステップ702)。もし、ステップ702で、更新系SQL文で無いと判断された場合には、DBシステム(A)130からSQL文処理結果を受け取り(ステップ703)、Webアプリ111にその結果を返答する(ステップ704)。
Next, a detailed process flow of the DB system switching process (step 302) is shown in FIG.
First, the control unit 121 changes the setting of the control proxy unit 122 to process the SQL sentence received from the Web application 111 with the processing flow shown in FIG. 7 (step 601).
Here, the processing flow of FIG. 7 will be described. The control proxy unit 122 that has received the SQL sentence from the Web application 111 sends the SQL sentence to the DB system (A) 130 (step 701). Next, it is determined whether it is an update SQL statement (step 702). If it is determined in step 702 that the statement is not an update SQL statement, the SQL statement processing result is received from the DB system (A) 130 (step 703), and the result is returned to the web application 111 (step 704). ).

ステップ702で更新系SQL文と判断された場合には、次にSQL文ストアX124にSQL文の蓄積が無いかどうかを判断する(ステップ705)。もし、SQL文ストアX124にSQL文の蓄積が有った場合は、ステップ702で更新系SQL文と判断されたSQL文を、SQL文ストアX124に蓄積する(ステップ706)。その後、先と同様にステップ703及びステップ704の処理を行う。
ステップ705で、SQL文ストアX124にSQL文の蓄積が無い場合は、ステップ702で更新系SQL文と判断されたSQL文を、DBシステム(B)160に送る(ステップ707)。この段階でデータの同期がとれたことになる。そして、DBシステム(B)160からSQL文処理結果を受け取る(ステップ708)。そして、先と同様にDBシステム(A)130からSQL文処理結果を受け取り(ステップ703)、Webアプリ111にその結果を返答する(ステップ704)。
If it is determined in step 702 that the SQL statement is an update SQL statement, it is next determined whether or not there is any accumulation of SQL statements in the SQL statement store X124 (step 705). If the SQL sentence is stored in the SQL sentence store X124, the SQL sentence determined to be the update SQL statement in step 702 is stored in the SQL sentence store X124 (step 706). Thereafter, the processing of step 703 and step 704 is performed in the same manner as described above.
If there is no SQL sentence stored in the SQL sentence store X124 in step 705, the SQL sentence determined to be the update SQL statement in step 702 is sent to the DB system (B) 160 (step 707). At this stage, the data is synchronized. Then, the SQL statement processing result is received from the DB system (B) 160 (step 708). Then, the SQL statement processing result is received from the DB system (A) 130 in the same manner as described above (step 703), and the result is returned to the web application 111 (step 704).

この際、従来のレプリケーション技術と同様に、ステップ708とステップ703で受け取ったSQL文処理結果を比較し、適切なエラー処理を行ってもよい。
ステップ601で、制御プロキシ部122の設定を図7で示した処理フローになるように設定した後、コントロール部121は、DBMS用インスタンス(B)170上のRDBMS−(B)171に対し、SQL文ストアX124に蓄積されたSQL文を送り、反映処理を行う(ステップ602)。
この際、RDBMS−(B)171から処理結果が帰ってきた時点で、SQL文ストアX124からSQL文を削除するようにする。
At this time, as in the conventional replication technique, the SQL statement processing results received in step 708 and step 703 may be compared to perform appropriate error processing.
In step 601, after setting the setting of the control proxy unit 122 to be the processing flow shown in FIG. 7, the control unit 121 sends an SQL statement to the RDBMS- (B) 171 on the DBMS instance (B) 170. The SQL sentence stored in the sentence store X124 is sent and reflection processing is performed (step 602).
At this time, when the processing result is returned from the RDBMS- (B) 171, the SQL sentence is deleted from the SQL sentence store X124.

次に、コントロール部121は、SQL文ストアX124に蓄積されたSQL文が全て反映されたかどうかを確認する(ステップ603)。もし、ステップ603の途中で、制御プロキシ部122のステップ706の処理の影響などにより、SQL文ストアX124に蓄積されたSQL文が全て反映されていない場合は、再度ステップ602の反映処理を行う。   Next, the control unit 121 checks whether or not all the SQL sentences stored in the SQL sentence store X124 have been reflected (step 603). If all the SQL sentences stored in the SQL sentence store X124 are not reflected in the middle of step 603 due to the influence of the process of step 706 of the control proxy unit 122, the reflection process of step 602 is performed again.

ステップ603で、SQL文ストアX124に蓄積されたSQL文が全て反映された場合、制御プロキシ部122の処理は、図7のステップ706に進むことは無くなり、更新系SQL文は、図8の白矢印801のようにDBシステム(B)160側にもコピーされて送られることとなる。そこで、次にコントロール部121は、制御プロキシ部122の設定を変え、DBシステム(A)130とDBシステム(B)160を入れ替える(ステップ604)。   If all the SQL statements stored in the SQL statement store X124 are reflected in step 603, the processing of the control proxy unit 122 does not proceed to step 706 in FIG. 7, and the update-type SQL statement is white in FIG. As indicated by an arrow 801, the data is also copied and sent to the DB system (B) 160 side. Therefore, next, the control unit 121 changes the setting of the control proxy unit 122 and replaces the DB system (A) 130 and the DB system (B) 160 (step 604).

具体的には、図7で示したSQL処理フローのDBシステム(A)とDBシステム(B)を入れ替えて、全てのSQL文がDBシステム(B)160で処理されるようにし、更新系SQL文のみDBシステムA130に送られるようにする。この状態を図9に示す。
制御プロキシ部122は、黒矢印201で示すように、これまでと同様にWebアプリ111からSQL文を受け取るが、黒矢印901で示すように、全てのSQL文はDBシステム(B)160に送信し、DBシステム(B)160から受け取った結果をWebアプリ111に返す。
Specifically, the DB system (A) and the DB system (B) in the SQL processing flow shown in FIG. 7 are exchanged so that all SQL statements are processed by the DB system (B) 160, and the update system SQL is changed. Only the sentence is sent to the DB system A130. This state is shown in FIG.
As indicated by the black arrow 201, the control proxy unit 122 receives the SQL sentence from the Web application 111 as before, but as shown by the black arrow 901, all the SQL sentences are transmitted to the DB system (B) 160. Then, the result received from the DB system (B) 160 is returned to the Web application 111.

また、更新系SQL文は、白矢印902で示すように、DBシステム(A)130に送られ、DBシステム(A)130のストレージ(A)150上のDBデータ(A)152に反映される。   Further, the update SQL statement is sent to the DB system (A) 130 and reflected in the DB data (A) 152 on the storage (A) 150 of the DB system (A) 130 as indicated by the white arrow 902. .

以上により、DBシステム切り替え処理(ステップ302)は終了する。
DBシステム切り替え処理(ステップ302)が終了した後は、実質的に処理が行われるDBシステムが、DBシステム(A)130からDBシステム(B)160に切り替わっている。ここで、更新系SQL文はステップ604まではDBシステム(A)130のみ、それ以降はDBシステム(A)130とDBシステム(B)160の両方で処理される。
また、更新系以外のSQL文は、ステップ604まではDBシステム(A)130、それ以降はDBシステム(B)160で処理される。このため、SQL文が処理されないタイミングは存在せず、Webアプリ111は引き続きSQL文処理を含む動作を継続することができる。
Thus, the DB system switching process (step 302) ends.
After the DB system switching process (step 302) is completed, the DB system on which the process is substantially performed is switched from the DB system (A) 130 to the DB system (B) 160. Here, the update SQL statement is processed only by the DB system (A) 130 until step 604, and the subsequent processing is performed by both the DB system (A) 130 and the DB system (B) 160.
In addition, SQL statements other than the update system are processed by the DB system (A) 130 up to step 604 and the DB system (B) 160 thereafter. For this reason, there is no timing at which the SQL sentence is not processed, and the Web application 111 can continue the operation including the SQL sentence processing.

次に、入れ替え後処理(ステップ303)の詳細な処理フローを図10に示す。
まず、コントロール部121は、制御プロキシ部122の設定を変え、DBシステム(A)130に送られていた更新系SQL文をDBシステム(A)130に送らずに、SQL文ストアX124に蓄積するようにする(ステップ1001)。これにより、図5で、DBシステム(A)130とDBシステム(B)160を入れ替えた状態になる。
次にコントロール部121は、DBMS用インスタンスA140を停止する(ステップ1002)。ステップ1001によりSQL文が送られることは無いので、この停止は問題を引き起こすことは無い。次に、ストレージA150を、コントロール・プロキシ用インスタンス120に接続させ、ストレージA150上にSQL文ストアZ151を作成し、制御プロキシ部122の設定を変え、更新系SQL文をSQL文ストアZ151に蓄積するようにする(ステップ1003)。
Next, FIG. 10 shows a detailed processing flow of the post-replacement processing (step 303).
First, the control unit 121 changes the setting of the control proxy unit 122, and stores the update SQL statement sent to the DB system (A) 130 in the SQL statement store X124 without sending it to the DB system (A) 130. (Step 1001). As a result, the DB system (A) 130 and the DB system (B) 160 are switched in FIG.
Next, the control unit 121 stops the DBMS instance A140 (step 1002). Since no SQL statement is sent in step 1001, this stop does not cause a problem. Next, the storage A 150 is connected to the control proxy instance 120, the SQL statement store Z 151 is created on the storage A 150, the setting of the control proxy unit 122 is changed, and the update SQL statement is stored in the SQL statement store Z 151. (Step 1003).

次に、SQL文ストアX124に蓄積されていた更新系SQL文を、SQL文の順序を変えずにSQL文ストアZ151にマージする(ステップ1004)。
次に、コントロール・プロキシ用インスタンス120上のRDBMS123の設定を変更し、コントロール・プロキシ用インスタンス120の処理負荷に余裕がある場合に、SQL文ストアZ151をストレージ(A)150上のDBデータ(A)152に反映させるようにする(ステップ1005)。
Next, the update SQL statement stored in the SQL statement store X124 is merged into the SQL statement store Z151 without changing the order of the SQL statements (step 1004).
Next, when the setting of the RDBMS 123 on the control proxy instance 120 is changed, and the processing load of the control proxy instance 120 is sufficient, the SQL statement store Z151 is stored in the DB data (A ) 152 (step 1005).

ここで、ステップ1004のマージ処理の代わりに、コントロール・プロキシ用インスタンス120上のRDBMS123を起動し、SQL文ストアX124に蓄積されていたSQL文を、ストレージ(A)150上のDBデータ(A)152に反映させてもよい。   Here, instead of the merge processing in step 1004, the RDBMS 123 on the control proxy instance 120 is activated, and the SQL statement stored in the SQL statement store X 124 is converted into the DB data (A) on the storage (A) 150. 152 may be reflected.

以上により、入れ替え後処理(ステップ303)は終了する。
これにより、図2で示した入れ替え開始前の状態と比較し、DBシステムA130とDBシステムB160が完全に入れ替わった状態となる。
Thus, the post-replacement process (step 303) ends.
Thereby, compared with the state before the start of replacement shown in FIG. 2, the DB system A 130 and the DB system B 160 are completely replaced.

本発明では、再度入れ替えを行うことも可能で、上記で示したように、DBデータ全ての移行は必要ない。また、Webアプリ111からのSQL文は、どの時点でも同期されたデータを持つDBシステム(A)130もしくはDBシステム(B)160で処理されるため、動的な入れ替えも実現できている。
以上のうに、IaaSで提供される異なる性能のインスタンスを、上記のシステムで入れ替えることにより、動的なスケールUP及びDOWNが実現できる。
In the present invention, replacement can be performed again, and as shown above, it is not necessary to migrate all DB data. In addition, since the SQL sentence from the Web application 111 is processed by the DB system (A) 130 or the DB system (B) 160 having synchronized data at any time, dynamic replacement can be realized.
As described above, dynamic scale UP and DOWN can be realized by replacing instances of different performances provided by IaaS with the above system.

100…IaaS、110…Webアプリ用インスタンス、111…Webアプリ、120…コントロール・プロキシ用インスタンス、121…コントロール部、122…制御プロキシ部、123…RDBMS、124…SQL文ストアX、130…DBシステム(A)、140…DBMS用インスタンス(A)、141…RDBMS−(A)、150…ストレージ(A)、151…SQL文ストアZ、152…DBデータ(A)、160…DBシステム(B)、170…DBMS用インスタンス(B)、171…RSBMS−(B)、180…ストレージ(B)、181…SQL文ストアY、182…DBデータ(B) DESCRIPTION OF SYMBOLS 100 ... IaaS, 110 ... Web application instance, 111 ... Web application, 120 ... Control proxy instance, 121 ... Control part, 122 ... Control proxy part, 123 ... RDBMS, 124 ... SQL sentence store X, 130 ... DB system (A), 140 ... DBMS instance (A), 141 ... RDBMS- (A), 150 ... storage (A), 151 ... SQL statement store Z, 152 ... DB data (A), 160 ... DB system (B) 170 ... DBMS instance (B), 171 ... RSBMS- (B), 180 ... storage (B), 181 ... SQL statement store Y, 182 ... DB data (B)

Claims (2)

第1および第2のリレーショナルデータベースが稼動する仮想マシンを備えたシステムにおけるインスタンスをスケールアップおよびスケールダウンさせる方法であって、
前記システムが、
第1および第2のリレーショナルデータベースに対し選択的にSQL文の送受信を中継する中継手段と、データ更新を行うSQL文のコピーを記憶する第1のステップと、データ更新を行うSQL文のコピーが記憶されているかいないかを判定する第2のステップと、その判定結果に基づきデータ更新を行うSQL文のコピーをインスタンスの入れ替え元の前記リレーショナルデータベースとは別の第2のリレーショナルデータベースへ送信して反映させ、第1、第2のリレーショナルデータベースに格納されたデータの同期をとる第3のステップと、両リレーショナルデータベースのデータの同期確立後に前記インスタンス入れ替え元のリレーショナルデータベースが稼動していたインスタンスを異なる性能のインスタンスに変更すると共に、入れ替え先のリレーショナルデータベースが稼動していたインスタンスを異なるインスタンスに変更する第4のステップとを備えることを特徴とするリレーショナルデータベースをスケールアップおよびスケールダウンさせる方法。
A method for scaling up and down an instance in a system with virtual machines on which first and second relational databases run, comprising:
The system is
A relay unit that selectively relays transmission / reception of SQL statements to / from the first and second relational databases, a first step of storing a copy of the SQL statement that updates data, and a copy of the SQL statement that updates data A second step for determining whether or not the data is stored, and a copy of the SQL statement for updating data based on the determination result is sent to a second relational database different from the relational database from which the instance is replaced The third step of reflecting and synchronizing the data stored in the first and second relational databases is different from the instance in which the relational database from which the instance was replaced was operating after the synchronization of the data of both relational databases was established. When changing to a performance instance, , How to scale up and scale down a relational database, characterized in that it comprises a fourth step of changing the instance relational database exchange destination was busy at different instances.
第1および第2のリレーショナルデータベースに対し選択的にSQL文の送受信を中継する中継手段と、データ更新を行うSQL文のコピーを記憶する第1の手段と、データ更新を行うSQL文のコピーが記憶されているかいないかを判定する手段と、その判定結果に基づきデータ更新を行うSQL文のコピーをインスタンスの入れ替え元の前記リレーショナルデータベースとは別の第2のリレーショナルデータベースへ送信して反映させ、第1、第2のリレーショナルデータベースに格納されたデータの同期をとる手段と、両リレーショナルデータベースのデータの同期確立後に前記インスタンス入れ替え元のリレーショナルデータベースが稼動していたインスタンスを異なる性能のインスタンスに変更すると共に、入れ替え先のリレーショナルデータベースが稼動していたインスタンスを異なるインスタンスに変更する手段とを備えることを特徴とするリレーショナルデータベースをスケールアップおよびスケールダウンさせるシステム。   There are relay means for selectively relaying transmission and reception of SQL statements to and from the first and second relational databases, first means for storing a copy of the SQL sentence for updating data, and a copy of the SQL sentence for updating data. A means for determining whether or not the data is stored, and a copy of the SQL statement for performing data update based on the determination result is transmitted to the second relational database different from the relational database from which the instance is replaced, and reflected; The means for synchronizing the data stored in the first and second relational databases and the instance in which the relational database from which the instance was replaced was established after the synchronization of the data in the two relational databases was established are changed to instances of different performance. Together with the destination relay System for scale up and scale down a relational database, characterized in that it comprises a means for changing the instance that the database was busy at different instances.
JP2010222316A 2010-09-30 2010-09-30 Method and system to scale up and scale down relational database Pending JP2012078993A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010222316A JP2012078993A (en) 2010-09-30 2010-09-30 Method and system to scale up and scale down relational database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010222316A JP2012078993A (en) 2010-09-30 2010-09-30 Method and system to scale up and scale down relational database

Publications (1)

Publication Number Publication Date
JP2012078993A true JP2012078993A (en) 2012-04-19

Family

ID=46239192

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010222316A Pending JP2012078993A (en) 2010-09-30 2010-09-30 Method and system to scale up and scale down relational database

Country Status (1)

Country Link
JP (1) JP2012078993A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101521475B1 (en) * 2013-10-24 2015-05-19 에스케이텔레콤 주식회사 Method and apparatus for virtualized value-add service
CN107665227A (en) * 2017-04-10 2018-02-06 平安科技(深圳)有限公司 A kind of data version control method and versions of data controller

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004094289A (en) * 2002-08-29 2004-03-25 Toshiba Tec Corp Access method to heterogeneous database and office computer using the method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004094289A (en) * 2002-08-29 2004-03-25 Toshiba Tec Corp Access method to heterogeneous database and office computer using the method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101521475B1 (en) * 2013-10-24 2015-05-19 에스케이텔레콤 주식회사 Method and apparatus for virtualized value-add service
CN107665227A (en) * 2017-04-10 2018-02-06 平安科技(深圳)有限公司 A kind of data version control method and versions of data controller
WO2018188196A1 (en) * 2017-04-10 2018-10-18 平安科技(深圳)有限公司 Data version control method, data version controller, device and computer-readable storage medium
CN107665227B (en) * 2017-04-10 2019-12-24 平安科技(深圳)有限公司 Data version control method and data version controller

Similar Documents

Publication Publication Date Title
US9031910B2 (en) System and method for maintaining a cluster setup
US9934242B2 (en) Replication of data between mirrored data sites
WO2017097059A1 (en) Distributed database system and self-adaptation method therefor
US9286298B1 (en) Methods for enhancing management of backup data sets and devices thereof
US20120130950A1 (en) Data replication to multiple data nodes
CN103078927A (en) Key-value data distributed caching system and method thereof
EP2859473A1 (en) Data management and indexing across a distributed database
KR20190049266A (en) Apparatus for controlling synchronization of metadata on network and method for the same
JPWO2013046352A1 (en) Computer system, data management method, and data management program
US11403319B2 (en) High-availability network device database synchronization
CN113010496B (en) Data migration method, device, equipment and storage medium
CN108897641B (en) Log analysis service real-time synchronization system under database master-slave environment
WO2014177085A1 (en) Distributed multicopy data storage method and device
Le et al. Dynastar: Optimized dynamic partitioning for scalable state machine replication
JP5287366B2 (en) Management server, backup method, backup method, and program
CN106897316B (en) Method and device for processing signaling data
CN110019484B (en) Database system, implementation method, management device, data interface device and medium
JP2012078993A (en) Method and system to scale up and scale down relational database
JP2014016953A (en) Unshared type database system, synchronizing device, database server, its synchronizing method, and synchronizing program
CN116383308A (en) Data synchronization method and system with full link back pressure characteristic
JP2012215937A (en) Scale-up/down method and system using stream type replication function of database
JP6237925B2 (en) Cluster system and cluster control method
Afonso Mechanisms for providing causal consistency on edge computing
JP2012185560A (en) Cluster system and method for controlling the same
JP2009211273A (en) File exchange device and file exchange method in information communication system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130131

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131225

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140110

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140502