a little riak book

來源:互聯網
上載者:User

標籤:class   blog   code   http   ext   get   

a little riak book 的無聊總結
<pre name="code" class="python">#!/bin/bash#   Riak HTTP interface stays true to their intent: 1xx Informational, 2xx Success,#   3xx Further Action, 4xx Client Error, 5xx Server Error### putPORT=10018url=http://localhost:$PORT/riakcase $1 in    -1  )            echo "Nothing"            ;;    ## put    1   )   curl -v -X PUT $curl/food/favorite                    -H  'Content-Type: text/plain'                  -d 'pizza'        ;;    ## get    2   )   curl -i -v -X GET $url/food/favorite        ;;    ## POST --> with POST a key is optional, All it require is a bucket name , and    ## it will generate a key you    3   )   curl -i -X POST $url/people                 -H  'Content-Type: application/json'                    -d  '{"name": "aaron"}'        ;;    ## for any kind of write, you can add the returnbody=true parameter to force a value return,    ## 和值相關的頭, 如X-Riak-Vclock, ETa這些都會被返回.    ## post 也支援returnbody, get 會自動返回body,body才是內容,okey    4   )   curl -i -X POST $url/people             -H  'Content-Type: application/json'                -d  '{"name": "billy"}'        ;;    ## Delete:    ##  1 . 刪除一個已經被刪除的對象在Riak中會被表示為deleted,可以打一個 tombstone 標籤。然後,    ##  一個死神進程會被調用,這個進程會以背景方式清理掉這些marked objs(可能的話,死神進程因該    ##  關掉),    ##  2. 有兩點需注意:    ##      A) 在Riak中,刪除的操作與屬於一個寫的操作,在計算讀寫比率時候,也因該這樣考慮    ##      B) 檢查一個存在的key並不能說明他對應的對象是否存在,因為你可能讀到的key可能是在'刪除和    ##  備份的期間',所以你必須要讀到 tombstones為止,才能說明一個key已被刪除了    5   )   curl -i -X POST $url/people/test                    -H  'Content-Type: application/json'                    -d  '{"name": "billy"}'            echo "=========="            curl -i $url/people/test?returnbody=true            echo "-----------"            curl -i -X DELETE $url/people/test        ;;    ## Lists -> Riak有兩種不同lists,第一種列出叢集中的所有buckets,第二種會根據指定的buckets列出所有的key,調用的方式相似,都是傳入兩個參數    6   )curl -i $url?buckets=trueecho ""echo "==================="curl -i $url/food?keys=trueecho ""echo "-------------------";; ## Lists 也可以流的方式傳輸7)curl -v $url/food?list=stream;;esac




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.