YUKI Hiroshi
null+****@clear*****
Mon Apr 28 19:57:41 JST 2014
YUKI Hiroshi 2014-04-28 19:57:41 +0900 (Mon, 28 Apr 2014) New Revision: 6273d4c04894e3b4b39703d9a0b84f357caf1c8c https://github.com/droonga/droonga.org/commit/6273d4c04894e3b4b39703d9a0b84f357caf1c8c Message: Update translations Added files: _po/ja/tutorial/groonga/index.po ja/tutorial/groonga/index.md Modified files: _po/ja/reference/commands/index.po _po/ja/reference/commands/select/index.po _po/ja/tutorial/basic/index.po _po/ja/tutorial/index.po ja/reference/commands/index.md ja/reference/commands/select/index.md ja/tutorial/basic/index.md ja/tutorial/index.md Modified: _po/ja/reference/commands/index.po (+7 -2) =================================================================== --- _po/ja/reference/commands/index.po 2014-04-28 19:47:06 +0900 (5fed8d8) +++ _po/ja/reference/commands/index.po 2014-04-28 19:57:41 +0900 (897962f) @@ -37,7 +37,12 @@ msgstr "## Groonga互換コマンド" msgid "" " * [select](select/)\n" +" * [column_create](column-create/)\n" +" * [column_list](column-list/)\n" +" * [column_remove](column-remove/)\n" +" * [column_rename](column-rename/)\n" +" * [delete](delete/)\n" " * [table_create](table-create/)\n" -" * [table_remove](table-remove/)\n" -" * [column_create](column-create/)" +" * [table_list](table-list/)\n" +" * [table_remove](table-remove/)" msgstr "" Modified: _po/ja/reference/commands/select/index.po (+7 -1) =================================================================== --- _po/ja/reference/commands/select/index.po 2014-04-28 19:47:06 +0900 (9573177) +++ _po/ja/reference/commands/select/index.po 2014-04-28 19:57:41 +0900 (88a1ecc) @@ -137,9 +137,15 @@ msgid "" " * `table`\n" " * `match_columns`\n" " * `query`\n" +" * `filter`\n" " * `output_columns`\n" " * `offset`\n" -" * `limit`" +" * `limit`\n" +" * `drilldown`\n" +" * `drilldown_output_columns`\n" +" * `drilldown_sortby`\n" +" * `drilldown_offset`\n" +" * `drilldown_limit`" msgstr "" msgid "" Modified: _po/ja/tutorial/basic/index.po (+64 -99) =================================================================== --- _po/ja/tutorial/basic/index.po 2014-04-28 19:47:06 +0900 (f49a72d) +++ _po/ja/tutorial/basic/index.po 2014-04-28 19:57:41 +0900 (e61a10a) @@ -74,15 +74,17 @@ msgid "" msgstr "Droonga Engine は Droonga における分散データ処理の要となるコンポーネントです。リクエストに基いて実際のデータ処理を行います。" msgid "" -"This component is developed as a [Fluentd] plugin, and released as the [fluent" -"-plugin-droonga][] package.\n" -"It internally uses [Groonga][] as its search engine. Groonga is an open source" -", fulltext search engine, including a column-store feature." +"This component is developed and released as the [droonga-engine][].\n" +"The protocol is compatible to [Fluentd]." msgstr "" -"このコンポーネントは [Fluentd] のプラグインとして実装されており、 [fluent-plugin-droonga][] パッケージとして提供されま" -"す。\n" -"[fluent-plugin-droonga][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使" -"用しています。" +"このコンポーネントは[droonga-engine][]という名前で開発およびリリースされています。\n" +"通信に使用するプロトコルは[Fluentd]と互換性があります。" + +msgid "" +"It internally uses [Groonga][] as its search engine.\n" +"Groonga is an open source, fulltext search engine, including a column-store fe" +"ature." +msgstr "[droonga-engine][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使用しています。" msgid "#### Protocol Adapter" msgstr "" @@ -124,10 +126,9 @@ msgid "" "gine |\n" " +-------------+ HTTP +------------------+ Fluent +-----------" "-----+\n" -" w/droonga-http protocol w/fluent-plu" -"gin\n" -" -server -dr" -"oonga" +" w/droonga-http protocol w/droonga-en" +"gine\n" +" -server" msgstr "" msgid "" @@ -180,6 +181,9 @@ msgstr "" "注意:Droongaが必要とするパッケージをインストールする前に、マシンが2GB以上のメモリを備えていることを確認して下さい。メモリが不足していると、ビルド" "時にエラーが出て、ビルドに失敗することがあります。" +msgid "Assume that the host is `192.168.0.10`." +msgstr "ホストが `192.168.0.10` だと仮定します。" + msgid "## Install packages required for the setup process" msgstr "## セットアップに必要なパッケージをインストールする" @@ -198,16 +202,16 @@ msgstr "## Droonga Engine を構築する" msgid "" "The part \"Droonga engine\" stores the database and provides the search feature " "actually.\n" -"In this section we install a fluent-plugin-droonga and load searchable data to" -" the database." +"In this section we install a droonga-engine and load searchable data to the da" +"tabase." msgstr "" "Droonga Engine は、データベースを保持し、実際の検索を担当する部分です。\n" -"このセクションでは、 fluent-plugin-droonga をインストールし、検索対象となるデータを準備します。" +"このセクションでは、 droonga-engine をインストールし、検索対象となるデータを準備します。" -msgid "### Install a fluent-plugin-droonga and droonga-client" -msgstr "### fluent-plugin-droongaとdroonga-clientをインストールする" +msgid "### Install a droonga-engine and droonga-client" +msgstr "### droonga-engineとdroonga-clientをインストールする" -msgid " # gem install fluent-plugin-droonga droonga-client" +msgid " # gem install droonga-engine droonga-client" msgstr "" msgid "" @@ -227,26 +231,9 @@ msgid "" msgstr "" msgid "" -"Next, put configuration files `fluentd.conf` and `catalog.json` like following" -", into the directory:" -msgstr "以下の内容で `fluentd.conf` と `catalog.json` を作成します。" - -msgid "fluentd.conf:" -msgstr "" - -msgid "" -" <source>\n" -" type forward\n" -" port 24224\n" -" </source>\n" -" <match starbucks.message>\n" -" name localhost:24224/starbucks\n" -" type droonga\n" -" </match>\n" -" <match output.message>\n" -" type stdout\n" -" </match>" -msgstr "" +"Next, put a configuration file `catalog.json` like following, into the directo" +"ry:" +msgstr "以下の内容で `catalog.json` を作成します。" msgid "catalog.json:" msgstr "" @@ -307,17 +294,17 @@ msgid "" " \"slices\": [\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.000\"\n" +" \"address\": \"192.168.0.10:10031/droonga.000\"\n" " }\n" " },\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.001\"\n" +" \"address\": \"192.168.0.10:10031/droonga.001\"\n" " }\n" " },\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.002\"\n" +" \"address\": \"192.168.0.10:10031/droonga.002\"\n" " }\n" " }\n" " ]\n" @@ -328,17 +315,17 @@ msgid "" " \"slices\": [\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.010\"\n" +" \"address\": \"192.168.0.10:10031/droonga.010\"\n" " }\n" " },\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.011\"\n" +" \"address\": \"192.168.0.10:10031/droonga.011\"\n" " }\n" " },\n" " {\n" " \"volume\": {\n" -" \"address\": \"localhost:24224/starbucks.012\"\n" +" \"address\": \"192.168.0.10:10031/droonga.012\"\n" " }\n" " }\n" " ]\n" @@ -367,8 +354,8 @@ msgid "" "These six atomic volumes having `\"address\"` information are internally called " "as *single volume*s.\n" "The `\"address\"` indicates the location of the corresponding physical storage w" -"hich is a database for Groonga, they are managed by `fluent-plugin-droonga` in" -"stances automatically." +"hich is a database for Groonga, they are managed by `droonga-engine` instances" +" automatically." msgstr "" "これらの6つの、`\"address\"`の情報を持つ最小単位のボリュームは、内部的に*シングル・ボリューム*と呼ばれます。\n" "`\"address\"`の情報は、対応する物理的なストレージであるGroongaのデータベースの位置を示していて、それらのデータベースは`fluent-plu" @@ -379,63 +366,37 @@ msgid "" "manual of catalog.json](/reference/catalog)." msgstr "`catalog.json` の詳細については [catalog.json](/ja/reference/catalog) を参照してください。" -msgid "### Start an instance of fluent-plugin-droonga" -msgstr "### fluent-plugin-droonga を起動する" +msgid "### Start an instance of droonga-engine" +msgstr "### droonga-engine を起動する" msgid "" -"Start a Droonga engine, it is a fluentd server with fluentd-plugin-droonga sta" -"rted like:" -msgstr "以下のようにして fluentd-plugin-droonga を起動します。" +"Start a Droonga engine, you can start it with the command `droonga-engine`, li" +"ke:" +msgstr "以下のようにして droonga-engine を起動します。" msgid "" -" # fluentd --config fluentd.conf --log fluentd.log --daemon fluentd.pid\n" -" # tail -F fluentd.log\n" -" </match>\n" -" <match output.message>\n" -" type stdout\n" -" </match>\n" -" </ROOT>\n" -" 2014-02-09 14:37:08 +0900 [info]: adding source type=\"forward\"\n" -" 2014-02-09 14:37:08 +0900 [info]: adding match pattern=\"starbucks.message\"" -" type=\"droonga\"\n" -" 2014-02-09 14:37:08 +0900 [info]: adding match pattern=\"output.message\" ty" -"pe=\"stdout\"\n" -" 2014-02-09 14:37:08 +0900 [info]: catalog loaded path=\"/tmp/engine/catalog" -".json\" mtime=2014-02-09 14:29:22 +0900\n" -" 2014-02-09 14:37:08 +0900 [info]: listening fluent socket on 0.0.0.0:24224" +" # droonga-engine --host 192.168.0.10 --log-file=$PWD/droonga-engine.log --" +"daemon --pid-file $PWD/droonga-engine.pid" msgstr "" -msgid "### Stop an instance of fluent-plugin-droonga" -msgstr "### fluent-plugin-droonga を終了する" +msgid "### Stop an instance of droonga-engine" +msgstr "### droonga-engine を終了する" -msgid "First, you need to know how to stop fluent-plugin-droonga." -msgstr "最初にfluent-plugin-droongaを終了する方法を知っておきましょう。" +msgid "First, you need to know how to stop droonga-engine." +msgstr "最初にdroonga-engineを終了する方法を知っておきましょう。" msgid "Send SIGTERM to fluentd:" msgstr "fluentdにSIGTERMを送ります。" -msgid " # kill $(cat fluentd.pid)" +msgid " # kill $(cat droonga-engine.pid)" msgstr "" -msgid "You will see the following message at `tail -F fluentd.log` terminal:" -msgstr "`tail -F fluentd.log` を実行しているターミナルに次のメッセージがでているはずです。" - -msgid "" -" # tail -F fluentd.log\n" -" ...\n" -" 2014-02-09 14:39:27 +0900 [info]: shutting down fluentd\n" -" 2014-02-09 14:39:30 +0900 [info]: process finished code=0" -msgstr "" +msgid "This is the way to stop droonga-engine." +msgstr "これがdroonga-engineを終了する方法です。" -msgid "This is the way to stop fluent-plugin-droonga." -msgstr "これがfluent-plugin-droongaを終了する方法です。" - -msgid "Start fluent-plugin-droonga again:" +msgid "Start droonga-engine again:" msgstr "再度fluent-plugin-droongaを起動します。" -msgid " # fluentd --config fluentd.conf --log fluentd.log --daemon fluentd.pid" -msgstr "" - msgid "### Create a database" msgstr "### データベースを作成する" @@ -1390,7 +1351,7 @@ msgstr "Droonga Engine にリクエストを送信します:" msgid "" "~~~\n" -"# droonga-request --tag starbucks search-all-stores.json\n" +"# droonga-request search-all-stores.json\n" "Elapsed time: 0.008286785\n" "[\n" " \"droonga.message\",\n" @@ -1558,8 +1519,12 @@ msgid "Then, run it." msgstr "次に、サーバを起動します。" msgid "" -" # droonga-http-server --port 3000 --default-dataset Starbucks --tag starbu" -"cks" +" # droonga-http-server --port 3000 \\\n" +" --receive-host-name=192.168.0.10 \\\n" +" --droonga-engine-host-name=192.168.0.10 \\\n" +" --default-dataset=Starbucks \\\n" +" --daemon \\\n" +" --pid-file $PWD/droonga-http-server.pid" msgstr "" msgid "### Search request via HTTP" @@ -1581,7 +1546,7 @@ msgstr "" "として受け取ることができます)" msgid "" -" # curl \"http://localhost:3000/tables/Store?attributes=_key&limit=-1\"\n" +" # curl \"http://192.168.0.10:3000/tables/Store?attributes=_key&limit=-1\"\n" " {\n" " \"stores\": {\n" " \"count\": 40,\n" @@ -1725,8 +1690,8 @@ msgstr "" "を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。" msgid "" -" # curl \"http://localhost:3000/tables/Store?query=Columbus&match_to=_key&at" -"tributes=_key&limit=-1\"\n" +" # curl \"http://192.168.0.10:3000/tables/Store?query=Columbus&match_to=_key" +"&attributes=_key&limit=-1\"\n" " {\n" " \"stores\": {\n" " \"count\": 2,\n" @@ -1754,14 +1719,14 @@ msgid "## Conclusion" msgstr "## まとめ" msgid "" -"In this tutorial, you did setup both packages [fluent-plugin-droonga][] and [d" -"roonga-http-server][] which construct [Droonga][] service on a [Ubuntu Linux][" -"Ubuntu].\n" +"In this tutorial, you did setup both packages [droonga-engine][] and [droonga-" +"http-server][] which construct [Droonga][] service on a [Ubuntu Linux][Ubuntu]" +".\n" "Moreover, you built a search system based on an HTTP protocol adapter with a D" "roonga engine, and successfully searched." msgstr "" -"[Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [fluent-plugin-droonga][] " -"と [droonga-http-server][] をセットアップしました。\n" +"[Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [droonga-engine][] と [droo" +"nga-http-server][] をセットアップしました。\n" "これらのパッケージを利用することで、HTTP Protocol Adapter と Droonga Engine からなるシステムを構築し、実際に検索を行い" "ました。" @@ -1769,7 +1734,7 @@ msgid "" " [http-server]: ../../reference/http-server/\n" " [Ubuntu]: http://www.ubuntu.com/\n" " [Droonga]: https://droonga.org/\n" -" [fluent-plugin-droonga]: https://github.com/droonga/fluent-plugin-droonga\n" +" [droonga-engine]: https://github.com/droonga/droonga-engine\n" " [droonga-http-server]: https://github.com/droonga/droonga-http-server\n" " [Groonga]: http://groonga.org/\n" " [Ruby]: http://www.ruby-lang.org/\n" Added: _po/ja/tutorial/groonga/index.po (+473 -0) 100644 =================================================================== --- /dev/null +++ _po/ja/tutorial/groonga/index.po 2014-04-28 19:57:41 +0900 (f80ea7d) @@ -0,0 +1,473 @@ +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"PO-Revision-Date: 2014-04-28 19:48+0900\n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +msgid "" +"---\n" +"title: \"Droonga tutorial: How to migrate from Groonga?\"\n" +"layout: en\n" +"---" +msgstr "" +"---\n" +"title: \"Droongaチュートリアル: Groongaからの移行手順\"\n" +"layout: ja\n" +"---" + +msgid "" +"* TOC\n" +"{:toc}" +msgstr "" + +msgid "## The goal of this tutorial" +msgstr "" + +msgid "" +"Learning steps to run a Droonga cluster by your hand, and use it as a [Groonga" +"][groonga] compatible server." +msgstr "" + +msgid "## Precondition" +msgstr "" + +msgid "" +"* You must have basic knowledge and experiences to set up and operate an [Ubun" +"tu][] Server.\n" +"* You must have basic knowledge and experiences to use the [Groonga][groonga] " +"via HTTP." +msgstr "" + +msgid "## What's Droonga?" +msgstr "" + +msgid "" +"It is a data processing engine based on a distributed architecture, named afte" +"r the terms \"distributed-Groonga\".\n" +"As its name suggests, it can work as a Groonga compatible server with some imp" +"rovements - replication and sharding." +msgstr "" + +msgid "" +"In a certain sense, the Droonga is quite different from Groonga, about its arc" +"hitecture, design, API etc.\n" +"However, you don't have to understand the whole architecture of the Droonga, i" +"f you simply use it just as a Groonga compatible server." +msgstr "" + +msgid "" +"For example, let's try to build a database system to find [Starbucks stores in" +" New York](http://geocommons.com/overlays/430038)." +msgstr "" + +msgid "## Set up a Droonga cluster" +msgstr "" + +msgid "### Prepare an environment for experiments" +msgstr "" + +msgid "" +"Prepare a computer at first.\n" +"This tutorial describes steps to set up a Droonga cluster based on existing co" +"mputers.\n" +"Following instructions are basically written for a successfully prepared virtu" +"al machine of the `Ubuntu 13.10 x64` on the service [DigitalOcean](https://www" +".digitalocean.com/), with an available console." +msgstr "" + +msgid "" +"NOTE: Make sure to use instances with >= 2GB memory equipped, at least during " +"installation of required packages for Droonga.\n" +"Otherwise, you may experience a strange build error." +msgstr "" + +msgid "You need to prepare two or more computers for effective replication." +msgstr "" + +msgid "### Steps to install Droonga components" +msgstr "" + +msgid "" +"Groonga provides binary packages and you can install Groonga easily, for some " +"environments.\n" +"(See: [how to install Groonga](http://groonga.org/docs/install.html))" +msgstr "" + +msgid "" +"However, currently there is no such an easy way to set up a database system ba" +"sed on Droonga.\n" +"We are planning to provide a better way (like a chef cookbook), but for now, y" +"ou have to set up it by your hand." +msgstr "" + +msgid "" +"A database system based on the Droonga is called *Droonga cluster*.\n" +"A Droonga cluster is constructed from multiple computers, called *Droonga node" +"*.\n" +"So you have to set up multiple Droonga nodes for your Droonga cluster." +msgstr "" + +msgid "Assume that you have two computers: `192.168.0.10` and `192.168.0.11`." +msgstr "" + +msgid " 1. Install required platform packages, *on each computer*." +msgstr "" + +msgid "" +" # apt-get update\n" +" # apt-get -y upgrade\n" +" # apt-get install -y ruby ruby-dev build-essential nodejs npm" +msgstr "" + +msgid "" +" 2. Install a gem package `droonga-engine`, *on each computer*.\n" +" It is the core component provides most features of Droonga system." +msgstr "" + +msgid " # gem install droonga-engine" +msgstr "" + +msgid "" +" 3. Install an npm package `droonga-http-server`, *on each computer*.\n" +" It is the frontend component required to translate HTTP requests to Droong" +"a's native one." +msgstr "" + +msgid " # npm install -g droonga-http-server" +msgstr "" + +msgid "" +" 4. Prepare a configuration directory for a Droonga node, *on each computer*.\n" +" All physical databases are placed under this directory." +msgstr "" + +msgid "" +" # mkdir ~/droonga\n" +" # cd ~/droonga" +msgstr "" + +msgid "" +" 5. Create a `catalog.json`, *on one of Droonga nodes*.\n" +" The file defines the structure of your Droonga cluster.\n" +" You'll specify the name of the dataset via the `--dataset` option and the " +"list of your Droonga node's IP addresses via the `--hosts` option, like:" +msgstr "" + +msgid "" +" # droonga-catalog-generate --dataset=Starbucks \\\n" +" --hosts=192.168.0.10,192.168.0.11 \\\n" +" --output=./catalog.json" +msgstr "" + +msgid "" +" If you have only one computer and trying to set up it just for testing, th" +"en you'll do:" +msgstr "" + +msgid "" +" # droonga-catalog-generate --dataset=Starbucks \\\n" +" --hosts=127.0.0.1 \\\n" +" --output=./catalog.json" +msgstr "" + +msgid " 6. Share the generated `catalog.json` *to your all Droonga nodes*." +msgstr "" + +msgid " # scp ~/droonga/catalog.json 192.169.0.2:~/droonga/" +msgstr "" + +msgid "" +" (Or, of course, you can generate same `catalog.json` on each computer, ins" +"tead of copying.)" +msgstr "" + +msgid "" +"All Droonga nodes for your Droonga cluster are prepared by steps described abo" +"ve.\n" +"Let's continue to the next step." +msgstr "" + +msgid "## Use the Droonga cluster, via HTTP" +msgstr "" + +msgid "### Start and stop services on each Droonga node" +msgstr "" + +msgid "You can run Groonga as an HTTP server with the option `-d`, like:" +msgstr "" + +msgid " # groonga -p 3000 -d --protocol http /tmp/databases/db" +msgstr "" + +msgid "" +"On the other hand, you have to run two servers for each Droonga node to use yo" +"ur Droonga cluster via HTTP." +msgstr "" + +msgid "To start them, run commands like following on each Droonga node:" +msgstr "" + +msgid "" +" # cd ~/droonga\n" +" # droonga-engine --host=192.168.0.10 \\\n" +" --daemon \\\n" +" --pid-file-$PWD/droonga-engine.pid\n" +" # droonga-http-server --port=3000 \\\n" +" --receive-host-name=192.168.0.10 \\\n" +" --droonga-engine-host-name=192.168.0.10 \\\n" +" --default-dataset=Starbucks \\\n" +" --daemon \\\n" +" --pid-file $PWD/droonga-http-server.pid" +msgstr "" + +msgid "" +"Note that you have to specify the host name of the Droonga node itself via som" +"e options.\n" +"It will be used to communicate with other Droonga nodes in the cluster.\n" +"So you have to specify different host name on another Droonga node, like:" +msgstr "" + +msgid "" +" # cd ~/droonga\n" +" # droonga-engine --host=192.168.0.11 \\\n" +" ..." +msgstr "" + +msgid "To stop services, run commands like following on each Droonga node:" +msgstr "" + +msgid "" +" # kill $(cat ~/droonga/droonga-engine.pid)\n" +" # kill $(cat ~/droonga/droonga-http-server.pid)" +msgstr "" + +msgid "### Create a table" +msgstr "" + +msgid "Now your Droonga cluster actually works as a Groonga's HTTP server." +msgstr "" + +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 "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/table_create?name=Store&type=Hash&key_t" +"ype=ShortText\"\n" +" [[0,1398662266.3853862,0.08530688285827637],true]" +msgstr "" + +msgid "" +"Note that you have to specify the host, one of Droonga nodes with active droon" +"ga-http-server, in your Droonga cluster.\n" +"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 "" + +msgid "" +"OK, now the table has been created successfully.\n" +"Let's see it by the `table_list` command:" +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/table_list\"\n" +" [[0,1398662423.509928,0.003869295120239258],[[[\"id\",\"UInt32\"],[\"name\",\"Sho" +"rtText\"],[\"path\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"domain\",\"ShortText\"],[\"r" +"ange\",\"ShortText\"],[\"default_tokenizer\",\"ShortText\"],[\"normalizer\",\"ShortText\"" +"]],[256,\"Store\",\"/home/username/groonga/droonga-engine/000/db.0000100\",\"TABLE_" +"HASH_KEY|PERSISTENT\",\"ShortText\",null,null,null]]]" +msgstr "" + +msgid "Because it is a cluster, another endpoint returns same result." +msgstr "" + +msgid "" +" # curl \"http://192.168.0.11:3000/d/table_list\"\n" +" [[0,1398662423.509928,0.003869295120239258],[[[\"id\",\"UInt32\"],[\"name\",\"Sho" +"rtText\"],[\"path\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"domain\",\"ShortText\"],[\"r" +"ange\",\"ShortText\"],[\"default_tokenizer\",\"ShortText\"],[\"normalizer\",\"ShortText\"" +"]],[256,\"Store\",\"/home/username/groonga/droonga-engine/000/db.0000100\",\"TABLE_" +"HASH_KEY|PERSISTENT\",\"ShortText\",null,null,null]]]" +msgstr "" + +msgid "### Create a column" +msgstr "" + +msgid "" +"Next, create a new column `location` to the `Store` table by the `column_creat" +"e` command, like:" +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/column_create?table=Store&name=location" +"&flags=COLUMN_SCALAR&type=WGS84GeoPoint\"\n" +" [[0,1398664305.8856306,0.00026226043701171875],true]" +msgstr "" + +msgid "" +"Then verify that the column is correctly created, by the `column_list` command" +":" +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/column_list?table=Store\"\n" +" [[0,1398664345.9680889,0.0011739730834960938],[[[\"id\",\"UInt32\"],[\"name\",\"S" +"hortText\"],[\"path\",\"ShortText\"],[\"type\",\"ShortText\"],[\"flags\",\"ShortText\"],[\"d" +"omain\",\"ShortText\"],[\"range\",\"ShortText\"],[\"source\",\"ShortText\"]],[257,\"locati" +"on\",\"/home/username/groonga/droonga-engine/000/db.0000101\",\"fix\",\"COLUMN_SCALA" +"R\",\"Store\",\"WGS84GeoPoint\",[]]]]" +msgstr "" + +msgid "### Create indexes" +msgstr "" + +msgid "Create indexes also." +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/table_create?name=Location&type=Patrici" +"aTrie&key_type=WGS84GeoPoint\"\n" +" [[0,1398664401.4927232,0.12011909484863281],true]\n" +" # curl \"http://192.168.0.10:3000/d/column_create?table=Location&name=store" +"&flags=COLUMN_INDEX&type=Store&source=location\"\n" +" [[0,1398664429.5348525,0.13435077667236328],true]\n" +" # curl \"http://192.168.0.10:3000/d/table_create?name=Term&type=PatriciaTri" +"e&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto\"\n" +" [[0,1398664454.446939,0.14734888076782227],true]\n" +" # curl \"http://192.168.0.10:3000/d/column_create?table=Term&name=store__ke" +"y&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=_key\"\n" +" [[0,1398664474.7112074,0.12619781494140625],true]" +msgstr "" + +msgid "### Load data to a table" +msgstr "" + +msgid "" +"Let's load data to the `Store` table.\n" +"First. prepare the data as a JSON file `stores.json`." +msgstr "" + +msgid "stores.json:" +msgstr "" + +msgid "" +"~~~\n" +"[\n" +"[\"_key\",\"location\"],\n" +"[\"1st Avenue & 75th St. - New York NY (W)\",\"40.770262,-73.954798\"],\n" +"[\"76th & Second - New York NY (W)\",\"40.771056,-73.956757\"],\n" +"[\"2nd Ave. & 9th Street - New York NY\",\"40.729445,-73.987471\"],\n" +"[\"15th & Third - New York NY (W)\",\"40.733946,-73.9867\"],\n" +"[\"41st and Broadway - New York NY (W)\",\"40.755111,-73.986225\"],\n" +"[\"84th & Third Ave - New York NY (W)\",\"40.777485,-73.954979\"],\n" +"[\"150 E. 42nd Street - New York NY (W)\",\"40.750784,-73.975582\"],\n" +"[\"West 43rd and Broadway - New York NY (W)\",\"40.756197,-73.985624\"],\n" +"[\"Macy's 35th Street Balcony - New York NY\",\"40.750703,-73.989787\"],\n" +"[\"Macy's 6th Floor - Herald Square - New York NY (W)\",\"40.750703,-73.989787\"]" +",\n" +"[\"Herald Square- Macy's - New York NY\",\"40.750703,-73.989787\"],\n" +"[\"Macy's 5th Floor - Herald Square - New York NY (W)\",\"40.750703,-73.989787\"]" +",\n" +"[\"80th & York - New York NY (W)\",\"40.772204,-73.949862\"],\n" +"[\"Columbus @ 67th - New York NY (W)\",\"40.774009,-73.981472\"],\n" +"[\"45th & Broadway - New York NY (W)\",\"40.75766,-73.985719\"],\n" +"[\"Marriott Marquis - Lobby - New York NY\",\"40.759123,-73.984927\"],\n" +"[\"Second @ 81st - New York NY (W)\",\"40.77466,-73.954447\"],\n" +"[\"52nd & Seventh - New York NY (W)\",\"40.761829,-73.981141\"],\n" +"[\"1585 Broadway (47th) - New York NY (W)\",\"40.759806,-73.985066\"],\n" +"[\"85th & First - New York NY (W)\",\"40.776101,-73.949971\"],\n" +"[\"92nd & 3rd - New York NY (W)\",\"40.782606,-73.951235\"],\n" +"[\"165 Broadway - 1 Liberty - New York NY (W)\",\"40.709727,-74.011395\"],\n" +"[\"1656 Broadway - New York NY (W)\",\"40.762434,-73.983364\"],\n" +"[\"54th & Broadway - New York NY (W)\",\"40.764275,-73.982361\"],\n" +"[\"Limited Brands-NYC - New York NY\",\"40.765219,-73.982025\"],\n" +"[\"19th & 8th - New York NY (W)\",\"40.743218,-74.000605\"],\n" +"[\"60th & Broadway-II - New York NY (W)\",\"40.769196,-73.982576\"],\n" +"[\"63rd & Broadway - New York NY (W)\",\"40.771376,-73.982709\"],\n" +"[\"195 Broadway - New York NY (W)\",\"40.710703,-74.009485\"],\n" +"[\"2 Broadway - New York NY (W)\",\"40.704538,-74.01324\"],\n" +"[\"2 Columbus Ave. - New York NY (W)\",\"40.769262,-73.984764\"],\n" +"[\"NY Plaza - New York NY (W)\",\"40.702802,-74.012784\"],\n" +"[\"36th and Madison - New York NY (W)\",\"40.748917,-73.982683\"],\n" +"[\"125th St. btwn Adam Clayton & FDB - New York NY\",\"40.808952,-73.948229\"],\n" +"[\"70th & Broadway - New York NY (W)\",\"40.777463,-73.982237\"],\n" +"[\"2138 Broadway - New York NY (W)\",\"40.781078,-73.981167\"],\n" +"[\"118th & Frederick Douglas Blvd. - New York NY (W)\",\"40.806176,-73.954109\"]," +"\n" +"[\"42nd & Second - New York NY (W)\",\"40.750069,-73.973393\"],\n" +"[\"Broadway @ 81st - New York NY (W)\",\"40.784972,-73.978987\"],\n" +"[\"Fashion Inst of Technology - New York NY\",\"40.746948,-73.994557\"]\n" +"]\n" +"~~~" +msgstr "" + +msgid "Then, send it as a POST request of the `load` command, like:" +msgstr "" + +msgid "" +" # curl --data \"@stores.json\" \"http://192.168.0.10:3000/d/load?table=Store\"" +"\n" +" [[0,1398666180.023,0.069],[40]]" +msgstr "" + +msgid "Now all data in the JSON file are successfully loaded." +msgstr "" + +msgid "### Select data from a table" +msgstr "" + +msgid "OK, all data is now ready." +msgstr "" + +msgid "As the starter, let's select initial ten records with the `select` command:" +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/select?table=Store&output_columns=_key&" +"limit=10\"\n" +" [[0,1398666260.887927,0.000017404556274414062],[[[40],[[\"_key\",\"ShortText\"" +"]],[[\"1st Avenue & 75th St. - New York NY (W)\"],[\"2nd Ave. & 9th Street - New" +" York NY\"],[\"76th & Second - New York NY (W)\"],[\"15th & Third - New York NY " +"(W)\"],[\"41st and Broadway - New York NY (W)\"],[\"West 43rd and Broadway - New " +"York NY (W)\"],[\"84th & Third Ave - New York NY (W)\"],[\"150 E. 42nd Street - " +"New York NY (W)\"],[\"Macy's 35th Street Balcony - New York NY\"],[\"Herald Squar" +"e- Macy's - New York NY\"]]]]]" +msgstr "" + +msgid "Of course you can specify conditions via the `query` option:" +msgstr "" + +msgid "" +" # curl \"http://192.168.0.10:3000/d/select?table=Store&query=Columbus&match" +"_columns=_key&output_columns=_key&limit=10\"\n" +" [[0,1398670157.661574,0.0012705326080322266],[[[2],[[\"_key\",\"ShortText\"]]," +"[[\"Columbus @ 67th - New York NY (W)\"],[\"2 Columbus Ave. - New York NY (W)\"]" +"]]]]\n" +" # curl \"http://192.168.0.10:3000/d/select?table=Store&filter=_key@'Ave'&ou" +"tput_columns=_key&limit=10\"\n" +" [[0,1398670586.193325,0.0003848075866699219],[[[3],[[\"_key\",\"ShortText\"]]," +"[[\"2nd Ave. & 9th Street - New York NY\"],[\"84th & Third Ave - New York NY (W)" +"\"],[\"2 Columbus Ave. - New York NY (W)\"]]]]]" +msgstr "" + +msgid "## Conclusion" +msgstr "" + +msgid "" +"In this tutorial, you did set up a [Droonga][] cluster on [Ubuntu Linux][Ubunt" +"u] computers.\n" +"Moreover, you load data to it and select data from it successfully, as a [Groo" +"nga][] compatible server." +msgstr "" + +msgid "" +" [Ubuntu]: http://www.ubuntu.com/\n" +" [Droonga]: https://droonga.org/\n" +" [Groonga]: http://groonga.org/" +msgstr "" Modified: _po/ja/tutorial/index.po (+6 -0) =================================================================== --- _po/ja/tutorial/index.po 2014-04-28 19:47:06 +0900 (4b7abb0) +++ _po/ja/tutorial/index.po 2014-04-28 19:57:41 +0900 (90868d1) @@ -19,6 +19,12 @@ msgstr "" "layout: ja\n" "---" +msgid "## For Groonga users" +msgstr "## Groonga利用者向け" + +msgid " * [How to migrate from Groonga?](groonga/)" +msgstr " * [Groongaからの移行手順](groonga/)" + msgid "## For application developers" msgstr "## アプリケーション開発者向け" Modified: ja/reference/commands/index.md (+6 -1) =================================================================== --- ja/reference/commands/index.md 2014-04-28 19:47:06 +0900 (5f5743d) +++ ja/reference/commands/index.md 2014-04-28 19:57:41 +0900 (1cdb3e6) @@ -22,6 +22,11 @@ layout: ja ## Groonga互換コマンド * [select](select/) + * [column_create](column-create/) + * [column_list](column-list/) + * [column_remove](column-remove/) + * [column_rename](column-rename/) + * [delete](delete/) * [table_create](table-create/) + * [table_list](table-list/) * [table_remove](table-remove/) - * [column_create](column-create/) Modified: ja/reference/commands/select/index.md (+6 -0) =================================================================== --- ja/reference/commands/select/index.md 2014-04-28 19:47:06 +0900 (8134c5b) +++ ja/reference/commands/select/index.md 2014-04-28 19:57:41 +0900 (6ccd0d0) @@ -68,9 +68,15 @@ layout: ja * `table` * `match_columns` * `query` + * `filter` * `output_columns` * `offset` * `limit` + * `drilldown` + * `drilldown_output_columns` + * `drilldown_sortby` + * `drilldown_offset` + * `drilldown_limit` すべてのパラメータの意味は[Groonga の `select` コマンドの引数](http://groonga.org/ja/docs/reference/commands/select.html#parameters)と共通です。詳細はGroongaのコマンドリファレンスを参照して下さい。 Modified: ja/tutorial/basic/index.md (+37 -60) =================================================================== --- ja/tutorial/basic/index.md 2014-04-28 19:47:06 +0900 (a7133f3) +++ ja/tutorial/basic/index.md 2014-04-28 19:57:41 +0900 (972bc69) @@ -38,8 +38,10 @@ Droonga は複数のコンポーネントから構成されています。ユー Droonga Engine は Droonga における分散データ処理の要となるコンポーネントです。リクエストに基いて実際のデータ処理を行います。 -このコンポーネントは [Fluentd] のプラグインとして実装されており、 [fluent-plugin-droonga][] パッケージとして提供されます。 -[fluent-plugin-droonga][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使用しています。 +このコンポーネントは[droonga-engine][]という名前で開発およびリリースされています。 +通信に使用するプロトコルは[Fluentd]と互換性があります。 + +[droonga-engine][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使用しています。 #### Protocol Adapter @@ -58,8 +60,8 @@ Droonga Engine自体は通信プロトコルとしてfluentdプロトコルに +-------------+ +------------------+ +----------------+ | Web Browser | <--------> | Protocol Adapter | <-------> | Droonga Engine | +-------------+ HTTP +------------------+ Fluent +----------------+ - w/droonga-http protocol w/fluent-plugin - -server -droonga + w/droonga-http protocol w/droonga-engine + -server \--------------------------------------------------/ @@ -77,6 +79,8 @@ Droonga Engine自体は通信プロトコルとしてfluentdプロトコルに 注意:Droongaが必要とするパッケージをインストールする前に、マシンが2GB以上のメモリを備えていることを確認して下さい。メモリが不足していると、ビルド時にエラーが出て、ビルドに失敗することがあります。 +ホストが `192.168.0.10` だと仮定します。 + ## セットアップに必要なパッケージをインストールする Droonga をセットアップするために必要になるパッケージをインストールします。 @@ -88,11 +92,11 @@ Droonga をセットアップするために必要になるパッケージをイ ## Droonga Engine を構築する Droonga Engine は、データベースを保持し、実際の検索を担当する部分です。 -このセクションでは、 fluent-plugin-droonga をインストールし、検索対象となるデータを準備します。 +このセクションでは、 droonga-engine をインストールし、検索対象となるデータを準備します。 -### fluent-plugin-droongaとdroonga-clientをインストールする +### droonga-engineとdroonga-clientをインストールする - # gem install fluent-plugin-droonga droonga-client + # gem install droonga-engine droonga-client Droonga Engine を構築するのに必要なパッケージがセットアップできました。引き続き設定に移ります。 @@ -103,21 +107,7 @@ Droonga Engine を構築するのに必要なパッケージがセットアッ # mkdir engine # cd engine -以下の内容で `fluentd.conf` と `catalog.json` を作成します。 - -fluentd.conf: - - <source> - type forward - port 24224 - </source> - <match starbucks.message> - name localhost:24224/starbucks - type droonga - </match> - <match output.message> - type stdout - </match> +以下の内容で `catalog.json` を作成します。 catalog.json: @@ -176,17 +166,17 @@ catalog.json: "slices": [ { "volume": { - "address": "localhost:24224/starbucks.000" + "address": "192.168.0.10:10031/droonga.000" } }, { "volume": { - "address": "localhost:24224/starbucks.001" + "address": "192.168.0.10:10031/droonga.001" } }, { "volume": { - "address": "localhost:24224/starbucks.002" + "address": "192.168.0.10:10031/droonga.002" } } ] @@ -197,17 +187,17 @@ catalog.json: "slices": [ { "volume": { - "address": "localhost:24224/starbucks.010" + "address": "192.168.0.10:10031/droonga.010" } }, { "volume": { - "address": "localhost:24224/starbucks.011" + "address": "192.168.0.10:10031/droonga.011" } }, { "volume": { - "address": "localhost:24224/starbucks.012" + "address": "192.168.0.10:10031/droonga.012" } } ] @@ -228,43 +218,25 @@ catalog.json: `catalog.json` の詳細については [catalog.json](/ja/reference/catalog) を参照してください。 -### fluent-plugin-droonga を起動する +### droonga-engine を起動する -以下のようにして fluentd-plugin-droonga を起動します。 +以下のようにして droonga-engine を起動します。 - # fluentd --config fluentd.conf --log fluentd.log --daemon fluentd.pid - # tail -F fluentd.log - </match> - <match output.message> - type stdout - </match> - </ROOT> - 2014-02-09 14:37:08 +0900 [info]: adding source type="forward" - 2014-02-09 14:37:08 +0900 [info]: adding match pattern="starbucks.message" type="droonga" - 2014-02-09 14:37:08 +0900 [info]: adding match pattern="output.message" type="stdout" - 2014-02-09 14:37:08 +0900 [info]: catalog loaded path="/tmp/engine/catalog.json" mtime=2014-02-09 14:29:22 +0900 - 2014-02-09 14:37:08 +0900 [info]: listening fluent socket on 0.0.0.0:24224 + # droonga-engine --host 192.168.0.10 --log-file=$PWD/droonga-engine.log --daemon --pid-file $PWD/droonga-engine.pid -### fluent-plugin-droonga を終了する +### droonga-engine を終了する -最初にfluent-plugin-droongaを終了する方法を知っておきましょう。 +最初にdroonga-engineを終了する方法を知っておきましょう。 fluentdにSIGTERMを送ります。 - # kill $(cat fluentd.pid) - -`tail -F fluentd.log` を実行しているターミナルに次のメッセージがでているはずです。 - - # tail -F fluentd.log - ... - 2014-02-09 14:39:27 +0900 [info]: shutting down fluentd - 2014-02-09 14:39:30 +0900 [info]: process finished code=0 + # kill $(cat droonga-engine.pid) -これがfluent-plugin-droongaを終了する方法です。 +これがdroonga-engineを終了する方法です。 再度fluent-plugin-droongaを起動します。 - # fluentd --config fluentd.conf --log fluentd.log --daemon fluentd.pid + # droonga-engine --host 192.168.0.10 --log-file=$PWD/droonga-engine.log --daemon --pid-file $PWD/droonga-engine.pid ### データベースを作成する @@ -1200,7 +1172,7 @@ search-all-stores.json: Droonga Engine にリクエストを送信します: ~~~ -# droonga-request --tag starbucks search-all-stores.json +# droonga-request search-all-stores.json Elapsed time: 0.008286785 [ "droonga.message", @@ -1352,14 +1324,19 @@ HTTP Protocol Adapterとして`droonga-http-server`を使用します。`droonga 次に、サーバを起動します。 - # droonga-http-server --port 3000 --default-dataset Starbucks --tag starbucks + # droonga-http-server --port 3000 \ + --receive-host-name=192.168.0.10 \ + --droonga-engine-host-name=192.168.0.10 \ + --default-dataset=Starbucks \ + --daemon \ + --pid-file $PWD/droonga-http-server.pid ### HTTPでの検索リクエスト 準備が整いました。 Protocol Adapter に向けて HTTP 経由でリクエストを発行し、データベースに問い合わせを行ってみましょう。まずは `Shops` テーブルの中身を取得してみます。以下のようなリクエストを用います。(`attributes=_key` を指定しているのは「検索結果に `_key` 値を含めて返してほしい」という意味です。これがないと、`records` に何も値がないレコードが返ってきてしまいます。`attributes` パラメータには `,` 区切りで複数の属性を指定することができます。`attributes=_key,location` と指定することで、緯度経度もレスポンスとして受け取ることができます) - # curl "http://localhost:3000/tables/Store?attributes=_key&limit=-1" + # curl "http://192.168.0.10:3000/tables/Store?attributes=_key&limit=-1" { "stores": { "count": 40, @@ -1492,7 +1469,7 @@ HTTP Protocol Adapterとして`droonga-http-server`を使用します。`droonga もう少し複雑なクエリを試してみましょう。例えば、店名に「Columbus」を含む店舗を検索します。`query` パラメータにクエリ `Columbus` を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。 - # curl "http://localhost:3000/tables/Store?query=Columbus&match_to=_key&attributes=_key&limit=-1" + # curl "http://192.168.0.10:3000/tables/Store?query=Columbus&match_to=_key&attributes=_key&limit=-1" { "stores": { "count": 2, @@ -1514,14 +1491,14 @@ Droonga HTTP Serverの詳細については[リファレンスマニュアル][h ## まとめ -[Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [fluent-plugin-droonga][] と [droonga-http-server][] をセットアップしました。 +[Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [droonga-engine][] と [droonga-http-server][] をセットアップしました。 これらのパッケージを利用することで、HTTP Protocol Adapter と Droonga Engine からなるシステムを構築し、実際に検索を行いました。 [http-server]: ../../reference/http-server/ [Ubuntu]: http://www.ubuntu.com/ [Droonga]: https://droonga.org/ - [fluent-plugin-droonga]: https://github.com/droonga/fluent-plugin-droonga + [droonga-engine]: https://github.com/droonga/droonga-engine [droonga-http-server]: https://github.com/droonga/droonga-http-server [Groonga]: http://groonga.org/ [Ruby]: http://www.ruby-lang.org/ Added: ja/tutorial/groonga/index.md (+280 -0) 100644 =================================================================== --- /dev/null +++ ja/tutorial/groonga/index.md 2014-04-28 19:57:41 +0900 (dca4dc4) @@ -0,0 +1,280 @@ +--- +title: "Droongaチュートリアル: Groongaからの移行手順" +layout: ja +--- + +{% comment %} +############################################## + THIS FILE IS AUTOMATICALLY GENERATED FROM + "_po/ja/tutorial/groonga/index.po" + DO NOT EDIT THIS FILE MANUALLY! +############################################## +{% endcomment %} + + +* TOC +{:toc} + +## チュートリアルのゴール + +Learning steps to run a Droonga cluster by your hand, and use it as a [Groonga][groonga] compatible server. + +## 前提条件 + +* You must have basic knowledge and experiences to set up and operate an [Ubuntu][] Server. +* You must have basic knowledge and experiences to use the [Groonga][groonga] via HTTP. + +## What's Droonga? + +It is a data processing engine based on a distributed architecture, named after the terms "distributed-Groonga". +As its name suggests, it can work as a Groonga compatible server with some improvements - replication and sharding. + +In a certain sense, the Droonga is quite different from Groonga, about its architecture, design, API etc. +However, you don't have to understand the whole architecture of the Droonga, if you simply use it just as a Groonga compatible server. + +例として、[ニューヨークにあるスターバックスの店舗](http://geocommons.com/overlays/430038)を検索できるデータベースシステムを作成することにします。 + +## Set up a Droonga cluster + +### Prepare an environment for experiments + +Prepare a computer at first. +This tutorial describes steps to set up a Droonga cluster based on existing computers. +Following instructions are basically written for a successfully prepared virtual machine of the `Ubuntu 13.10 x64` on the service [DigitalOcean](https://www.digitalocean.com/), with an available console. + +NOTE: Make sure to use instances with >= 2GB memory equipped, at least during installation of required packages for Droonga. +Otherwise, you may experience a strange build error. + +You need to prepare two or more computers for effective replication. + +### Steps to install Droonga components + +Groonga provides binary packages and you can install Groonga easily, for some environments. +(See: [how to install Groonga](http://groonga.org/docs/install.html)) + +However, currently there is no such an easy way to set up a database system based on Droonga. +We are planning to provide a better way (like a chef cookbook), but for now, you have to set up it by your hand. + +A database system based on the Droonga is called *Droonga cluster*. +A Droonga cluster is constructed from multiple computers, called *Droonga node*. +So you have to set up multiple Droonga nodes for your Droonga cluster. + +Assume that you have two computers: `192.168.0.10` and `192.168.0.11`. + + 1. Install required platform packages, *on each computer*. + + # apt-get update + # apt-get -y upgrade + # apt-get install -y ruby ruby-dev build-essential nodejs npm + + 2. Install a gem package `droonga-engine`, *on each computer*. + It is the core component provides most features of Droonga system. + + # gem install droonga-engine + + 3. Install an npm package `droonga-http-server`, *on each computer*. + It is the frontend component required to translate HTTP requests to Droonga's native one. + + # npm install -g droonga-http-server + + 4. Prepare a configuration directory for a Droonga node, *on each computer*. + All physical databases are placed under this directory. + + # mkdir ~/droonga + # cd ~/droonga + + 5. Create a `catalog.json`, *on one of Droonga nodes*. + The file defines the structure of your Droonga cluster. + You'll specify the name of the dataset via the `--dataset` option and the list of your Droonga node's IP addresses via the `--hosts` option, like: + + # droonga-catalog-generate --dataset=Starbucks \ + --hosts=192.168.0.10,192.168.0.11 \ + --output=./catalog.json + + If you have only one computer and trying to set up it just for testing, then you'll do: + + # droonga-catalog-generate --dataset=Starbucks \ + --hosts=127.0.0.1 \ + --output=./catalog.json + + 6. Share the generated `catalog.json` *to your all Droonga nodes*. + + # scp ~/droonga/catalog.json 192.169.0.2:~/droonga/ + + (Or, of course, you can generate same `catalog.json` on each computer, instead of copying.) + +All Droonga nodes for your Droonga cluster are prepared by steps described above. +Let's continue to the next step. + +## Use the Droonga cluster, via HTTP + +### Start and stop services on each Droonga node + +You can run Groonga as an HTTP server with the option `-d`, like: + + # groonga -p 3000 -d --protocol http /tmp/databases/db + +On the other hand, you have to run two servers for each Droonga node to use your Droonga cluster via HTTP. + +To start them, run commands like following on each Droonga node: + + # cd ~/droonga + # droonga-engine --host=192.168.0.10 \ + --daemon \ + --pid-file-$PWD/droonga-engine.pid + # droonga-http-server --port=3000 \ + --receive-host-name=192.168.0.10 \ + --droonga-engine-host-name=192.168.0.10 \ + --default-dataset=Starbucks \ + --daemon \ + --pid-file $PWD/droonga-http-server.pid + +Note that you have to specify the host name of the Droonga node itself via some options. +It will be used to communicate with other Droonga nodes in the cluster. +So you have to specify different host name on another Droonga node, like: + + # cd ~/droonga + # droonga-engine --host=192.168.0.11 \ + ... + +To stop services, run commands like following on each Droonga node: + + # 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. + +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: + + # curl "http://192.168.0.10:3000/d/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. + +OK, now the table has been created successfully. +Let's see it by the `table_list` command: + + # curl "http://192.168.0.10:3000/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]]] + +Because it is a cluster, another endpoint returns same result. + + # curl "http://192.168.0.11:3000/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: + + # curl "http://192.168.0.10:3000/d/column_create?table=Store&name=location&flags=COLUMN_SCALAR&type=WGS84GeoPoint" + [[0,1398664305.8856306,0.00026226043701171875],true] + +Then verify that the column is correctly created, by the `column_list` command: + + # curl "http://192.168.0.10:3000/d/column_list?table=Store" + [[0,1398664345.9680889,0.0011739730834960938],[[["id","UInt32"],["name","ShortText"],["path","ShortText"],["type","ShortText"],["flags","ShortText"],["domain","ShortText"],["range","ShortText"],["source","ShortText"]],[257,"location","/home/username/groonga/droonga-engine/000/db.0000101","fix","COLUMN_SCALAR","Store","WGS84GeoPoint",[]]]] + +### Create indexes + +Create indexes also. + + # curl "http://192.168.0.10:3000/d/table_create?name=Location&type=PatriciaTrie&key_type=WGS84GeoPoint" + [[0,1398664401.4927232,0.12011909484863281],true] + # curl "http://192.168.0.10:3000/d/column_create?table=Location&name=store&flags=COLUMN_INDEX&type=Store&source=location" + [[0,1398664429.5348525,0.13435077667236328],true] + # curl "http://192.168.0.10:3000/d/table_create?name=Term&type=PatriciaTrie&key_type=ShortText&default_tokenizer=TokenBigram&normalizer=NormalizerAuto" + [[0,1398664454.446939,0.14734888076782227],true] + # curl "http://192.168.0.10:3000/d/column_create?table=Term&name=store__key&flags=COLUMN_INDEX|WITH_POSITION&type=Store&source=_key" + [[0,1398664474.7112074,0.12619781494140625],true] + + +### Load data to a table + +Let's load data to the `Store` table. +First. prepare the data as a JSON file `stores.json`. + +stores.json: + +~~~ +[ +["_key","location"], +["1st Avenue & 75th St. - New York NY (W)","40.770262,-73.954798"], +["76th & Second - New York NY (W)","40.771056,-73.956757"], +["2nd Ave. & 9th Street - New York NY","40.729445,-73.987471"], +["15th & Third - New York NY (W)","40.733946,-73.9867"], +["41st and Broadway - New York NY (W)","40.755111,-73.986225"], +["84th & Third Ave - New York NY (W)","40.777485,-73.954979"], +["150 E. 42nd Street - New York NY (W)","40.750784,-73.975582"], +["West 43rd and Broadway - New York NY (W)","40.756197,-73.985624"], +["Macy's 35th Street Balcony - New York NY","40.750703,-73.989787"], +["Macy's 6th Floor - Herald Square - New York NY (W)","40.750703,-73.989787"], +["Herald Square- Macy's - New York NY","40.750703,-73.989787"], +["Macy's 5th Floor - Herald Square - New York NY (W)","40.750703,-73.989787"], +["80th & York - New York NY (W)","40.772204,-73.949862"], +["Columbus @ 67th - New York NY (W)","40.774009,-73.981472"], +["45th & Broadway - New York NY (W)","40.75766,-73.985719"], +["Marriott Marquis - Lobby - New York NY","40.759123,-73.984927"], +["Second @ 81st - New York NY (W)","40.77466,-73.954447"], +["52nd & Seventh - New York NY (W)","40.761829,-73.981141"], +["1585 Broadway (47th) - New York NY (W)","40.759806,-73.985066"], +["85th & First - New York NY (W)","40.776101,-73.949971"], +["92nd & 3rd - New York NY (W)","40.782606,-73.951235"], +["165 Broadway - 1 Liberty - New York NY (W)","40.709727,-74.011395"], +["1656 Broadway - New York NY (W)","40.762434,-73.983364"], +["54th & Broadway - New York NY (W)","40.764275,-73.982361"], +["Limited Brands-NYC - New York NY","40.765219,-73.982025"], +["19th & 8th - New York NY (W)","40.743218,-74.000605"], +["60th & Broadway-II - New York NY (W)","40.769196,-73.982576"], +["63rd & Broadway - New York NY (W)","40.771376,-73.982709"], +["195 Broadway - New York NY (W)","40.710703,-74.009485"], +["2 Broadway - New York NY (W)","40.704538,-74.01324"], +["2 Columbus Ave. - New York NY (W)","40.769262,-73.984764"], +["NY Plaza - New York NY (W)","40.702802,-74.012784"], +["36th and Madison - New York NY (W)","40.748917,-73.982683"], +["125th St. btwn Adam Clayton & FDB - New York NY","40.808952,-73.948229"], +["70th & Broadway - New York NY (W)","40.777463,-73.982237"], +["2138 Broadway - New York NY (W)","40.781078,-73.981167"], +["118th & Frederick Douglas Blvd. - New York NY (W)","40.806176,-73.954109"], +["42nd & Second - New York NY (W)","40.750069,-73.973393"], +["Broadway @ 81st - New York NY (W)","40.784972,-73.978987"], +["Fashion Inst of Technology - New York NY","40.746948,-73.994557"] +] +~~~ + +Then, send it as a POST request of the `load` command, like: + + # curl --data "@stores.json" "http://192.168.0.10:3000/d/load?table=Store" + [[0,1398666180.023,0.069],[40]] + +Now all data in the JSON file are successfully loaded. + +### Select data from a table + +OK, all data is now ready. + +As the starter, let's select initial ten records with the `select` command: + + # curl "http://192.168.0.10:3000/d/select?table=Store&output_columns=_key&limit=10" + [[0,1398666260.887927,0.000017404556274414062],[[[40],[["_key","ShortText"]],[["1st Avenue & 75th St. - New York NY (W)"],["2nd Ave. & 9th Street - New York NY"],["76th & Second - New York NY (W)"],["15th & Third - New York NY (W)"],["41st and Broadway - New York NY (W)"],["West 43rd and Broadway - New York NY (W)"],["84th & Third Ave - New York NY (W)"],["150 E. 42nd Street - New York NY (W)"],["Macy's 35th Street Balcony - New York NY"],["Herald Square- Macy's - New York NY"]]]]] + +Of course you can specify conditions via the `query` option: + + # curl "http://192.168.0.10:3000/d/select?table=Store&query=Columbus&match_columns=_key&output_columns=_key&limit=10" + [[0,1398670157.661574,0.0012705326080322266],[[[2],[["_key","ShortText"]],[["Columbus @ 67th - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]]] + # curl "http://192.168.0.10:3000/d/select?table=Store&filter=_key@'Ave'&output_columns=_key&limit=10" + [[0,1398670586.193325,0.0003848075866699219],[[[3],[["_key","ShortText"]],[["2nd Ave. & 9th Street - New York NY"],["84th & Third Ave - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]]]] + + +## まとめ + +In this tutorial, you did set up a [Droonga][] cluster on [Ubuntu Linux][Ubuntu] computers. +Moreover, you load data to it and select data from it successfully, as a [Groonga][] compatible server. + + [Ubuntu]: http://www.ubuntu.com/ + [Droonga]: https://droonga.org/ + [Groonga]: http://groonga.org/ Modified: ja/tutorial/index.md (+4 -0) =================================================================== --- ja/tutorial/index.md 2014-04-28 19:47:06 +0900 (b3d09ee) +++ ja/tutorial/index.md 2014-04-28 19:57:41 +0900 (36c2f2b) @@ -12,6 +12,10 @@ layout: ja {% endcomment %} +## Groonga利用者向け + + * [Groongaからの移行手順](groonga/) + ## アプリケーション開発者向け * [基本的な使い方のチュートリアル](basic/) -------------- next part -------------- HTML����������������������������... Download