summaryrefslogtreecommitdiffstats
path: root/doc/sphinx/Pacemaker_Explained/ap-samples.rst
blob: 641affc96edb29699d584a58940822d7174bb313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
Sample Configurations
---------------------

Empty
#####
   
.. topic:: An Empty Configuration

   .. code-block:: xml

      <cib crm_feature_set="3.0.7" validate-with="pacemaker-1.2" admin_epoch="1" epoch="0" num_updates="0">
        <configuration>
          <crm_config/>
          <nodes/>
          <resources/>
          <constraints/>
        </configuration>
        <status/>
      </cib>
   
Simple
######
   
.. topic:: A simple configuration with two nodes, some cluster options and a resource

   .. code-block:: xml

      <cib crm_feature_set="3.0.7" validate-with="pacemaker-1.2" admin_epoch="1" epoch="0" num_updates="0">
        <configuration>
          <crm_config>
            <cluster_property_set id="cib-bootstrap-options">
              <nvpair id="option-1" name="symmetric-cluster" value="true"/>
              <nvpair id="option-2" name="no-quorum-policy" value="stop"/>
              <nvpair id="option-3" name="stonith-enabled" value="0"/>
            </cluster_property_set>
          </crm_config>
          <nodes>
            <node id="xxx" uname="c001n01" type="normal"/>
            <node id="yyy" uname="c001n02" type="normal"/>
          </nodes>
          <resources>
            <primitive id="myAddr" class="ocf" provider="heartbeat" type="IPaddr">
              <operations>
                <op id="myAddr-monitor" name="monitor" interval="300s"/>
              </operations>
              <instance_attributes id="myAddr-params">
                <nvpair id="myAddr-ip" name="ip" value="192.0.2.10"/>
              </instance_attributes>
            </primitive>
          </resources>
          <constraints>
            <rsc_location id="myAddr-prefer" rsc="myAddr" node="c001n01" score="INFINITY"/>
          </constraints>
          <rsc_defaults>
            <meta_attributes id="rsc_defaults-options">
              <nvpair id="rsc-default-1" name="resource-stickiness" value="100"/>
              <nvpair id="rsc-default-2" name="migration-threshold" value="10"/>
            </meta_attributes>
          </rsc_defaults>
          <op_defaults>
            <meta_attributes id="op_defaults-options">
              <nvpair id="op-default-1" name="timeout" value="30s"/>
            </meta_attributes>
          </op_defaults>
        </configuration>
        <status/>
      </cib>
   
In the above example, we have one resource (an IP address) that we check
every five minutes and will run on host ``c001n01`` until either the
resource fails 10 times or the host shuts down.
   
Advanced Configuration
######################
   
.. topic:: An advanced configuration with groups, clones and STONITH

   .. code-block:: xml

      <cib crm_feature_set="3.0.7" validate-with="pacemaker-1.2" admin_epoch="1" epoch="0" num_updates="0">
        <configuration>
          <crm_config>
            <cluster_property_set id="cib-bootstrap-options">
              <nvpair id="option-1" name="symmetric-cluster" value="true"/>
              <nvpair id="option-2" name="no-quorum-policy" value="stop"/>
              <nvpair id="option-3" name="stonith-enabled" value="true"/>
            </cluster_property_set>
          </crm_config>
          <nodes>
            <node id="xxx" uname="c001n01" type="normal"/>
            <node id="yyy" uname="c001n02" type="normal"/>
            <node id="zzz" uname="c001n03" type="normal"/>
          </nodes>
          <resources>
            <primitive id="myAddr" class="ocf" provider="heartbeat" type="IPaddr">
              <operations>
                <op id="myAddr-monitor" name="monitor" interval="300s"/>
              </operations>
              <instance_attributes id="myAddr-attrs">
                <nvpair id="myAddr-attr-1" name="ip" value="192.0.2.10"/>
              </instance_attributes>
            </primitive>
            <group id="myGroup">
              <primitive id="database" class="lsb" type="oracle">
                <operations>
                  <op id="database-monitor" name="monitor" interval="300s"/>
                </operations>
              </primitive>
              <primitive id="webserver" class="lsb" type="apache">
                <operations>
                  <op id="webserver-monitor" name="monitor" interval="300s"/>
                </operations>
              </primitive>
            </group>
            <clone id="STONITH">
              <meta_attributes id="stonith-options">
                <nvpair id="stonith-option-1" name="globally-unique" value="false"/>
              </meta_attributes>
              <primitive id="stonithclone" class="stonith" type="external/ssh">
                <operations>
                  <op id="stonith-op-mon" name="monitor" interval="5s"/>
                </operations>
                <instance_attributes id="stonith-attrs">
                  <nvpair id="stonith-attr-1" name="hostlist" value="c001n01,c001n02"/>
                </instance_attributes>
              </primitive>
            </clone>
          </resources>
          <constraints>
            <rsc_location id="myAddr-prefer" rsc="myAddr" node="c001n01"
              score="INFINITY"/>
            <rsc_colocation id="group-with-ip" rsc="myGroup" with-rsc="myAddr"
              score="INFINITY"/>
          </constraints>
          <op_defaults>
            <meta_attributes id="op_defaults-options">
              <nvpair id="op-default-1" name="timeout" value="30s"/>
            </meta_attributes>
          </op_defaults>
          <rsc_defaults>
            <meta_attributes id="rsc_defaults-options">
              <nvpair id="rsc-default-1" name="resource-stickiness" value="100"/>
              <nvpair id="rsc-default-2" name="migration-threshold" value="10"/>
            </meta_attributes>
          </rsc_defaults>
        </configuration>
        <status/>
      </cib>