This directory is to demostrate the "container linking" feature of Docker, using wrk (written in C and Lua), Spray (written in Scala), Fluentd (written in Ruby), and Elasticsearch + Kibana (written in Java) as example.
Prepare environments for experiment.
CAUTION: This may take minutes. Do it at a place with good bandwidth.
$ docker pull williamyeh/wrk
$ docker pull williamyeh/spray-httpserver
$ docker pull williamyeh/fluentd
$ docker pull digitalwonderland/elasticsearch
-
Clear all unused container records:
$ docker rm `docker ps --no-trunc -a -q` -
Start the http server (with the container name
spray):$ docker run -d --name spray \ williamyeh/spray-httpserver -
Tail the logs of the http server, and keep this console open:
$ docker logs -f spray -
Open another console. Use
wrkto benchmark the http server:$ docker run --link spray:httpserver \ williamyeh/wrk http://httpserver:8080/ -
Use
wrkto benchmark the http server, with random IPs as input:$ docker run --link spray:httpserver \ -v `pwd`:/data \ williamyeh/wrk -s wrk-script.lua http://httpserver:8080/ -
Generate Fluentd conf file
td-agent.conffor capturing logs produced by thespraycontainer:$ ./gen-fluentd-conf.sh spray > td-agent.conf -
Use
fluentdto collect thespraylogs:$ docker run -it \ -v /var/lib/docker/containers:/var/lib/docker/containers:ro \ -v `pwd`:/etc/td-agent:ro \ -v `pwd`:/data \ --net=host \ williamyeh/fluentd start -
Re-run previous
wrktask to see thefluentdoutput! -
Start the
Elasticsearchserver:$ docker run -d --name elasticsearch \ -p 9200:9200 \ digitalwonderland/elasticsearch -
Use browser to open the Kibana page: http://localhost:9200/_plugin/kibana3/
-
You may also re-run previous
wrktask to see the Kibana dashboard!
