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