Linux – Why does pacemaker start on the secondary node instead of the primary

corosynclinuxpacemakerresources

I have two Linux nodes running httpd service.
When I try to add the httpd resource on the primary node, the service starts on the second node instead of starting on the primary.

What am I missing here?

Initial settings:

node vpc-storage-primary \
        attributes standby="off"
node vpc-storage-secondary \
        attributes standby="off"
property $id="cib-bootstrap-options" \
        dc-version="1.1.9-55.2-2db99f1" \
        cluster-infrastructure="classic openais (with plugin)" \
        expected-quorum-votes="2" \
        stonith-enabled="false" \
        no-quorum-policy="ignore" \
        migration-threshold="2" \
        last-lrm-refresh="1370680015"
rsc_defaults $id="rsc-options" \
        resource-stickiness="100"

crm_mon:

Last updated: Sat Jun  8 09:41:20 2013
Last change: Sat Jun  8 09:28:49 2013 via cibadmin on vpc-storage-primary
Stack: classic openais (with plugin)
Current DC: vpc-storage-primary - partition with quorum
Version: 1.1.9-55.2-2db99f1
2 Nodes configured, 2 expected votes
0 Resources configured.


Online: [ vpc-storage-primary vpc-storage-secondary ]

The service I would like to add on the primary:

crm configure primitive httpd lsb:httpd \
    op monitor interval="30s" timeout="60" \
    op start interval="0" timeout="60" \
    op stop interval="0"

Best Answer

The setting that is missing is the preferred node.

You can first add the resource, and configure the preferred node to run it afterwards.

It is recommended to assign a weight below the stickiness of the resource to avoid unwanted downtime in the case of failover.

Check the pacemaker docs for a complete example.