基本

  • レプリケーション数は3固定?

インストール

  • インストール手順
    • bzip2
    • ruby
    • RubyGems?
      $ wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
      $ tar zxvf rubygems-1.3.5.tgz
      $ cd rubygems-1.3.5
      $ ruby setup.rb
  • Tokyo Cabinet
    $ wget http://1978th.net/tokyocabinet/tokyocabinet-1.4.47.tar.gz
    $ tar zxvf tokyocabinet-1.4.47.tar.gz 
    $ cd tokyocabinet-1.4.47
    $ ./configure 
    $ make
    # make install
  • MessagePack
    $ wget http://sourceforge.net/projects/msgpack/files/msgpack/cpp/msgpack-0.5.4.tar.gz
    $ tar zxvf msgpack-0.5.4.tar.gz 
    $ cd msgpack-0.5.4
    $ ./configure
    $ make
    # make install
  • MessagePack? for Ruby
    # gem install msgpack
  • kumofs
    $ wget https://github.com/etolabo/kumofs/downloads/kumofs-0.4.13.tar.gz
    $ tar zxvf kumofs-0.4.13.tar.gz 
    $ cd kumofs-0.4.13
    $ ./configure 
    $ make
    # make install
    

1台のサーバで冗長構成を試す

  • 準備(データベースファイルの作成)
    • 1億件のテストをするため、余裕をみてバケット数=1.5億を指定して作成
      $ tchmgr create kumodb1.tch 150000000
      $ tchmgr create kumodb2.tch 150000000
      $ tchmgr create kumodb3.tch 150000000
  • 起動
    • マネージャ起動
      $ kumo-manager -v -l localhost:19700 -p localhost:19701
      $ kumo-manager -v -l localhost:19701 -p localhost:19700
      • 片方しか動いていないときは以下のエラーが出る
        2011-05-19 15:54:29 ../rpc/client_tmpl.h:199: connect failed 127.0.0.1:19701: Connection refused
  • サーバ起動
    $ kumo-server -m localhost -l localhost:19801 -L 19901 -s /var/kumofs/kumodb1.tch
    $ kumo-server -m localhost -l localhost:19802 -L 19902 -s /var/kumofs/kumodb2.tch 
    $ kumo-server -m localhost -l localhost:19803 -L 19903 -s /var/kumofs/kumodb3.tch
    • 動きを見たければ -v オプションを付ける
  • サーバ登録
    $ kumoctl localhost attach
  • ゲートウェイ起動
    $ kumo-gateway -v -m localhost -t localhost
  • 状態確認
    $ kumoctl localhost status
    hash space timestamp:
      Thu May 19 16:59:23 +0900 2011 clock 139
    attached node:
      127.0.0.1:19801  (active)
      127.0.0.1:19802  (active)
      127.0.0.1:19803  (active)
    not attached node:
  • 試しに接続
    $ telnet localhost 11411
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    version
    VERSION kumofs-0.4.13
  • 統計情報
    $ kumostat -h
    Usage: kumostat server-address[:port=19800] command
           kumostat -m manager-address[:port=19700] command
    command:
       pid           get pid of server process
       uptime        get uptime
       time          get UNIX time
       version       get version
       cmd_get       get number of get requests
       cmd_set       get number of set requests
       cmd_delete    get number of delete requests
       items         get number of stored items
       stats         get statistics like memcached's 'stats' command
       rhs           get rhs (routing table for Get)
       whs           get whs (routing table for Set/Delete)
       hscheck       check if rhs == whs
       replstat      get replace status
       set_delay     maximize throughput at the expense of latency
       unset_delay   minimize latency at the expense of throughput
  • 負荷確認
    $ kumotop -m localhost
    address          #Get  #Set  #Del  Get/s  Set/s  Del/s  QPS  items                 time  clock  status
    127.0.0.1:19801     0     0     0      0      0      0    0      0  2011-05-19 17:24:18    896   ready
    127.0.0.1:19802     0     0     0      0      0      0    0      0  2011-05-19 17:24:18    896   ready
    127.0.0.1:19803     0     0     0      0      0      0    0      0  2011-05-19 17:24:19    896   ready

耐障害性、自動復帰など

kumo-server

kumo-manager

kumo-gateway

  • ソフトウェア的な障害を考慮するなら、kumo-gatewayをdaemontoolsで監視し、落ちたら自動的に再起動するような仕組みを構築

チューニング

データベースファイル

  • 最大の性能を得たいなら、kumo-serverのオプションでデータベースファイルを作るのではなく、tchmgrコマンドを使ってデータベースファイルを作成する
  • 最も重要なのはパケット数のチューニング
バケット数(bnum)=レコード数の約2倍 / 拡張メモリ(xmsiz)
  * 拡張メモリ:KVSに割り当てられるメモリ
  • 拡張メモリマップのサイズ(xmsiz), キャッシュ機構(rcnum)
    $ kumo-server -v -m localhost -l localhost:19801 -L 19901 -s "database.tch#xmsiz=600m#rcnum=4k"

スレッド数

  • kumo-server, kumo-gateway
    • -TW <number=2> --write-threads number of threads for asynchronous writing
    • -TR <number=8> --read-threads number of threads for asynchronous reading

スケールアウト


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2017-04-09 (日) 20:47:09 (2563d)