Consulクラスタ内でファイルを分散配布する tuggle を書いた


github.com

?


HTTP使 Consul  daemon Go


 Stretcher 使  Stretcher 使

 AWS S3 (200300MB)S3stretcher -random-delay 5 (2.55) 100200MB6080MB/sec (10deploy S3 )

AWSAWSdelay

Consul HTTP 

使


README HTTP  PUT, GET, HEAD, DELETE 

Consul  node  tuggle (TCP 8900 listen )
[node{1,2,3}]$ mkdir /tmp/tuggle
[node{1,2,3}]$ tuggle -data-dir /tmp/tuggle

1 node  PUT 
[node1]$ curl -XPUT -H"Content-Type: application/gzip" --data-binary @test.gz localhost:8900/test.gz

 GET / 
[node1]$ curl -s localhost:8900 | jq .
[
  {
    "id": "6524a9d7b3bde0f3543f1ead0ae8604f",
    "name": "test.gz",
    "content_type": "application/gzip",
    "size": 8764510,
    "created_at": "2017-02-13T07:46:18.809409122Z"
  }
]

 node  tuggle  GET 
[node2]$ curl localhost:8900/test.gz > test.gz
[node2]$ ls -l test.gz
-rw-rw-r-- 1 foo bar 8764510 Feb 13 07:55 test.gz

 DELETE  PUT  node  DELETE 
[node1]$ curl -X DELETE localhost:8900/test.gz


tuggle 

tuggle  PUT 


 data-dir 

Consul KV 

Consul Service  name=tuggle tag=MD5  node 

(URL sync Consul Event  node  tuggle )


 node  Consul Service 

tuggleGETConsul KV


 data-dir 

Consul Service name=tuggle tag=MD5 nodeHTTP

 data-dir  Service 




 node  node 

DELETE node 


Consul KV 

Consul Eventtuggle


Stretcher 使 tuggle  PUT manifest  src: http://localhost:8900/foo.tar.gz 


 1 node  node 1  tuggle  Consul 1 node3

 node  Consul Service  node  node  node 

Consul 0.6  Consul Agent Service near=_agent  node 

AWS AZ (Availiability Zone)

使 -fetch-rate 使 shapeio 

https://github.com/fujiwara/shapeio

?


 node  Consul KV graphviz  dot 
$ curl "http://localhost:8900/test.gz?graph" > graph.dot
$ curl "http://localhost:8900/test.gz?graph&format=svg" > graph.svg

node  graphviz (dot ) format=(svg|png) 

 135MB  AWS  c4.large 50multi-az  (sync) 

f:id:sfujiwara:20170213180457p:plain
 node 18c4.large  70MB/sec 1100

() AZ AZAZ Consul Event 

f:id:sfujiwara:20170213180333p:plain



Consul Service 

1000Consul APIHTTP













 docker  make up docker-compose  8 node