A little Riak book

Source: Internet
Author: User
Tags riak

A little Riak book boring Summary
<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 o Ptional, 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, # headers related to values, such as X-Riak-vclock and ETA, will be returned. # post also supports returnbody. Get will automatically return the body, the body is the content, okey 4) curl-I-X Post $ URL/People-H 'content-ty PE: Application/JSON '-d' {"name": "Billy"}'; ## Delete: ## 1. deleting a deleted object is represented as deleted in Riak. You can create a tombstone tag. Then, # A death process will be called, and this process will clean up these marked objs in the future (if possible, the Death Process should be turned off), ## 2. there are two points to note: # A) In Riak, the delete operation is a write operation. This is also the reason when calculating the read/write ratio ## B) checking an existing key does not indicate whether the corresponding object exists, because the key you may read may be during 'deletion and # backup time ', therefore, you must read tombstones to indicate that a key has been deleted. 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 has two different lists, the first method is to list all the buckets in the cluster. The second method is to list all the keys based on the specified buckets. The call method is similar. Both parameters are input. 6) curl-I $ URL? Buckets = trueecho "" Echo "======================" curl-I $ URL/food? Keys = trueecho "" Echo "-------------------" ;## lists can also be transmitted in stream mode 7) curl-V $ URL/food? List = stream; esac

 
 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.