Skip to content
Chris Suttles edited this page Dec 30, 2015 · 13 revisions

What's the difference between 'ALL' and 'CLUSTER'?

  • The difference is what is defined in the YAML file. In this example, they are the same, but they can be different. CLUSTER is the default key, so if you omit the key, you will get :CLUSTER, but you must explicitly ask for :ALL.

    ALL:

    • hostname1
    • hostnam2 CLUSTER:
    • hostname1
    • hostname2 CONFIG: app-config-version-1.2.3 CONTAINER: appname CONTEXTPATH:

how do you query HOSTS and GROUPS?

The basic syntax is:

  • %HOSTS and %GROUPS
  • %HOSTS:xyz has all the hosts that xyz is responsible for. @xyz is a shortcut for the above.
  • %GROUPS:abc has all the machines in the group abc and @abc is a shortcut.
  • %GROUPS:KEYS has all the group names.

also, there are set operations,

  • @xyz,-xyz901001 has all the hosts in xyz group except for xyz901001.
  • @xyz,&@abc has all the hosts both in group xyz and group abc.

Why do we need this?

The use of libcrange and mod_range is a very powerful tool for managing large groups of servers. When you have a very large environment (like Yahoo, Square, etc), it is very helpful to be able to make logical groupings of servers somewhere outside DNS. Additionally, libcrange provides an excellent shorthand, as well as set operations, in order to manipulate hostnames more effectively and more efficiently than any glob or loop possibly could.

Where can I find logs?

  • You can see queries in apache access and error logs
  • Some logging is in messages/syslog if things are not working (more often the case during setup/install)
  • You can attach strace to httpd and follow forks to get more detailed "logging" and insight into what mod_range and libcrange are doing
    • The following bash function works on RHEL7, should work on prior versions/Fedora too; it logs to /tmp/strace.log:

      strace_http ()
      {
          export pids=$(ps -ef | grep http | grep -v grep  | awk '{print $2}' | while read pid; do echo -ne "-p $pid "; done );
          strace -f $pids 2>&1 | tee /tmp/strace.log
      }
      
    • This can be handy if you are not sure what directory you should put files in or why mod_range/libcrange is not doing what you expect.

How important is the contents and order of /etc/range.conf?

  • VERY. Based on my experience, I would recommend enabling only the module you intend to use, e.g. if you intend to only use yaml files, your range.conf might look like:

     $ cat /etc/range.conf
     #loadmodule ip
     #loadmodule yst-ip-list
     loadmodule yamlfile
     #perlmodule LibrangeUtils
     #perlmodule LibrangeAdminscf
     #loadmodule nodescf
    
  • I only intend to use yaml files, and before commenting everything, else, including nodescf, libcrange only looked for .cf files to respond to a query.