Thread

  1. 5 Instances in one box -- Postgresql.conf Archive Log command

    Subramanian,Ramachandran <ramachandran.subramanian@alte-leipziger.de> — 2026-02-09T09:35:06Z

    Hello,
    
    We have 5 instances running under  different ports and we have multiple servers with the same structure. i.e. I have multiple servers with the same five instances per server configuration.
    
    /var/lib/pgsql/INST1/data - Port number 1234
    /var/lib/pgsql/INST2/data - Port number 1235
    /var/lib/pgsql/INST3/data - Port number 1236
    /var/lib/pgsql/INST4/data - Port number 1237
    /var/lib/pgsql/INST5/data - Port number 1238
    
    I try to make changes to postgresql.conf  in our sandbox/testing server for just one instance and I simply copy over the changes to all the instances and then to all the servers.
    
    I want to place the archived WALs in separate directories for each instance.  How can I introduce the INST1 INST2 INST3 INST4 names in the archive command  variable /mnt/server/archivedir , without explicitly editing changing each postgresql.conf file? It is not absolutely important for me that the archive log directories bear the exact names INST1 2 3 ..5. however, I want the archive log directories to be resolved to unique names based on which instance the archive is done.
    
    Thank you in advance for your time.
    
    LG
    
    Ram
    
    archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'  # Unix
    
    
    
    Freundliche Grüße
    
    i. A. Ramachandran Subramanian
    Zentralbereich Informationstechnologie
    
    Alte Leipziger Lebensversicherung a.G.
    
    
    Hallesche Krankenversicherung a.G.
    
    
    
    
    
    Alte Leipziger Lebensversicherung a.G., Alte Leipziger-Platz 1, 61440 Oberursel
    Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape, Wiltrud Pekarek, Udo Wilcsek
    Sitz Oberursel (Taunus) · Rechtsform VVaG · Amtsgericht Bad Homburg v. d. H. HRB 1583 · USt.-IdNr. DE 114106814
    
    
    
    
    
     
    Hallesche Krankenversicherung a.G.,  Löffelstraße 34-38, 70597 Stuttgart
    Vors. des Aufsichtsrats: Dr. Walter Botermann · Vorstand: Christoph Bohn (Vors.), Dr. Jürgen Bierbaum (stv. Vors.), Frank Kettnaker, Dr. Jochen Kriegmeier, Alexander Mayer, Christian Pape,
    Wiltrud Pekarek, Udo Wilcsek
    Sitz Stuttgart · Rechtsform VVaG · Amtsgericht Stuttgart HRB 2686 · USt.-IdNr. DE 147802285
    Beiträge zu privaten Kranken- und Pflegekrankenversicherungen unterliegen nicht der Versicherungsteuer (§ 4 Nr. 5 VersStG) · Versicherungsleistungen sowie Umsätze aus Versicherungsvertreter-/Maklertätigkeiten sind umsatzsteuerfrei
     
    
    
    
     
    Die Pflichtangaben der ALH Gruppe gemäß § 35a GmbHG bzw. § 80 AktG finden Sie hier: https://www.alte-leipziger.de/impressum 
    
    
    
    
    
    ______________________
    
    ALH Gruppe
    Alte Leipziger-Platz 1, 61440 Oberursel
    Tel.: +49 (6171) 66-4882
    Fax: +49 (6171) 66-800-4882
    E-Mail: ramachandran.subramanian@alte-leipziger.de
    www.alte-leipziger.de
    www.hallesche.de
    
    
  2. Re: 5 Instances in one box -- Postgresql.conf Archive Log command

    Greg Sabino Mullane <htamfids@gmail.com> — 2026-02-09T17:44:02Z

    You cannot do that natively with Postgres. However, one solution would be
    to make the archive_command into a separate file, that the main
    postgresql.conf includes. Then you can keep copying the postgresql.conf but
    keep the archive_command separate and unique. The syntax is
    
    include = 'myserver.conf'
    
    And then the myserver.conf would contain things specific to each server,
    e.g.
    
    archive_command = 'test ! -f /archives/INST3/%f && cp %p /archives/INST3/%f'
    cluster_name = 'inst3'
    
    
    Cheers,
    Greg