Skip to content

Instantly share code, notes, and snippets.

@wallnerryan
Last active August 29, 2015 14:22
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wallnerryan/7ccc5455840b76c07a70 to your computer and use it in GitHub Desktop.
Live Demo Stuffs

Demo Microservices with ScaleIO + Flocker on AWS

alt text

Micro Services
This cluster is using the ScaleIO Flocker Driver
[centos@ip-172-31-23-166 flocker-install]$ cat /etc/flocker/agent.yml 
version: 1
control-service:
  hostname: "ec2-52-26-67-23.us-west-2.compute.amazonaws.com"
dataset:
  backend: "scaleio_flocker_driver"
  username: "admin"
  password: "Scaleio123"
  mdm: "ip-172-31-23-165.us-west-2.compute.internal"
  protection_domain: "pdomain"
  ssl: True

App YML

"version": 1
"applications":
  "mongodbserver-demo":
    "image": "clusterhq/mongodb"
    "volume":
      "mountpoint": "/data/db"
      "maximum_size": "25769803776"
    "ports":
    - "internal": 27017
      "external": 27017
  "dockercontweets-web":
    "image": "wallnerryan/dockercon-tweets-web"
    "ports":
    - "internal": 8080
      "external": 8080
    "environment":
      "MONGOSERVER": "172.31.23.166"
  "dockercontweets-stream":
    "image": "wallnerryan/dockercon-tweets-stream"
    "environment":
      "TWITTER_TRACK": "#DockerCon"
      "MONGOSERVER": "172.31.23.166"
      "CONSUMER_KEY": "oDKR7yK2VwXoDzktl2qfPCTUM"
      "CONSUMER_SECRET": "ajztFPINSKoerhmhL9rbbFAKFsJnDmEcZRUSf43GENvjPQIVd6"
      "ACCESS_TOKEN_KEY": "242181712-iOslsi5Y2gl6VrLJhvA3W6lZVyclfbsGYumsil0E"
      "ACCESS_TOKEN_SECRET": "3XBeIQpqJYDHdHuvykUFLVyiUuNFyKsAcXLVZ1vVAvrFi"

Deploy 1node YML

"version": 1
"nodes":
 "172.31.23.166": ["mongodbserver-demo", "dockercontweets-web",  "dockercontweets-stream"]
 "172.31.23.165": []
 "172.31.23.164": []

Deploy the app

 flocker-tutorial/bin/flocker-deploy --verbose ec2-52-26-67-23.us-west-2.compute.amazonaws.com /etc/flocker/examples/dockercontweets-1node.yml /etc/flocker/examples/dockercontweets-app.yml

All 3 services should now exist on the first node in the cluster.

[root@ip-172-31-23-166 flocker]# docker ps
CONTAINER ID        IMAGE                                        COMMAND                CREATED             STATUS              PORTS                      NAMES
1bbfde247e3c        clusterhq/mongodb:latest                     "/bin/sh -c '/home/m   21 minutes ago      Up 21 minutes       0.0.0.0:27017->27017/tcp   flocker--mongodbserver-demo       
b2748c82e239        wallnerryan/dockercon-tweets-web:latest      "node /src/index.js"   22 minutes ago      Up 22 minutes       0.0.0.0:8080->8080/tcp     flocker--dockercontweets-web      
480e0324b27e        wallnerryan/dockercon-tweets-stream:latest   "node /src/stream.js   22 minutes ago      Up 22 minutes                                  flocker--dockercontweets-stream 

Watch the logs of the streaming service

docker logs  -f flocker--dockercontweets-stream

The streaming service looks for #DockerCon, and uploads to Mongo, we should see tweets pop up... also the object _id in MongoDB

RT @pranavs18: Can hardly contain my excitement for all of the @Docker fun and learning at @DockerCon 2015! #getcontained http://t.co/PDuVc…
[ { tweet: 'RT @pranavs18: Can hardly contain my excitement for all of the @Docker fun and learning at @DockerCon 2015! #getcontained http://t.co/PDuVc…',
    _id: 557b50abad948a0e00a70f25 } ]

Then visit the AWS Host url to see the latest #DockerCon tweet.

