- apt-get install -qq -yy git mercurial bison make curl
- wget -q https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer -O /tmp/gvm-installer
- bash /tmp/gvm-installer
- source ~/.gvm/scripts/gvm
- gvm install go1.4
- gvm use go1.4 --global
- go get github.com/mattn/gom
- gom install
- gom build
- cp aerospike_client /usr/local/sbin
- cp config.yaml /etc/aerospike_client.yaml
- edit /etc/aerospike_client.yaml
- run /usr/local/sbin/aerospike_client --config=/etc/aerospike_client.yaml
- brew install git mercurial bison curl
- wget -q https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer -O /tmp/gvm-installer
- bash /tmp/gvm-installer
- source ~/.gvm/scripts/gvm
- gvm install go1.4
- gvm use go1.4 --global
- go get github.com/mattn/gom
- gom install
- gom build
- ./aerospike_client --config=config.yaml
bins - user data ttl - meta argument with time until expiration version - record's generation pk - primary key of record
- Url for create new index is /v1/index/disk/demo/index_7782
- v1 - version
- index - action
- namespace - disk
- set - demo
- index name - index_7782
PUT /v1/index/disk/demo/index_7782 HTTP/1.1
Content-Length: 41
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: HTTPie/0.8.0
Host: localhost:8080
Content-Type: application/json; charset=utf-8
{"key": "user_id_7782", "type": "STRING"}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Dec 2014 15:34:19 GMT
Content-Length: 0
- Url for create new index is /v1/item/disk/demo/7782
- v1 - version
- item - action
- namespace - disk
- set - demo
- primary key - 7782
PUT /v1/item/disk/demo/7782 HTTP/1.1
Content-Length: 57
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: HTTPie/0.8.0
Host: localhost:8080
Content-Type: application/json; charset=utf-8
{"meta": {"ttl": 3600}, "bins": {"user_id_7782": "7782"}}
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Dec 2014 15:34:19 GMT
Content-Length: 0
GET /v1/item/disk/demo/7782 HTTP/1.1
Host: localhost:8080
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: HTTPie/0.8.0
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Dec 2014 15:34:19 GMT
Content-Length: 56
{"bins":{"user_id_7782":"7782"},"version":1,"ttl":3600, "pk": "7782"}
You can pass multiple Id that comma separated Server will return list of record or null when no record found
GET /v1/item/disk/demo/5,1,2,3,4,5,5 HTTP/1.1
Host: localhost:8080
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: HTTPie/0.8.0
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Dec 2014 15:34:20 GMT
Content-Length: 286
[null, {"bins":{"user_id":"xxxx"},"version":1,"ttl":159189797, "pk": "1"},{"bins":{"bin":"post_id_2","user_id":"user_1"},"version":3,"ttl":156955627, "pk": "2"},{"bins":{"bin":"post_id_3","user_id":"user_1"},"version":1,"ttl":156955620, "pk": "3"},{"bins":{"bin":"post_id_4","user_id":"user_1"},"version":1,"ttl":156955624, "pk": "4"}, null, null]
- Url for create new index is /v1/query/disk/demo/?user_id_7782=7782
- v1 - version
- query - action
- namespace - disk
- set - demo
- primary key - 7782
- filter statements - user_id_7782=7782, also you can pass multiple statements (example: user_id=user_x&action=new)
GET /v1/query/disk/demo/?user_id_7782=7782 HTTP/1.1
Host: localhost:8080
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: HTTPie/0.8.0
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Dec 2014 15:34:20 GMT
Content-Length: 63
[{"bins":{"user_id_7782":"7782"},"version":1,"ttl":156616459, "pk": "7782"}]
- aerospike-client-go doesn't support custom digest for key
- also aerospike-client-go dosn't support float data type conversion
get disk.user_id.some_key\r\n
VALUE disk.user_id.some_key 0 29\r\n
{"bla":"xxxxx","user_id":"1"}\r\n
END\r\n
if found or
END\r\n
when not found
set disk.user_id.some_key 0 15 32\r\n
{"bla": "xxxxx", "user_id": "1"}\r\n
STORED\r\n
where is:
- disk — namespace
- user_id — set
- some_key — primary key
delete disk.user_id.some_key\r\n
DELETED\r\n
or
NOT_FOUND\r\n