#まずは準備 yum install gcc gcc-c++ glibc-devel make git glibc-devel make ncurses-devel openssl-devel autoconf #kerlおとしてビルド curl -O https://raw.github.com/spawngrid/kerl/master/kerl;chmod +x kerl ./kerl build R15B01 r15b01 #erlangインストール wget http://erlang.org/download/otp_src_R15B01.tar.gz tar zxvf otp_src_R15B01.tar.gz cd otp_src_R15B01 ./configure && make && sudo make install #riak入れる 先に、elrangをPATHに通しとくこと curl -O http://downloads.basho.com.s3-website-us-east-1.amazonaws.com/riak/1.2/1.2.1/riak-1.2.1.tar.gz tar zxvf riak-1.2.1.tar.gz cd riak-1.2.1 make rel #設定ファイル vim /opt/riak-1.2.1/rel/riak/etc/app.config ※protocol buffer使う場合 {pb_ip, "xxx.xxx.xxx.101" }, ※httpのポート指定 {http, [ {"xxx.xxx.xxx.101", 8098 } ]}, ※bitcask使う場合 {storage_backend, riak_kv_bitcask_backend}, #bitcaskの格納先変更 %% Bitcask Config {bitcask, [ {data_root, "/data/riak/bitcask"} ]}, #vm.args編集 vim /opt/riak-1.2.1/rel/riak/etc/vm.args -name riak@XXX.XXX.XXX.101 #bitcaskのデータ格納先をつくっておく。とりまxfsでマウント。 #option /dev/sdb1 on /data type xfs (rw,noatime,nodiratime,nobarrier,logbufs=8) cd /data mkdir -p riak/ring mkdir -p riak/bitcask chown -R riak: riak/* #起動 /opt/riak-1.2.1/rel/riak/bin/riak start #いったんステータスみてみる riak-admin member-status Attempting to restart script through sudo -H -u riak ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 100.0% -- 'riak@xxx.xxx.xxx.101' ------------------------------------------------------------------------------- Valid:1 / Leaving:0 / Exiting:0 / Joining:0 / Down:0 #ほかの何台かのnodeをクラスタに組み込んでみる ./riak-admin cluster join riak@xxx.xxx.xxx.102 Success: staged join request for 'riak@xxx.xxx.xxx.102' to 'riak@xxx.xxx.xxx.101' ※なんか、同じサーバから複数の台数にjoinさせようとすると失敗するので注意 #clusterがどうなるかのチェック ./riak-admin cluster plan =============================== Staged Changes ================================ Action Nodes(s) ------------------------------------------------------------------------------- join 'riak@xxx.xxx.xxx.101' join 'riak@xxx.xxx.xxx.102' join 'riak@xxx.xxx.xxx.103' join 'riak@xxx.xxx.xxx.104' ------------------------------------------------------------------------------- NOTE: Applying these changes will result in 2 cluster transitions ############################################################################### After cluster transition 1/2 ############################################################################### ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 20.3% 25.0% 'riak@xxx.xxx.xxx.101' valid 20.3% 25.0% 'riak@xxx.xxx.xxx.102' valid 20.3% 25.0% 'riak@xxx.xxx.xxx.103' valid 20.3% 25.0% 'riak@xxx.xxx.xxx.104' ------------------------------------------------------------------------------- Valid:4 / Leaving:1 / Exiting:0 / Joining:0 / Down:0 Transfers resulting from cluster changes: 48 [5/4071] 3 transfers from 'riak@xxx.xxx.xxx.101' to 'riak@xxx.xxx.xxx.103' 3 transfers from 'riak@xxx.xxx.xxx.102' to 'riak@xxx.xxx.xxx.103' 3 transfers from 'riak@xxx.xxx.xxx.104' to 'riak@xxx.xxx.xxx.103' 3 transfers from 'riak@xxx.xxx.xxx.101' to 'riak@xxx.xxx.xxx.102' 3 transfers from 'riak@xxx.xxx.xxx.103' to 'riak@xxx.xxx.xxx.102' 3 transfers from 'riak@xxx.xxx.xxx.104' to 'riak@xxx.xxx.xxx.102' 3 transfers from 'riak@xxx.xxx.xxx.102' to 'riak@xxx.xxx.xxx.101' 3 transfers from 'riak@xxx.xxx.xxx.101' to 'riak@xxx.xxx.xxx.104' 3 transfers from 'riak@xxx.xxx.xxx.103' to 'riak@xxx.xxx.xxx.101' 3 transfers from 'riak@xxx.xxx.xxx.102' to 'riak@xxx.xxx.xxx.104' 3 transfers from 'riak@xxx.xxx.xxx.104' to 'riak@xxx.xxx.xxx.101' 3 transfers from 'riak@xxx.xxx.xxx.103' to 'riak@xxx.xxx.xxx.104' ############################################################################### After cluster transition 2/2 ############################################################################### ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 25.0% -- 'riak@xxx.xxx.xxx.101' valid 25.0% -- 'riak@xxx.xxx.xxx.102' valid 25.0% -- 'riak@xxx.xxx.xxx.103' valid 25.0% -- 'riak@xxx.xxx.xxx.104' ------------------------------------------------------------------------------- Valid:4 / Leaving:0 / Exiting:0 / Joining:0 / Down:0 #clusterの状態をキメル ./riak-admin cluster commit Cluster changes committed #状態みてみる #ゆくりリバランスされるみたい ./riak-admin member-status ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 39.1% 20.3% 'riak@xxx.xxx.xxx.101' valid 40.6% 20.3% 'riak@xxx.xxx.xxx.102' valid 7.8% 20.3% 'riak@xxx.xxx.xxx.103' valid 6.3% 20.3% 'riak@xxx.xxx.xxx.104' ------------------------------------------------------------------------------- Valid:5 / Leaving:0 / Exiting:0 / Joining:0 / Down:0 ./riak-admin member-status ================================= Membership ================================== Status Ring Pending Node ------------------------------------------------------------------------------- valid 25.0% -- 'riak@xxx.xxx.xxx.101' valid 25.0% -- 'riak@xxx.xxx.xxx.102' valid 25.0% -- 'riak@xxx.xxx.xxx.103' valid 25.0% -- 'riak@xxx.xxx.xxx.104' ------------------------------------------------------------------------------- Valid:5 / Leaving:0 / Exiting:0 / Joining:0 / Down:0 #cluster外すときは riak-admin cluster leave riak@xxx.xxx.xxx.101 #からのplan commitでいける #bucketの作成 #細かいパラメータはまだしらべてるのでおまちを。 curl -i -H "Content-Type: application/json" http://xxx.xxx.xxx.101:8098/riak/yattarou HTTP/1.1 200 OK Vary: Accept-Encoding Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue) Date: Fri, 09 Nov 2012 08:07:57 GMT Content-Type: application/json Content-Length: 426 {"props":{"name":"yattarou","allow_mult":false,"basic_quorum":false,"big_vclock":50,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"dw":"quorum","last_write_wins":false,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"n_val":3,"notfound_ok":true,"old_vclock":86400,"postcommit":[],"pr":0,"precommit":[],"pw":0,"r":"quorum","rw":"quorum","small_vclock":50,"w":"quorum","young_vclock":20}} #objectのup curl -v -T test.jpg -X PUT -H "Content-Type: image/jpeg http://xxx.xxx.xxx.101/riak/testいったんここまで。
2012年11月9日金曜日
riak構築太郎
riakの構築手順だんお(*´ω`*)
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