Is it possible to configure pacemaker with a configuration file?

13,300

Definitely. Create a configuration file (named 'cib.txt', in our example) with the same syntax you've used in your example commands:

primitive VIP ocf:heartbeat:IPaddr2 params ip=10.0.2.200 nic=eth0 \
    op monitor interval=10s timeout=20s \
    op start interval=0 timeout=20s \
    op stop interval=0 timeout=20s

Then you can load that file using the following CRM shell command:

# crm configure load update cib.txt

or completely replace the configuration:

# crm configure load replace cib.txt

NOTE: You can export the configuration from a cluster, for use on a new cluster or for backup purposes, with the following command:

# crm configure show > cib.txt

WARN: Be sure to cut out anything specific to the original cluster if you intend to load it elsewhere (node id's, dc-version, last-lrm-refresh, etc).

Share:
13,300

Related videos on Youtube

moomima
Author by

moomima

A Python developer

Updated on September 18, 2022

Comments

  • moomima
    moomima almost 2 years

    I'm trying to configure pacemaker with a config file (that I can automatically generate and then ask pacemaker to "reload"). But all the examples that I see are for command-line commands or the interactive editor. (I'm running Ubuntu).

    The command-line approach is something like this:

    crm configure primitive VIP ocf:IPaddr2 params ip=10.0.2.200 nic=eth0 op monitor interval=10s
    

    While the interactive mode is something like this:

    sudo crm configure
    And then we add the res_ip resource:
    
    crm(live)configure# primitive res_ip ocf:heartbeat:IPaddr2 params ip="102.169.122.254" cidr_netmask="24" nic="eth0"
    crm(live)configure# commit
    crm(live)configure# exit
    

    But I want a static config file that I can update and reload. Something like the /etc/ha.d/haresources file that heartbeat uses. Is that a possibility?

  • moomima
    moomima over 9 years
    Awesome! All three commands that you explained are great!
  • Naveed Abbas
    Naveed Abbas about 9 years
    This only works for pacemaker < 1.1.18, there is no "crm" now.
  • Matt Kereczman
    Matt Kereczman about 9 years
    'crmsh' (the crm shell) used to be a part of Pacemaker, but was split into it's own project long ago. You can still get from here if you prefer it: crmsh.github.io
  • FreeSoftwareServers
    FreeSoftwareServers about 8 years
    Is there a a version of this command for the newer management shell? cman, pcs?
  • FreeSoftwareServers
    FreeSoftwareServers about 8 years
    Or could I load crmsh, and just use it for this purpose?
  • Matt Kereczman
    Matt Kereczman about 8 years
    You can install and use both crmsh and pcs to manage your Pacemaker config without causing issues. SUSE packages crmsh for the more popular distros here: software.opensuse.org/…