# PITRTools: Multiple slave support

> I gave a lightning talk at Pg Conference: West 08 about a tool that I have developed call PITRTools. PITRTools is a python based log shipping utility. Essentia…

I gave a lightning talk at [Pg Conference: West 08](<http://www.postgresqlconference.org/>) about a tool that I have developed call PITRTools. PITRTools is a python based log shipping utility. Essentially it wraps itself around standard tools such as rsync, and pg_standby to provide a usable experience. Some of the features is provides are: 

>   * Auto initialization of environment 
>   * Simple base backups 
>   * Monitoring of Master 
>   * Arbitrary alerts 
>   * Failover 
>   * Failover actions 
>   * etc... 
> 


In all it is by far the simplest and most effective tool for PostgreSQL standby that I have used (of course I wrote it so...). One of the features recently added to PITRTools is multi-slave support. The way it works is like this: 
    
    
       Archiver checks for logs in local queue
          if found
             archiver attempts to sends (queued) logs to slave N
             if success
                archiver sends new archive to slave N
                if success
                   continue
                if fail
                   archive local
                   if success 
                      continue
                   if fail
                      bail out really loudly (FATAL)
                   exit 1
             if fail
                archive local
                if success 
                      continue
                   if fail
                      bail out really loudly (FATAL)
                   exit 1
          if not found
             Archiver sends log to Slave N
             if success
                continue
             if fail
                archive local (queue)
                if success
                   continue
                if fail
                   bail out really loudly (FATAL)
             continue
       if fail
          queue
          exit 1
       exit 0
    

One of the key requirements of PITRTools was no extra support. It requires no extra Python modules just Python >= 2.5 AND Python <= 2.6. No it is not 3.0 safe, but will be soon enough. Give it a whirl and let us know what you think, its BSD licensed. To get PITRTools you can check it out like so: 
    
    
    svn co https://projects.commandprompt.com/public/pitrtools/repo pitrtools
    

It's BSD licensed. Have at it.

---
[View this page online](https://www.commandprompt.com/blog/pitrtools_multiple_slave_support/)