2.3. How Should the Configuration be Updated?
There are three basic rules for updating the cluster configuration:
Rule 1 - Never edit the cib.xml file manually. Ever. I’m not making this up.
Rule 2 - Read Rule 1 again.
Rule 3 - The cluster will notice if you ignored rules 1 & 2 and refuse to use the configuration.
Now that it is clear how NOT to update the configuration, we can begin to explain how you should.
The most powerful tool for modifying the configuration is the cibadmin
command which talks to a running cluster. With cibadmin
, the user can query, add, remove, update or replace any part of the configuration; all changes take effect immediately, so there is no need to perform a reload-like operation.
The simplest way of using cibadmin is to use it to save the current configuration to a temporary file, edit that file with your favorite text or XML editor and then upload the revised configuration.
Example 2.4. Safely using an editor to modify the cluster configuration
# cibadmin --query > tmp.xml
# vi tmp.xml
# cibadmin --replace --xml-file tmp.xml
Some of the better XML editors can make use of a Relax NG schema to help make sure any changes you make are valid. The schema describing the configuration can normally be found in /usr/lib/heartbeat/pacemaker.rng on most systems.
If you only wanted to modify the resources section, you could instead do
Example 2.5. Safely using an editor to modify a subsection of the cluster configuration
# cibadmin --query --obj_type resources > tmp.xml
# vi tmp.xml
# cibadmin --replace --obj_type resources --xml-file tmp.xml
to avoid modifying any other part of the configuration.