Hi fellow Scalr users!

Over the past few weeks, we've seen quite a few posts on this mailing list 
and Scalr's support portal that related to how you can do service 
autodiscovery using Scalr. That is, on how you can get your app servers to 
find our where their backend is, and similar things.

So, of course, one solution is to use dedicated software (Zookeeper, 
Etcd...). 

But for smaller projects, that might be overkill. I wanted to share with 
you a few Scalr facilities that can help you do service autodiscovery out 
of the box, using Scalr. Note that Scalr has had those for a while, but 
that they haven't always been documented. So here we go!


*The Scalarizr Admin Interface (a.k.a szradm)*

Every Scalr-managed server has this installed by default. Located at 
/usr/local/bin/szradm, this fancy tool will let you access data from Scalr 
from any instance Scalr is installed on.

You can use it to list the roles and servers that present in your Farm 
using /usr/local/bin/szradm -q list-roles

And you can use it to retrieve role-specific infomation using 
/usr/local/bin/szradm 
-q list-farm-role-params farm-role-id=$FarmRoleID


*The Scalarizr Server Directory*
*
*
Scalarizr automatically maintains an up-to-date, file-based, database of 
the servers in your Farm. This is useful if you just need to figure out 
what a server's IP is (typically useful for e.g. Memcached):

It's located at /etc/scalr/private.d/hosts, and includes pretty much what 
you would expect:

root@ip-10-0-3-186:~# tree /etc/scalr/private.d/hosts
/etc/scalr/private.d/hosts
├── base
│ ├── 10.0.1.153
│ └── 10.0.1.167
├── base64-ubuntu1204
│ ├── 10.0.1.153
│ └── 10.0.1.167
├── chef
│ ├── 10.0.1.153
│ ├── 10.0.1.167
│ ├── 10.0.2.248
│ └── 10.0.2.58
├── mysql2
│ ├── 10.0.2.248
│ └── 10.0.2.58
└── mysql64-ubuntu1204
├── 10.0.2.248
└── 10.0.2.58
5 directories, 12 files


*Sample usage*

If you're curious about how you could use those, we've put together an 
example script here on 
Github: 
https://github.com/scalr-tutorials/3-tier-app/blob/master/scripts/autodiscovery.py

This is a Pythonic interface to szradm, and it's used in the "3 tier app" 
tutorial (http://wiki.scalr.com/x/_RBx), where the app role uses that 
service to figure out where MySQL is, and how to connect to it.



Hope this clears out some questions about how we use those,

Let us know what you think,



PS: this is now all documented on the wiki at http://wiki.scalr.com/x/KhJx

-- 
You received this message because you are subscribed to the Google Groups 
"scalr-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to