(http://ec2-52-26-67-23.us-west-2.compute.amazonaws.com:8080/)

Then we can list volumes with volumes CLI after we run our app for more info

sudo python /home/centos/flocker-install/unofficial-flocker-tools/flocker-volumes.py list
DATASET    SIZE     METADATA                 STATUS     SERVER                   
596beb7b   24.00G   name=mongodbserver-demo   attached   8700ae98 (172.31.23.166) 

Show that we have a ScaleIO Volume

[centos@ip-172-31-23-165 flocker-install]$ sudo /usr/bin/emc/scaleio/drv_cfg --query_vols
Retrieved 1 volume(s)
VOL-ID 4a8af52f00000003 MDM-ID 7b2f68df6e4c0b3e

Deploy 2node YML

"version": 1
"nodes":
 "172.31.23.166": ["dockercontweets-web",  "dockercontweets-stream"]
 "172.31.23.165": []
 "172.31.23.164": ["mongodbserver-demo"]

Move the database container to the other node (Migrations/Data Mobility)

 flocker-tutorial/bin/flocker-deploy --verbose ec2-52-26-67-23.us-west-2.compute.amazonaws.com /etc/flocker/examples/dockercontweets-2node.yml /etc/flocker/examples/dockercontweets-app.yml

The MongoDB container should now be moved over to the other host in the cluster

[centos@ip-172-31-23-165 ~]$ sudo docker ps -a
CONTAINER ID        IMAGE                      COMMAND                CREATED              STATUS              PORTS                      NAMES
f46105e368d2        clusterhq/mongodb:latest   "/bin/sh -c '/home/m   About a minute ago   Up About a minute   0.0.0.0:27017->27017/tcp   flocker--mongodbserver-demo 

Once the streaming service and the web client reconnect to MongoDB, everything should be working as it was before.

(visit to confirm) (http://ec2-52-26-67-23.us-west-2.compute.amazonaws.com:8080/)

ScaleIO Features for Volumes

  • Auto-rebuild and 2 copy replica
    • ScaleIO will recover from disk or host-node failure by replicating data lost to new cluster count or sds disk count.
  • Provides Limits for IOPS and Banwidth per volume per host
  • Provides Data Movement limits for recovery operations
  • Two layer or Hyper-converged deployments
  • Instant writable snapshots
  • DRAM Caching for read access on server RAM
  • Fault Sets, Storage Pools, Protection Domains
  • Integration with XtremCache for flash auto tiering, and RecoverPoint for replication and disaster recovery
ScaleIO Volume Limits per host

Note: more information on ScaleIO Performance can be found HERE

IO and Bandwidth

[root@ip-172-31-23-165 centos]# scli --help --all | grep -e "limit_[i|b]"
    --limit_iops <NUMBER>               Limit the volume IOPS.  The number of IOPS must be larger than 10. 0 means unlimited IOPS
    --limit_bandwidth <NUMBER>          Limit the volume network bandwidth in MB per second  0 means unlimited bandwidth

Can be used in the --set_sdc_volume_limits command

Usage: scli --set_sdc_volume_limits (--volume_id <ID> | --volume_name <NAME>) (--sdc_id <ID> | --sdc_name <NAME> | --sdc_guid <GUID> | --sdc_ip <IP>) (Options) [--i_am_sure]
Description: Set limits to the IOPS and bandwidth that one SDC generates for the specified volume
Parameters:
    --volume_id <ID>                    Volume ID
    --volume_name <NAME>                Volume name
    --sdc_id <ID>                       SDC ID
    --sdc_name <NAME>                   SDC name
    --sdc_guid <GUID>                   SDC guid
    --sdc_ip <IP>                       SDC IP address
    --i_am_sure                         Preemtive approval
    Options: CHOOSE AT LEAST ONE
    --limit_iops <NUMBER>               Limit the volume IOPS.  The number of IOPS must be larger than 10. 0 means unlimited IOPS
    --limit_bandwidth <NUMBER>          Limit the volume network bandwidth in MB per second  0 means unlimited bandwidth

Since ScaleIO is running on Amazon EBS SSD volumes, we can expect a certain amount IO available per volume. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-io-characteristics.html

We have 4 General purpose 100GB EBS SSDs which could give us 3IOPS/GiB so we get a total of ~900 IOPS in our small system. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html

Lets give our first flocker volume 100 IOPS limit

[root@ip-172-31-23-165 centos]# scli --set_sdc_volume_limits --volume_name fWWvre3lzU6ww+P70b3vNcw63067be3 --sdc_ip 52.26.67.23  --limit_iops 100 --i_am_sure
Successfully modified limits from SDC 52.26.67.23 to volume fWWvre3lzU6ww+P70b3vNcw63067be3:IOPS limit set to 100.

Slides used before for this Demo at ClusterHQ & EMC Meetups at Pivotal Labs June 21st 2015

(http://slides.com/ryanwallner/persistence-docker-chq-emc/live#/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment