ROMAを検証

【公式URL】
http://roma-kvs.org/
http://roma-kvs.org/gladiator.html (GUIツール)
https://github.com/roma

【検証理由】
・好きなRubyで開発されているOSSなので、可読性が高い
まつもとゆきひろ(Matz)さんが共同研究に関わっているので フレームワーク開発の参考になる
Memcached クライアントで会話可能で、状況に応じて拡張が可能
GUIでステータスが見れる

【構築後の画面】
・ログイン画面

・トップページ

・ステータス画面

【ROMA導入】

"1. ruby install"
# yum remove ruby
# yum -y install gcc zlib-devel openssl-devel sqlite sqlite-devel mysql-devel readline-devel libffi-devel
# cd /usr/local/src/
# wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
# tar xvzf ruby-2.1.2.tar.gz
# cd ruby-2.1.2
# ./configure && make && make install
# ln -s /usr/local/bin/ruby /usr/bin/ruby
# ruby -v

"2. gem install"
# wget http://production.cf.rubygems.org/rubygems/rubygems-2.2.2.zip
# unzip rubygems-2.2.2.zip
# cd rubygems-2.2.2
# ruby setup.rb
# ln -s /usr/local/bin/gem /usr/bin/gem

"3. ROMA install"
# gem install eventmachine
# gem install roma
# cd 【ROMAホーム】
# bin/mkroute localhost_10001 localhost_10002 --replication_in_host
# bin/romad localhost -p 10001 -d --replication_in_host
# bin/romad localhost -p 10002 -d --replication_in_host

"4. access ROMA"
# telnet localhost 10001

"5. check how it works"
stat
version 1.1.0
config.DEFAULT_LOST_ACTION auto_assign
config.LOG_SHIFT_AGE 10
config.LOG_SHIFT_SIZE 10485760
・
・

set foo 0 0 3
bar
STORED

get foo
VALUE foo 0 3
bar
END

quit

GUIツール導入】

# gem install bundler
# ln -s /usr/local/bin/bundle /usr/bin/bundle
# cd /usr/local/src/
# wget https://github.com/roma/gladiator/archive/v1.1.0.tar.gz -O gladiator.tar.gz
# tar xvfz gladiator.tar.gz
# cd gladiator-1.1.0
# bundle install
# vi lib/config_gui.rb
--
module ConfigGui
  # input your ROMA's ip address or hostname
  HOST = "127.0.0.1" # <- 変更箇所

  # input your ROMA's port No.
  PORT = "10001" # <- 変更箇所

  # set your account infomation
  # [:username] and [:password] are set a limit by 30 characters.
  ROOT_USER = [
    {:username => 'roma_root', :password => 'hogehoge', :email => ''}, # <- 変更箇所
    {:username => 'gladiator_root', :password => 'fugafuga', :email => '' }, # <- 変更箇所
  ]

  NORMAL_USER = [
    ### NORMAL user are limited some functions.
    #{:username => '', :password => '', :email => '' },
  ]
end
--

# cd 【ROMAホーム】
# vi config.rb
--
81     # plugin setting
82     PLUGIN_FILES = ['plugin_storage.rb', 'plugin_gui.rb'] # <- 'plugin_gui.rb' を追加
--

" ROMA 再起動"
# telnet localhost 10001
balse
Are you sure?(yes/no)
yes
# cd 【ROMAホーム】
# bin/romad localhost -p 10001 -d --replication_in_host
# bin/romad localhost -p 10002 -d --replication_in_host

" GUI tool 起動"
# cd 【GUI tool ホーム】
# bin/rails s

GoogleChromeからアクセス】
URL : http://localhost:3000

項目 内容
URL http://localhost:3000
ID roma_root
Pass hogehoge

【その他 (アクセスできない時は・・・)】
1. firewall をとめる
# service iptables stop
2. ポートフォワーディングに 3000ポートを追加 (virtualboxの場合)
対象サーバ > 設定 > ネットワーク > ポートフォワーディング に追加する

【総括】
導入時に少し手がかかるが、運用コストを抑えられそう。
動的にスケールアウトできる点、GUIツールで監視ができる点が大きい。