Scripting the Zeus/Stingray API

August 07, 2012 - by joyentlindsay

Joyent's Senior Solutions Architect Peter Yorke released an image yesterday to automate Zeus/Stingray load balancer set up.  Here's the shell script, but you have to see how the script works broken down by line, plus variations and tips.  

For frequent updates and new images be sure to visit https://help.joyent.com

So you are digging the Joyent API, you have your provisioning working with your Chef or Puppet Scripts.

Here is a shell script you can use to add that new box to your Stingray load balancer.

#!/bin/bash

zxtm=localhost

/opt/zeus/zxtm/bin/zcli << EOF

Pool.addPool ["JoyentDemo"],[["help.joyent.com:80","joyent.com:80","wiki.joyent.com:80"]]

Pool.setLoadBalancingAlgorithm ["JoyentDemo"], roundrobin

Pool.setPassiveMonitoring ["JoyentDemo"], 0

Pool.setMonitors ["JoyentDemo"], "Full HTTP"

Pool.setKeepalive ["JoyentDemo"], 1

VirtualServer.addVirtualServer ["JoyentDemo"],{"default_pool" : "JoyentDemo","port" : "80","protocol":"http"}

VirtualServer.setCompressionEnabled ["JoyentDemo"], yes

VirtualServer.setEnabled ["JoyentDemo"], 1

exit

EOF

Read More »

:

Sign up Now for Instant Cloud Access

Get Started

View PricingSee Benchmarks