首页 > 数据库 > mysql教程 > alittleriakbook

alittleriakbook

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
发布: 2016-06-07 15:57:45
原创
1093 人浏览过

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://localhos

a little riak book 的无聊总结

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

<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

 

 

### put

 

PORT=10018

url=http://localhost:$PORT/riak

case $1 in

    -1  )

            echo "Nothing"

            ;;

    ## put

    1   )   curl -v -X PUT $curl/food/favorite    \

                -H  &#39;Content-Type: text/plain&#39;  \

                -d &#39;pizza&#39;

        ;;

    ## 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  &#39;Content-Type: application/json&#39;    \

                -d  &#39;{"name": "aaron"}&#39;

        ;;

    ## 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  &#39;Content-Type: application/json&#39;    \

            -d  &#39;{"name": "billy"}&#39;

        ;;

    ## Delete:

    ##  1 . 删除一个已经被删除的对象在Riak中会被表示为deleted,可以打一个 tombstone 标签。然后,

    ##  一个死神进程会被调用,这个进程会以后台的方式清理掉这些marked objs(可能的话,死神进程因该

    ##  关掉),

    ##  2. 有两点需注意:

    ##      A) 在Riak中,删除的操作与属于一个写的操作,在计算读写比率时候,也因该这样考虑

    ##      B) 检查一个存在的key并不能说明他对应的对象是否存在,因为你可能读到的key可能是在&#39;删除和

    ##  备份的期间&#39;,所以你必须要读到 tombstones为止,才能说明一个key已被删除了

    5   )   curl -i -X POST $url/people/test    \

                -H  &#39;Content-Type: application/json&#39;    \

                -d  &#39;{"name": "billy"}&#39;

            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=true

            echo ""

            echo "==================="

            curl -i $url/food?keys=true

            echo ""

            echo "-------------------"

        ;;

    ## Lists 也可以流的方式传输

    7   )   curl -v $url/food?list=stream

        ;;

esac

登录后复制

1

 

登录后复制


相关标签:
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板