TomuDB1.1のインストールと動作確認方法
TomuDB 異種センサデータ管理システム
1章 実行環境
-----------
* Programming Language:C
* Proper Operation Environment
* Fedora7
* gcc 4.1.2
* glibc 2.6
* Hardware Platform:(CPU: Pentium3 1G, Memory:256MB)
* DBMS:PostgreSQL
インストール方法
$ su -
# yum -y install gcc
# yum -y install postgresql-server
# yum -y install postgresql-devel
# yum -y install libxml
2章 環境設定
-----------
この章ではpostgresの設定、TomuDBのconfig設定、実行ファイルの作成について説明する。
2.1 postgresの設定
----------------
# su -
# /etc/rc.d/init.d/postgresql start
# chkconfig postgresql on
# chkconfig --list postgresql <--- postgresが動作していることの確認
# passwd postgres <--- 任意のパスワード
# su - postgres
-bash-3.00$ psql template1
template1=# alter user postgres with password '*****'; <--- 任意のパスワード
template1=# \q
-bash-3.00$ vi /var/lib/pgsql/data/postgresql.conf
-------------------------------------------------------------------------
| 7.Xの場合 |
| tcpip_socket = false となっているところを |
| tcpip_socket = true に変更 |
| |
| 8.Xの場合 |
| listen_addresses = 'localhost' となっているところを |
| listen_addresses = '*' に変更 |
-------------------------------------------------------------------------
-bash-3.00$ vi /var/lib/pgsql/data/pg_hba.conf
-------------------------------------------------------------------------
| local all all trust |
| host all all 192.168.0.1 255.255.255.255 trust |
| host all all 0.0.0.0 password crypt |
| ※初期設定の「local ***」と「host ***」はコメントアウト |
-------------------------------------------------------------------------
-bash-3.00$ exit
# /etc/rc.d/init.d/postgresql restart
下記よりテーブルの作成に移る。
# useradd tomu
# passwd tomu <--- 任意のパスワード
# su - postgres
-bash-3.00$ createuser -AdPE tomu <--- "tomudb"
-bash-3.00$ exit
# su - tomu
[tomu]$ createdb --encoding UTF8 tomu
[tomu]$ psql tomu
・ d_type テーブルの作成
$ CREATE TABLE d_type (id serial PRIMARY KEY, name text);
$ CREATE UNIQUE INDEX d_type_index ON d_type(id);
・ data_profile テーブルの作成
$ CREATE TABLE data_profile(id serial PRIMARY KEY, d_type_id integer
REFERENCES d_type(id), period integer);
$ CREATE UNIQUE INDEX data_profile_index ON data_profile(id);
・ source_profile テーブルの作成
$ CREATE TABLE source_profile (id serial PRIMARY KEY, name text, attributes text);
$ CREATE UNIQUE INDEX source_profile_index ON source_profile (id);
・ data テーブルの作成
$ CREATE TABLE data(id serial PRIMARY KEY, source_profile_id integer REFERENCES source_profile(id),
data_profile_id integer REFERENCES data_profile(id), x double precision, y double precision,
time timestamp, value real);
$ CREATE UNIQUE INDEX data_index ON data(id);
2.2 TomuDBのconfig設定
---------------------
./tomu1.1/ ディレクトリに移動する。
# vi config
-------------------------------------------------------------------------------
| id: ***.***.***.*** <--- 自分のID(IPアドレス)を指定 ※1 |
| port: 5555 <--- ポートを指定 |
| |
| d_type: temperature <--- d_typeの選択 ※2 |
| region: 0.0 0.0 10.0 10.0 <--- 範囲の指定(経度1,緯度1,経度2,緯度2) ※3 |
| spatial_resolution: 1.0 <--- 空間的解像度の指定 |
| |
| period: (2005/02/02 00:01:00.0000, |
| 2006/02/03 00:00:00.0000) <--- 期間の指定 ※4 |
| parent_id: ***.***.***.*** <--- parent ID を指定(IPアドレス) ※5 |
-------------------------------------------------------------------------------
※1 tomupmはLogMeInによって提供されるHamachiのようなVPNソフトウエア上で動作可能
グローバルIPをお持ちでない場合は、
HamachiのようなVPNソフトウエアをインストールすることをおすすめします。
下記URLからhamachiをダウンロードできます。
https://secure.logmein.com/products/hamachi/vpn.asp?lang=ja
※2 d_typeとはデータの種類を表現
TomuDBで扱えるデータを下記データタイプになります。
"temperature" <--- 気温
"humidity" <--- 湿度
"light" <--- 照度
"wind" <--- 風
"rain" <--- 雨
"vibration" <--- 振動
※3 左下(経度1,緯度1)と右上(経度2,経度2)を指定することで範囲を決定
※4 (年/月/日 時:分:秒)のフォーマットで期間を指定
※5 parentが存在しない場合は,"0.0.0.0"を指定
2.3 実行ファイルの作成
---------------------
./tomu1.1/ ディレクトリに移動する。
$ make <--- 実行ファイル(tomupm)の作成
3章 TomuDBの動作確認方法
----------------------
Tomu GUIと連動させることでTomuDBが正常に動作していることを確認する。
3.1 サンプルデータの挿入(例)
--------------------------
$ su - tomu
$ psql tomu
$ INSERT INTO d_type (id,name) VALUES (1,'temperature');
$ INSERT INTO data_profile (id,d_type_id,period) VALUES (1,1,1);
$ INSERT INTO source_profile (id,name,attributes) VALUES (1,'temperature','temperature');
$ INSERT INTO data (id,source_profile_id,data_profile_id,x,y,time,value)
VALUES (1,1,1,139.762495,35.692876,'2007-01-11 12:00:00',9999);
3.2 TomuDBのconfig設定
---------------------
2章 2.2 TomuDBのconfig設定を確認する。
TomuDBの動作を確認する上ではid のみ正しく設定されていれば良い。
3.3 TomuDBの実行
---------------
./tomu1.1/ ディレクトリに移動する。
$ ./tomupm
※ポートの解放について
TomuDBでは5555ポートを使用しています。
必要に応じてポートを解放してください。
3.4 Tomu GUIの実行
-----------------
./tomugui1.0/tomugui.bat をダブルクリックし、実行する。
(使用方法については ./tomugui1.0/readme-guimonitor.txt を参照)
Tomu GUIが正常に動作した場合はTomu GUIと共にTomuDBも正常に動作している
※動作確認後はテーブルを空にしてください
Project Site
------------
http://www.osoite.jp
TomuDBはJST CRESTで開発しているオープンソースのプロジェクトですが、
メインリポジトリはTomuDB開発チームが管理しております。
変更・修正した際にはTomuDB開発チームまで御一報下さい。
Copyright (C) 2009 osoite project, All rights reserved.