Nathan, Rebuild /etc/aws/hosts is a script that runs automatically in response to certain events.
Go to Farms -> View All, then drop down OPTIONS for your farm and click Edit. Let's look at www role. I assume you have one of these. Under Shared Roles -> Load Balancers, click the www role you have on your farm. On the www tab on the right, click Scripting. You will see the available events on the left side of the Scripting tab. If you open up OnHostUp and click rebuild /etc/aws/hosts, then configuration options appear to the right side of the Scripting tab. I like to change the Where: field to All instances in the farm and the Execution mode: field to Asynchronous. I leave all the other settings at their default. I also do the same under OnIPAddressChanged and OnBeforeHostTerminate. These catch changes in my farm that are likely to change the number of instances running on my farm. There may be others that should be checked and there may be better ways to do this, yet this is what I use. Save. I then restart my farms, but this may not be necessary or even desirable in your case. I am not sure how to get the instances to see the changes any other way. Perhaps someone else can answer this. In my case, I need to know the other app role hosts that are up. The / etc/aws/hosts directory contains the internal IP address of all other hosts on the system and enabling the rebuild script makes sure the directory stays current. The script fragment I posted earlier gets all of the app servers and in my case, is used to tell them to rsync with a code repository elsewhere. On Mar 15, 10:59 am, Nathan Palmer <[email protected]> wrote: > Great, I will try this out. What do you mean enable rebuild in /etc/aws/hosts? > > Nathan > > On Sat, Mar 14, 2009 at 6:50 PM, jdMelton > > <[email protected]> wrote: > > > Nathan, > > > I do not know if the following will work for you if you need either > > the Public DNS or Elastic IP Addresses. > > > This is a cut-down version of a bash script that I run to get all of > > the app role private IP addresses: > > > #!/bin/bash > > # jdMelton > > # > > # Report undefined variables. > > shopt -s -o nounset > > # > > # Get the app server IP addresses. > > # If this script runs during a rebuild of /etc/aws/hosts, then ls will > > return > > # an error or the directory may be empty. So, loop until a count is > > obtained. > > declare -i APP_SERVER_COUNT=0 > > declare -a APP_DIRECTORY_ARRAY > > while [ $APP_SERVER_COUNT -lt 1 ]; do > > APP_DIRECTORY_ARRAY=($(ls /etc/aws/hosts/app 2> /dev/null)) > > app_server_count=${#app_directory_arr...@]} > > if [ $APP_SERVER_COUNT -lt 1 ]; then > > echo -n 'APP_SERVER_COUNT < 1 ' >> $MYLOGFILE; date >> > > $MYLOGFILE > > sleep 60s > > fi > > done > > > # Do something useful here. This just shows the results. > > declare APP_SERVER > > for APP_SERVER in ${app_directory_arr...@]}; do > > echo 'app role = '$APP_SERVER > > done > > > This can be repeated for www or any of the other roles. > > You could do something like this in php as well. > > I believe that you do need to enable rebuild /etc/aws/hosts in > > scripting to keep these up do date. > > > On Mar 13, 11:59 pm, Nathan Palmer <[email protected]> wrote: > >> That looks like it could work I'm just not sure how to use it. What > >> would be the easiest way to put this to use possibly in a php script? > >> I'm not sure how to use it in that way. I ran those commands from the > >> shell and got a result but I need to somehow get that information, > >> parse the xml and use it in a useful way. Can anyone point me to any > >> existing script snippets so I can see how I can apply it to my > >> situation? > > >> Thanks, > > >> Nathan > > >> On Fri, Mar 13, 2009 at 7:43 AM, Nickolas Toursky <[email protected]> wrote: > > >> > Hi Nathan, > > >> > Consider using QueryEnv Scalr API to do this (more details at > >> >http://code.google.com/p/scalr/wiki/QueryEnv). > >> > "list-roles" query response contains indexes for every instance within > >> > a role. > > >> > Nick > > >> > On Mar 13, 4:18 am, Nathan Palmer <[email protected]> wrote: > >> >> I'm trying to setup a script for my app role that will connect to the > >> >> gluster server that was created on the master role. I can start the > >> >> gluster server based on the %instance_index% = 1 but each additional > >> >> node that is started needs to get the IP address of the master node in > >> >> order to setup it's gluster configuration. Is there a way to do this? > > >> >> Thanks, > > >> >> Nathan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "scalr-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/scalr-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
