YUKI Hiroshi
null+****@clear*****
Tue May 27 18:31:14 JST 2014
YUKI Hiroshi 2014-05-27 18:31:14 +0900 (Tue, 27 May 2014) New Revision: 742ac2c12a418c3f78138f946d19b7546acf6537 https://github.com/droonga/droonga.org/commit/742ac2c12a418c3f78138f946d19b7546acf6537 Message: Update translated versions of groonga tutorial Modified files: _po/ja/tutorial/1.0.3/add-replica/index.po _po/ja/tutorial/1.0.3/groonga/index.po ja/tutorial/1.0.3/add-replica/index.md ja/tutorial/1.0.3/groonga/index.md Modified: _po/ja/tutorial/1.0.3/add-replica/index.po (+391 -10) =================================================================== --- _po/ja/tutorial/1.0.3/add-replica/index.po 2014-05-27 18:16:14 +0900 (8ca3808) +++ _po/ja/tutorial/1.0.3/add-replica/index.po 2014-05-27 18:31:14 +0900 (0e79d8e) @@ -28,8 +28,8 @@ msgid "## The goal of this tutorial" msgstr "## チュートリアルのゴール" msgid "" -"Learning steps to add a new node to your existing [Droonga][] cluster, as a re" -"plica." +"Learning steps to add a new replica node, remove an existing replica, and repl" +"ace a replica with new one, for your existing [Droonga][] cluster." msgstr "" msgid "## Precondition" @@ -38,7 +38,7 @@ msgstr "## 前提条件" msgid "" "* You must have an existing Droonga cluster with some data.\n" " Please complete the [\"getting started\" tutorial](../groonga/) before this.\n" -"* You must know how to replicate data between multiple clusters.\n" +"* You must know how to duplicate data between multiple clusters.\n" " Please complete the [\"How to backup and restore the database?\" tutorial](../" "dump-restore/) before this." msgstr "" @@ -75,22 +75,401 @@ msgid "" "Here we go!" msgstr "" -msgid "## Setup a new node" +msgid "## Add a new replica node to an existing cluster" msgstr "" -msgid "TBD" +msgid "" +"In this case you don't have to stop the cluster working, for any read-only req" +"uests like \"search\".\n" +"You can add a new replica, in the backstage, without downing your service." +msgstr "" + +msgid "" +"On the other hand, you have to stop inpouring of new data to the cluster until" +" the new node starts working.\n" +"(In the future we'll provide mechanism to add new nodes completely silently wi" +"thout any stopping of data-flow, but currently can't.)" +msgstr "" + +msgid "" +"Assume that there is a Droonga cluster constructed with two replica nodes `192" +".168.0.10` and `192.168.0.11`, and we are going to add a new replica node `192" +".168.0.12`." +msgstr "" + +msgid "### Setup a new node" +msgstr "" + +msgid "First, prepare a new computer, install required softwares and configure them." +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # apt-get update\n" +" # apt-get -y upgrade\n" +" # apt-get install -y ruby ruby-dev build-essential nodejs npm\n" +" # gem install droonga-engine\n" +" # npm install -g droonga-http-server\n" +" # mkdir ~/droonga" +msgstr "" + +msgid "" +"Then, remember the command line you executed to generate `catalog.json` for yo" +"ur cluster.\n" +"It was:" +msgstr "" + +msgid "" +" (on 192.168.0.10 or 192.168.0.11)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11 \\\n" +" --output=~/droonga/catalog.json" +msgstr "" + +msgid "" +"For the new node, you have to generate a `custom.json` includes only one node," +" with same options except the `--host` option, like:" +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.12 \\\n" +" --output=~/droonga/catalog.json" +msgstr "" + +msgid "Let's start the server." +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # host=192.168.0.12\n" +" # droonga-engine --host=$host \\\n" +" --daemon \\\n" +" --pid-file=~/droonga/droonga-engine.pid\n" +" # droonga-http-server --port=10041 \\\n" +" --receive-host-name=$host \\\n" +" --droonga-engine-host-name=$host \\\n" +" --daemon \\\n" +" --pid-file=~/droonga/droonga-http-server.pid" +msgstr "" + +msgid "Then there are two separate Droonga clusters on this time." msgstr "" -msgid "## Stop inpouring of \"write\" requests" +msgid "" +" * The existing cluster including two replicas.\n" +" Let's give a name *\"alpha\"* to it, for now.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`\n" +" * The new cluster including just one replica.\n" +" Let's give a name *\"beta\"* to it, for now.\n" +" * `192.168.0.12`" +msgstr "" + +msgid "### Suspend inpouring of \"write\" requests" msgstr "" -msgid "## Replicate data from the cluster to the new replica" +msgid "" +"Before starting duplication of data, you must suspend inpouring of \"write\" re" +"quests to the cluster alpha, because we have to synchronize data in clusters a" +"lpha and beta completely.\n" +"Otherwise, the new added replica node will contain incomplete data.\n" +"Because data in replicas will be inconsistent, results for any request to the " +"cluster become unstable." msgstr "" -msgid "## Join the new replica to the cluster" +msgid "" +"What's \"write\" request?\n" +"In particular, these commands modify data in the cluster:" +msgstr "" + +msgid "" +" * `add`\n" +" * `column_create`\n" +" * `column_remove`\n" +" * `delete`\n" +" * `load`\n" +" * `table_create`\n" +" * `table_remove`" +msgstr "" + +msgid "" +"If you load new data via the `load` command triggered by a batch script starte" +"d as a cronjob, disable the job.\n" +"If a crawler agent adds new data via the `add` command, stop it.\n" +"If you put a fluentd as a buffer between crawler or loader and the cluster, st" +"op outgoing messages from the buffer." msgstr "" -msgid "## Restart inpouring of \"write\" requests" +msgid "### Duplicate data from the existing cluster to the new replica" +msgstr "" + +msgid "" +"Duplicate data from the cluster alpha to the cluster beta.\n" +"It can be done by `drndump` and `droonga-request` commands.\n" +"(You have to install `drndump` and `droonga-client` gem packages.)" +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # drndump --host=192.168.0.10 \\\n" +" --receiver-host=192.168.0.12 | \\\n" +" droonga-request --host=192.168.0.12 \\\n" +" --receiver-host=192.168.0.12" +msgstr "" + +msgid "" +"Note that you must specify the host name or the IP address of the machine via " +"the `--receiver-host` option.\n" +"If you run the command line on the node `192.168.0.11`, then:" +msgstr "" + +msgid "" +" (on 192.168.0.11)\n" +" # drndump --host=192.168.0.10 \\\n" +" --receiver-host=192.168.0.11 | \\\n" +" droonga-request --host=192.168.0.12 \\\n" +" --receiver-host=192.168.0.11" +msgstr "" + +msgid "### Join the new replica to the cluster" +msgstr "" + +msgid "" +"After the duplication is successfully done, join the new replica to the existi" +"ng clster.\n" +"Re-generate the `catalog.json` on the newly joining node `192.168.0.12`, with " +"all nodes specified via the `--hosts` option, like:" +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11,192.16" +"8.0.12 \\\n" +" --output=~/droonga/catalog.json" +msgstr "" + +msgid "" +"The server process detects new `catalog.json` and restats itself automatically" +"." +msgstr "" + +msgid "Then there are two overlapping Droonga clusters theoretically on this time." +msgstr "" + +msgid "" +" * The existing cluster \"alpha\", including two replicas.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`\n" +" * The new cluster including three replicas.\n" +" Let's give a name *\"charlie\"* to it, for now.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`\n" +" * `192.168.0.12`" +msgstr "" + +msgid "" +"Note that the temporary cluster named \"beta\" is gone.\n" +"And, the new node `192.168.0.12` knows the cluster charlie includes three node" +"s, other two existing nodes don't know that.\n" +"Because both two existing nodes think that there are only them in the cluster " +"they belong to, any incoming request to them never delivered to the new replic" +"a `192.168.0.12` yet." +msgstr "" + +msgid "Next, copy new `catalog.json` from `192.168.0.12` to others." +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # scp ~/droonga/catalog.json 192.168.0.10:~/droonga/\n" +" # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/" +msgstr "" + +msgid "Servers detect new `catalog.json` and restart themselves automatically." +msgstr "" + +msgid "Then there are just one Droonga clusters on this time." +msgstr "" + +msgid "" +" * The new cluster \"charlie\",including three replicas.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`\n" +" * `192.168.0.12`" +msgstr "" + +msgid "" +"Note that the old cluster named \"alpha\" is gone.\n" +"Now the new cluster \"charlie\" with three replicas works perfectly, instead of " +"the old one with two replicas." +msgstr "" + +msgid "### Resume inpouring of \"write\" requests" +msgstr "" + +msgid "" +"OK, it's the time.\n" +"Because all replica nodes are completely synchronized, the cluster now can pro" +"cess any request stably.\n" +"Resume inpouring of requests which can modify the data in the cluster - cronjo" +"bs, crawlers, buffers, and so on." +msgstr "" + +msgid "With that, a new replica node has joined to your Droonga cluster successfully." +msgstr "" + +msgid "## Remove an existing replica node from an existing cluster" +msgstr "" + +msgid "" +"A Droonga node can die by various fatal reasons - for example, OOM killer, dis" +"k-full error, troubles around its hardware, etc.\n" +"Because nodes in a Droonga cluster observe each other and they stop delivering" +" messages to dead nodes automatically, the cluster keeps working even if there" +" are some dead nodes.\n" +"Then you have to remove dead nodes from the cluster." +msgstr "" + +msgid "" +"Of course, even if a node is still working, you may plan to remove it to reuse" +" for another purpose." +msgstr "" + +msgid "" +"Assume that there is a Droonga cluster constructed with trhee replica nodes `1" +"92.168.0.10`, `192.168.0.11` and `192.168.0.12`, and planning to remove the la" +"st node `192.168.0.12` from the cluster." +msgstr "" + +msgid "### Unjoin an existing replica from the cluster" +msgstr "" + +msgid "" +"To remove a replica from an existing cluster, you just have to update the \"cat" +"alog.json\" with new list of replica nodes except the node to be removed:" +msgstr "" + +msgid "" +" (on 192.168.0.10)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11 \\\n" +" --output=~/droonga/catalog.json" +msgstr "" + +msgid "" +" * The existing cluster \"charlie\" including three replicas.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`\n" +" * `192.168.0.12`\n" +" * The new cluster including two replicas.\n" +" Let's give a name *\"delta\"* to it, for now.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`" +msgstr "" + +msgid "" +"The node `192.168.0.10` with new `catalog.json` knows the cluster delta includ" +"es only two nodes, so it doesn't deliver incoming messages to the missing node" +" `192.168.0.12` anymore." +msgstr "" + +msgid "Next, copy new `catalog.json` from `192.168.0.10` to others." +msgstr "" + +msgid "" +" (on 192.168.0.10)\n" +" # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/\n" +" # scp ~/droonga/catalog.json 192.168.0.12:~/droonga/" +msgstr "" + +msgid "Then there is only one Droonga cluster on this time." +msgstr "" + +msgid "" +" * The new cluster \"delta\" including two replicas.\n" +" * `192.168.0.10`\n" +" * `192.168.0.11`" +msgstr "" + +msgid "" +"Even if both nodes `192.168.0.11` and `192.168.0.12` receive requests, they ar" +"e delivered to the nodes of the cluster delta.\n" +"The orphan node `192.168.0.12` never process requests by self." +msgstr "" + +msgid "" +"OK, the node is ready to be removed.\n" +"Stop servers and shutdown it if needed." +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # kill $(cat ~/droonga/droonga-engine.pid)\n" +" # kill $(cat ~/droonga/droonga-http-server.pid)" +msgstr "" + +msgid "## Replace an existing replica node in a cluster with a new one" +msgstr "" + +msgid "Replacing of nodes is a combination of those instructions above." +msgstr "" + +msgid "" +"Assume that there is a Droonga cluster constructed with two replica nodes `192" +".168.0.10` and `192.168.0.11`, the node `192.168.0.11` is unstable, and planni" +"ng to replace it with a new node `192.168.0.12`." +msgstr "" + +msgid "" +"First, remove the unstable node.\n" +"Re-generate `catalog.json` without the node to be removed, and spread it to ot" +"her nodes in the cluster:" +msgstr "" + +msgid "" +" (on 192.168.0.10)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.10 \\\n" +" --output=~/droonga/catalog.json\n" +" # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/" +msgstr "" + +msgid "After that the node `192.168.0.11` unjoins from the cluster successfully." +msgstr "" + +msgid "### Add a new replica" +msgstr "" + +msgid "" +"Next, setup the new replica.\n" +"Construct a temporary cluster with only one node, and duplicate data from the " +"existing cluster:" +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.12 \\\n" +" --output=~/droonga/catalog.json\n" +" # drndump --host=192.168.0.10 \\\n" +" --receiver-host=192.168.0.12 | \\\n" +" droonga-request --host=192.168.0.12 \\\n" +" --receiver-host=192.168.0.12" +msgstr "" + +msgid "" +"After the duplication successfully finished, the node is ready to join the clu" +"ster.\n" +"Re-generate `catalog.json` and spread it to all nodes in the cluster:" +msgstr "" + +msgid "" +" (on 192.168.0.12)\n" +" # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.12 \\\n" +" --output=~/droonga/catalog.json\n" +" # scp ~/droonga/catalog.json 192.168.0.10:~/droonga/" +msgstr "" + +msgid "" +"Finally a Droonga cluster constructed with two nodes `192.168.0.10` and `192.1" +"68.0.12` is here." msgstr "" msgid "## Conclusion" @@ -98,7 +477,9 @@ msgstr "## まとめ" msgid "" "In this tutorial, you did add a new replica node to an existing [Droonga][] cl" -"uster." +"uster.\n" +"Moreover, you did remove an existing replica, and did replace a replica with a" +" new one." msgstr "" msgid "" Modified: _po/ja/tutorial/1.0.3/groonga/index.po (+13 -5) =================================================================== --- _po/ja/tutorial/1.0.3/groonga/index.po 2014-05-27 18:16:14 +0900 (394a6eb) +++ _po/ja/tutorial/1.0.3/groonga/index.po 2014-05-27 18:31:14 +0900 (7218e1d) @@ -291,16 +291,18 @@ msgid "" msgstr "" msgid "### Create a table" -msgstr "" +msgstr "### テーブルの作成" msgid "Now your Droonga cluster actually works as a Groonga's HTTP server." -msgstr "" +msgstr "以上の手順で、Groonga HTTPサーバ互換のサービスとして動作するDroongaクラスタができました。" msgid "" "Requests are completely same to ones for a Groonga server.\n" "To create a new table `Store`, you just have to send a GET request for the `ta" "ble_create` command, like:" msgstr "" +"リクエストの送信方法はGroongaサーバの場合と全く同じです。\n" +"新しいテーブル `Store` を作るには、`table_create` コマンドにあたるGETリクエストを送信して下さい:" msgid "" " # endpoint=\"http://192.168.0.10:10041/d\"\n" @@ -314,11 +316,17 @@ msgid "" "In other words, you can use any favorite node in the cluster as an endpoint.\n" "All requests will be distributed to suitable nodes in the cluster." msgstr "" +"リクエストの送信先として、Droongaノード中でdroonga-http-serverが動作しているDroongaノードのどれか1つを指定する必要がある事" +"に注意して下さい。\n" +"言い換えると、接続先(エンドポイント)としてはクラスタ中のどのノードでも好きな物を使う事ができます。\n" +"すべてのリクエストは、クラスタ中の適切なノードに配送されます。" msgid "" "OK, now the table has been created successfully.\n" "Let's see it by the `table_list` command:" msgstr "" +"さて、テーブルを正しく作成できました。\n" +"`table_list` コマンドを使って、作成されたテーブルの情報を見てみましょう:" msgid "" " # curl \"${endpoint}/table_list\"\n" @@ -330,7 +338,7 @@ msgid "" msgstr "" msgid "Because it is a cluster, another endpoint returns same result." -msgstr "" +msgstr "Droongaはクラスタで動作するので、他のエンドポイントも同じ結果を返します。" msgid "" " # curl \"http://192.168.0.11:10041/d/table_list\"\n" @@ -342,7 +350,7 @@ msgid "" msgstr "" msgid "### Create a column" -msgstr "" +msgstr "### カラムの作成" msgid "" "Next, create a new column `location` to the `Store` table by the `column_creat" @@ -517,7 +525,7 @@ msgstr "" msgid "" "Next, let's learn [how to backup and restore contents of a Droonga cluster](.." -"/dump-restore/)." +"/restore/)." msgstr "" msgid "" Modified: ja/tutorial/1.0.3/add-replica/index.md (+241 -12) =================================================================== --- ja/tutorial/1.0.3/add-replica/index.md 2014-05-27 18:16:14 +0900 (8e1f4d1) +++ ja/tutorial/1.0.3/add-replica/index.md 2014-05-27 18:31:14 +0900 (e95193d) @@ -17,13 +17,13 @@ layout: ja ## チュートリアルのゴール -Learning steps to add a new node to your existing [Droonga][] cluster, as a replica. +Learning steps to add a new replica node, remove an existing replica, and replace a replica with new one, for your existing [Droonga][] cluster. ## 前提条件 * You must have an existing Droonga cluster with some data. Please complete the ["getting started" tutorial](../groonga/) before this. -* You must know how to replicate data between multiple clusters. +* You must know how to duplicate data between multiple clusters. Please complete the ["How to backup and restore the database?" tutorial](../dump-restore/) before this. ## What's "replica"? @@ -42,29 +42,258 @@ We'll improve extensibility for slices in the future. Anyway, this tutorial explains how to add a new replica node to an existing Droogna cluster. Here we go! -## Setup a new node +## Add a new replica node to an existing cluster -TBD +In this case you don't have to stop the cluster working, for any read-only requests like "search". +You can add a new replica, in the backstage, without downing your service. -## Stop inpouring of "write" requests +On the other hand, you have to stop inpouring of new data to the cluster until the new node starts working. +(In the future we'll provide mechanism to add new nodes completely silently without any stopping of data-flow, but currently can't.) -TBD +Assume that there is a Droonga cluster constructed with two replica nodes `192.168.0.10` and `192.168.0.11`, and we are going to add a new replica node `192.168.0.12`. -## Replicate data from the cluster to the new replica +### Setup a new node -TBD +First, prepare a new computer, install required softwares and configure them. -## Join the new replica to the cluster + (on 192.168.0.12) + # apt-get update + # apt-get -y upgrade + # apt-get install -y ruby ruby-dev build-essential nodejs npm + # gem install droonga-engine + # npm install -g droonga-http-server + # mkdir ~/droonga -TBD +Then, remember the command line you executed to generate `catalog.json` for your cluster. +It was: -## Restart inpouring of "write" requests + (on 192.168.0.10 or 192.168.0.11) + # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11 \ + --output=~/droonga/catalog.json + +For the new node, you have to generate a `custom.json` includes only one node, with same options except the `--host` option, like: + + (on 192.168.0.12) + # droonga-engine-catalog-generate --hosts=192.168.0.12 \ + --output=~/droonga/catalog.json + +Let's start the server. + + (on 192.168.0.12) + # host=192.168.0.12 + # droonga-engine --host=$host \ + --daemon \ + --pid-file=~/droonga/droonga-engine.pid + # droonga-http-server --port=10041 \ + --receive-host-name=$host \ + --droonga-engine-host-name=$host \ + --daemon \ + --pid-file=~/droonga/droonga-http-server.pid + +Then there are two separate Droonga clusters on this time. + + * The existing cluster including two replicas. + Let's give a name *"alpha"* to it, for now. + * `192.168.0.10` + * `192.168.0.11` + * The new cluster including just one replica. + Let's give a name *"beta"* to it, for now. + * `192.168.0.12` + +### Suspend inpouring of "write" requests + +Before starting duplication of data, you must suspend inpouring of "write" requests to the cluster alpha, because we have to synchronize data in clusters alpha and beta completely. +Otherwise, the new added replica node will contain incomplete data. +Because data in replicas will be inconsistent, results for any request to the cluster become unstable. + +What's "write" request? +In particular, these commands modify data in the cluster: + + * `add` + * `column_create` + * `column_remove` + * `delete` + * `load` + * `table_create` + * `table_remove` + +If you load new data via the `load` command triggered by a batch script started as a cronjob, disable the job. +If a crawler agent adds new data via the `add` command, stop it. +If you put a fluentd as a buffer between crawler or loader and the cluster, stop outgoing messages from the buffer. + +### Duplicate data from the existing cluster to the new replica + +Duplicate data from the cluster alpha to the cluster beta. +It can be done by `drndump` and `droonga-request` commands. +(You have to install `drndump` and `droonga-client` gem packages.) + + (on 192.168.0.12) + # drndump --host=192.168.0.10 \ + --receiver-host=192.168.0.12 | \ + droonga-request --host=192.168.0.12 \ + --receiver-host=192.168.0.12 + +Note that you must specify the host name or the IP address of the machine via the `--receiver-host` option. +If you run the command line on the node `192.168.0.11`, then: + + (on 192.168.0.11) + # drndump --host=192.168.0.10 \ + --receiver-host=192.168.0.11 | \ + droonga-request --host=192.168.0.12 \ + --receiver-host=192.168.0.11 + +### Join the new replica to the cluster + +After the duplication is successfully done, join the new replica to the existing clster. +Re-generate the `catalog.json` on the newly joining node `192.168.0.12`, with all nodes specified via the `--hosts` option, like: + + (on 192.168.0.12) + # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11,192.168.0.12 \ + --output=~/droonga/catalog.json + +The server process detects new `catalog.json` and restats itself automatically. + +Then there are two overlapping Droonga clusters theoretically on this time. + + * The existing cluster "alpha", including two replicas. + * `192.168.0.10` + * `192.168.0.11` + * The new cluster including three replicas. + Let's give a name *"charlie"* to it, for now. + * `192.168.0.10` + * `192.168.0.11` + * `192.168.0.12` + +Note that the temporary cluster named "beta" is gone. +And, the new node `192.168.0.12` knows the cluster charlie includes three nodes, other two existing nodes don't know that. +Because both two existing nodes think that there are only them in the cluster they belong to, any incoming request to them never delivered to the new replica `192.168.0.12` yet. + +Next, copy new `catalog.json` from `192.168.0.12` to others. + + (on 192.168.0.12) + # scp ~/droonga/catalog.json 192.168.0.10:~/droonga/ + # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/ + +Servers detect new `catalog.json` and restart themselves automatically. + +Then there are just one Droonga clusters on this time. + + * The new cluster "charlie",including three replicas. + * `192.168.0.10` + * `192.168.0.11` + * `192.168.0.12` + +Note that the old cluster named "alpha" is gone. +Now the new cluster "charlie" with three replicas works perfectly, instead of the old one with two replicas. + +### Resume inpouring of "write" requests + +OK, it's the time. +Because all replica nodes are completely synchronized, the cluster now can process any request stably. +Resume inpouring of requests which can modify the data in the cluster - cronjobs, crawlers, buffers, and so on. + +With that, a new replica node has joined to your Droonga cluster successfully. + + +## Remove an existing replica node from an existing cluster + +A Droonga node can die by various fatal reasons - for example, OOM killer, disk-full error, troubles around its hardware, etc. +Because nodes in a Droonga cluster observe each other and they stop delivering messages to dead nodes automatically, the cluster keeps working even if there are some dead nodes. +Then you have to remove dead nodes from the cluster. + +Of course, even if a node is still working, you may plan to remove it to reuse for another purpose. + +Assume that there is a Droonga cluster constructed with trhee replica nodes `192.168.0.10`, `192.168.0.11` and `192.168.0.12`, and planning to remove the last node `192.168.0.12` from the cluster. + +### Unjoin an existing replica from the cluster + +To remove a replica from an existing cluster, you just have to update the "catalog.json" with new list of replica nodes except the node to be removed: + + (on 192.168.0.10) + # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.11 \ + --output=~/droonga/catalog.json + +Then there are two overlapping Droonga clusters theoretically on this time. + + * The existing cluster "charlie" including three replicas. + * `192.168.0.10` + * `192.168.0.11` + * `192.168.0.12` + * The new cluster including two replicas. + Let's give a name *"delta"* to it, for now. + * `192.168.0.10` + * `192.168.0.11` + +The node `192.168.0.10` with new `catalog.json` knows the cluster delta includes only two nodes, so it doesn't deliver incoming messages to the missing node `192.168.0.12` anymore. + +Next, copy new `catalog.json` from `192.168.0.10` to others. + + (on 192.168.0.10) + # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/ + # scp ~/droonga/catalog.json 192.168.0.12:~/droonga/ + +Then there is only one Droonga cluster on this time. + + * The new cluster "delta" including two replicas. + * `192.168.0.10` + * `192.168.0.11` + +Even if both nodes `192.168.0.11` and `192.168.0.12` receive requests, they are delivered to the nodes of the cluster delta. +The orphan node `192.168.0.12` never process requests by self. + +OK, the node is ready to be removed. +Stop servers and shutdown it if needed. + + (on 192.168.0.12) + # kill $(cat ~/droonga/droonga-engine.pid) + # kill $(cat ~/droonga/droonga-http-server.pid) + +## Replace an existing replica node in a cluster with a new one + +Replacing of nodes is a combination of those instructions above. + +Assume that there is a Droonga cluster constructed with two replica nodes `192.168.0.10` and `192.168.0.11`, the node `192.168.0.11` is unstable, and planning to replace it with a new node `192.168.0.12`. + +### Unjoin an existing replica from the cluster + +First, remove the unstable node. +Re-generate `catalog.json` without the node to be removed, and spread it to other nodes in the cluster: + + (on 192.168.0.10) + # droonga-engine-catalog-generate --hosts=192.168.0.10 \ + --output=~/droonga/catalog.json + # scp ~/droonga/catalog.json 192.168.0.11:~/droonga/ + +After that the node `192.168.0.11` unjoins from the cluster successfully. + +### Add a new replica + +Next, setup the new replica. +Construct a temporary cluster with only one node, and duplicate data from the existing cluster: + + (on 192.168.0.12) + # droonga-engine-catalog-generate --hosts=192.168.0.12 \ + --output=~/droonga/catalog.json + # drndump --host=192.168.0.10 \ + --receiver-host=192.168.0.12 | \ + droonga-request --host=192.168.0.12 \ + --receiver-host=192.168.0.12 + +After the duplication successfully finished, the node is ready to join the cluster. +Re-generate `catalog.json` and spread it to all nodes in the cluster: + + (on 192.168.0.12) + # droonga-engine-catalog-generate --hosts=192.168.0.10,192.168.0.12 \ + --output=~/droonga/catalog.json + # scp ~/droonga/catalog.json 192.168.0.10:~/droonga/ + +Finally a Droonga cluster constructed with two nodes `192.168.0.10` and `192.168.0.12` is here. -TBD ## まとめ In this tutorial, you did add a new replica node to an existing [Droonga][] cluster. +Moreover, you did remove an existing replica, and did replace a replica with a new one. [Ubuntu]: http://www.ubuntu.com/ [Droonga]: https://droonga.org/ Modified: ja/tutorial/1.0.3/groonga/index.md (+11 -11) =================================================================== --- ja/tutorial/1.0.3/groonga/index.md 2014-05-27 18:16:14 +0900 (01f2b43) +++ ja/tutorial/1.0.3/groonga/index.md 2014-05-27 18:31:14 +0900 (afb3c84) @@ -143,33 +143,33 @@ GroongaをHTTPサーバとして使う場合は、以下のように `-d` オプ # kill $(cat ~/droonga/droonga-engine.pid) # kill $(cat ~/droonga/droonga-http-server.pid) -### Create a table +### テーブルの作成 -Now your Droonga cluster actually works as a Groonga's HTTP server. +以上の手順で、Groonga HTTPサーバ互換のサービスとして動作するDroongaクラスタができました。 -Requests are completely same to ones for a Groonga server. -To create a new table `Store`, you just have to send a GET request for the `table_create` command, like: +リクエストの送信方法はGroongaサーバの場合と全く同じです。 +新しいテーブル `Store` を作るには、`table_create` コマンドにあたるGETリクエストを送信して下さい: # endpoint="http://192.168.0.10:10041/d" # curl "${endpoint}/table_create?name=Store&type=Hash&key_type=ShortText" [[0,1398662266.3853862,0.08530688285827637],true] -Note that you have to specify the host, one of Droonga nodes with active droonga-http-server, in your Droonga cluster. -In other words, you can use any favorite node in the cluster as an endpoint. -All requests will be distributed to suitable nodes in the cluster. +リクエストの送信先として、Droongaノード中でdroonga-http-serverが動作しているDroongaノードのどれか1つを指定する必要がある事に注意して下さい。 +言い換えると、接続先(エンドポイント)としてはクラスタ中のどのノードでも好きな物を使う事ができます。 +すべてのリクエストは、クラスタ中の適切なノードに配送されます。 -OK, now the table has been created successfully. -Let's see it by the `table_list` command: +さて、テーブルを正しく作成できました。 +`table_list` コマンドを使って、作成されたテーブルの情報を見てみましょう: # curl "${endpoint}/table_list" [[0,1398662423.509928,0.003869295120239258],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]],[256,"Store","/home/username/groonga/droonga-engine/000/db.0000100","TABLE_HASH_KEY|PERSISTENT","ShortText",null,null,null]]] -Because it is a cluster, another endpoint returns same result. +Droongaはクラスタで動作するので、他のエンドポイントも同じ結果を返します。 # curl "http://192.168.0.11:10041/d/table_list" [[0,1398662423.509928,0.003869295120239258],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["default_tokenizer","ShortText"],["normalizer","ShortText"]],[256,"Store","/home/username/groonga/droonga-engine/000/db.0000100","TABLE_HASH_KEY|PERSISTENT","ShortText",null,null,null]]] -### Create a column +### カラムの作成 Next, create a new column `location` to the `Store` table by the `column_create` command, like: -------------- next part -------------- HTML����������������������������...Download