サーバの準備
groonga_practice をダウンロード
git clone https://github.com/hiroyuki-sato/groonga_practice
cd groonga_practice/database
../bin/gen_chap4_1
groonga -s chap4_1.dbクライアントでサーバに接続
groonga -c
> select --table Site --limit 100
Siteテーブルの中身の確認
> select --table Site --limit 100
[
[
0,
1432126727.34306,
0.0249168872833252
],
[
[
[
9
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"title",
"ShortText"
]
],
[
1,
"http://example.org/",
"This is test record 1!"
],
[
2,
"http://example.net/",
"test record 2."
],
[
3,
"http://example.com/",
"test test record three."
],
[
4,
"http://example.net/afr",
"test record four."
],
[
5,
"http://example.org/aba",
"test test test record five."
],
[
6,
"http://example.com/rab",
"test test test test record six."
],
[
7,
"http://example.net/atv",
"test test test record seven."
],
[
8,
"http://example.org/gat",
"test test record eight."
],
[
9,
"http://example.com/vdw",
"test test record nine."
]
]
]
]embulkの設定ファイル確認
in:
type: file
path_prefix: /tmp/test/test
parser:
charset: ISO-8859-2
newline: CRLF
type: csv
delimiter: ','
quote: ''
escape: ''
skip_header_lines: 1
allow_extra_columns: false
allow_optional_columns: false
columns:
- {name: key, type: string}
- {name: title, type: string}
exec: {}
out:
type: groonga
table: Site
key_column: key
host: localhost
port: 10043
protocol: gqtpデータロード
embulk run /tmp/config.yml
2015-05-20 21:58:59.105 +0900: Embulk v0.6.9
2015-05-20 21:59:01.862 +0900 [INFO] (transaction): Listing local files at directory '/tmp/test' filtering filename by prefix 'test'
2015-05-20 21:59:01.874 +0900 [INFO] (transaction): Loading files [/tmp/test/test.csv]
2015-05-20 21:59:02.057 +0900 [INFO] (transaction): {done: 0 / 1, running: 0}
2015-05-20 21:59:03.343 +0900 [INFO] (transaction): {done: 1 / 1, running: 0}
2015-05-20 21:59:03.380 +0900 [INFO] (main): Committed.
2015-05-20 21:59:03.380 +0900 [INFO] (main): Next config diff: {"in":{"last_path":"/tmp/test/test.csv"},"out":{}}
ロード後の確認
> select --table Site --limit 100
[
[
0,
1432126755.92162,
0.000575065612792969
],
[
[
[
159
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"title",
"ShortText"
]
],
[
1,
"http://example.org/",
"This is test record 1!"
],
[
2,
"http://example.net/",
"test record 2."
],
[
3,
"http://example.com/",
"test test record three."
],
[
4,
"http://example.net/afr",
"test record four."
],
[
5,
"http://example.org/aba",
"test test test record five."
],
[
6,
"http://example.com/rab",
"test test test test record six."
],
[
7,
"http://example.net/atv",
"test test test record seven."
],
[
96,
"hoge87",
"title87"
],
[
97,
"hoge88",
"title88"
],
[
98,
"hoge89",
"title89"
],
[
99,
"hoge90",
"title90"
],
// ... 略
[
100,
"hoge91",
"title91"
]
]
]
]