Trying out Rocket (Use ACI)

Trying out Rocket (Use ACI)

Trying out Rocket の続き

osがubuntuになっていますがcoreosでも同じ

ACIを持ってくる

Fetch

coreosが提供しているKey-Valueストア、etcdのaciを使ってみる

ubuntu@rocket-test:~$ cd rocket-v0.2.0/
ubuntu@rocket-test:~/rocket-v0.2.0$ sudo ./rkt fetch https://github.com/coreos/etcd/releases/download/v2.0.0/etcd-v2.0.0-linux-amd64.aci
rkt: fetching image from https://github.com/coreos/etcd/releases/download/v2.0.0/etcd-v2.0.0-linux-amd64.aci
Downloading aci: [============================                 ] 2.37 MB/3.7 MB
Downloading signature from https://github.com/coreos/etcd/releases/download/v2.0.0/etcd-v2.0.0-linux-amd64.sig
rkt: signature verified:
  CoreOS ACI Builder <release@coreos.com>
sha512-fa1cb92dc276b0f9bedf87981e61ecde

ACIを起動

ubuntu@rocket-test:~/rocket-v0.2.0$ sudo ./rkt run https://github.com/coreos/etcd/releases/download/v2.0.0/etcd-v2.0.0-linux-amd64.aci
rkt: fetching image from https://github.com/coreos/etcd/releases/download/v2.0.0/etcd-v2.0.0-linux-amd64.aci
/etc/localtime is not a symlink, not updating container timezone.
2015/02/08 05:57:29 no data-dir provided, using default data-dir ./default.etcd
2015/02/08 05:57:29 etcd: listening for peers on http://localhost:2380
2015/02/08 05:57:29 etcd: listening for peers on http://localhost:7001
2015/02/08 05:57:29 etcd: listening for client requests on http://localhost:2379
2015/02/08 05:57:29 etcd: listening for client requests on http://localhost:4001
2015/02/08 05:57:29 etcdserver: name = default
2015/02/08 05:57:29 etcdserver: data dir = default.etcd
2015/02/08 05:57:29 etcdserver: heartbeat = 100ms
2015/02/08 05:57:29 etcdserver: election = 1000ms
2015/02/08 05:57:29 etcdserver: snapshot count = 10000
2015/02/08 05:57:29 etcdserver: advertise client URLs = http://localhost:2379,http://localhost:4001
2015/02/08 05:57:29 etcdserver: initial advertise peer URLs = http://localhost:2380,http://localhost:7001
2015/02/08 05:57:29 etcdserver: initial cluster = default=http://localhost:2380,default=http://localhost:7001
2015/02/08 05:57:29 etcdserver: start member ce2a822cea30bfca in cluster 7e27652122e8b2ae
2015/02/08 05:57:29 raft: ce2a822cea30bfca became follower at term 0
2015/02/08 05:57:29 raft: newRaft ce2a822cea30bfca [peers: [], term: 0, commit: 0, applied: 0, lastindex: 0, lastterm: 0]
2015/02/08 05:57:29 raft: ce2a822cea30bfca became follower at term 1
2015/02/08 05:57:29 etcdserver: added local member ce2a822cea30bfca [http://localhost:2380 http://localhost:7001] to cluster 7e27652122e8b2ae
2015/02/08 05:57:30 raft: ce2a822cea30bfca is starting a new election at term 1
2015/02/08 05:57:30 raft: ce2a822cea30bfca became candidate at term 2
2015/02/08 05:57:30 raft: ce2a822cea30bfca received vote from ce2a822cea30bfca at term 2
2015/02/08 05:57:30 raft: ce2a822cea30bfca became leader at term 2
2015/02/08 05:57:30 raft.node: ce2a822cea30bfca elected leader ce2a822cea30bfca at term 2
2015/02/08 05:57:30 etcdserver: published {Name:default ClientURLs:[http://localhost:2379 http://localhost:4001]} to cluster 7e27652122e8b2ae

etcdのapiを叩いてみる

ubuntu@rocket-test:~/rocket-v0.2.0$ curl http://127.0.0.1:2379/version
{"releaseVersion":"2.0.0","internalVersion":"2"}
ubuntu@rocket-test:~/rocket-v0.2.0$ curl http://127.0.0.1:2379/v2/keys/hoge -XPUT -d value="piyo"
{"action":"set","node":{"key":"/hoge","value":"piyo","modifiedIndex":3,"createdIndex":3}}
ubuntu@rocket-test:~/rocket-v0.2.0$ curl http://127.0.0.1:2379/v2/keys/hoge
{"action":"get","node":{"key":"/hoge","value":"piyo","modifiedIndex":3,"createdIndex":3}}