Now the cluster is up, and we will have
to add cluster resources (e.g. VIP, MySQL DB store, MySQL DB service)
on top of the cluster. We only need to run this once on dbmaster-01 as the configuration changes will be written to cluster configuration file and being replicated to dbmaster-02.
- Configure misc cluster parameter
[root@dbmaster-01
~]# crm configure property stonith-enabled=false
[root@dbmaster-01
~]# crm configure property no-quorum-policy=ignore
[root@dbmaster-01
~]# crm configure property start-failure-is-fatal="false"
[root@dbmaster-01
~]# crm configure rsc_defaults resource-stickiness=100
- Configure VIP
[root@dbmaster-01
~]# crm configure primitive ClusterIP ocf:heartbeat:IPaddr2 params
ip=192.168.0.10 cidr_netmask=32 op monitor interval=10s meta
migration-threshold="10"
- Configure MySQL DB store, i.e. the shared-disk
[root@dbmaster-01
~]# crm configure primitive DBstore ocf:heartbeat:Filesystem params
device="/dev/sdb" directory="/mysql"
fstype="ext4" meta migration-threshold="10"
WARNING: DBstore:
default timeout 20s for start is smaller than the advised 60
WARNING: DBstore:
default timeout 20s for stop is smaller than the advised 60
- Configure MySQL services
[root@dbmaster-01
~]# crm configure primitive MySQL ocf:heartbeat:mysql params
binary="/usr/bin/mysqld_safe" config="/etc/my.cnf"
user="mysql" group="mysql" datadir="/mysql"
log="/mysql/mysqld.log" \
> op start
interval="0" timeout="60s" \
> op stop
interval="0" timeout="60s" \
> op monitor
interval="1min" timeout="60s" \
> meta
migration-threshold="10" target-role="Started"
WARNING: MySQL:
specified timeout 60s for start is smaller than the advised 120
WARNING: MySQL:
specified timeout 60s for stop is smaller than the advised 120
- Configure all resources as a resource group for failover
If we don't configure them as a resource group, indivdual resources will be failovered seperately so eventually you may be seeing VIP on dbmaster01 while DB store on dbmaster02 which is something we don't want to see.
[root@dbmaster-01
~]# crm configure group dbGroup ClusterIP DBstore MySQL
- Define external ping monitoring and failover policy
This part of configuration will be a
complicated, basically it means it will try to ping the gateway. In
case the active node failed to ping gateway (e.g. internet
connectivity down), it will fail over all services to standby node
[root@dbmaster-01
~]# crm configure primitive check-ext-conn ocf:pacemaker:ping \
> params
host_list="192.168.0.1" multiplier="100"
attempts="3" \
> op monitor
interval="10s" timeout="5s" start stop \
> meta
migration-threshold="10"
WARNING:
check-ext-conn: default timeout 20s for start is smaller than the
advised 60
WARNING:
check-ext-conn: specified timeout 5s for monitor is smaller than the
advised 60
[root@dbmaster-01
~]# crm configure clone pingclone check-ext-conn meta
globally-unique="false"
[root@dbmaster-01
~]# crm
crm(live)# configure
crm(live)configure#
location dbnode dbGroup \
> rule
$id="dbnode-rule" pingd: defined pingd \
> rule
$id="dbnode-rule-0" -inf: not_defined pingd or pingd lte 10
\
> rule
$id="dbnode-rule-1" 20: uname eq dbmaster-01.localdomain \
> rule
$id="dbnode-rule-2" 20: uname eq dbmaster-01
crm(live)configure#
end
There are changes
pending. Do you want to commit them? Yes
crm(live)configure#
exit
bye
- Review all configuration details.
[root@dbmaster-01
~]# crm configure show
node
dbmaster-01.localdomain
node
dbmaster-02.localdomain
primitive ClusterIP
ocf:heartbeat:IPaddr2 \
params
ip="192.168.0.10" cidr_netmask="32" \
op monitor
interval="10s" \
meta
migration-threshold="10"
primitive DBstore
ocf:heartbeat:Filesystem \
params
device="/dev/sdb" directory="/mysql"
fstype="ext4" \
meta
migration-threshold="10"
primitive MySQL
ocf:heartbeat:mysql \
params
binary="/usr/bin/mysqld_safe" config="/etc/my.cnf"
user="mysql" group="mysql" datadir="/mysql"
log="/mysql/mysqld.log" \
op start
interval="0" timeout="60s" \
op stop
interval="0" timeout="60s" \
op monitor
interval="1min" timeout="60s" \
meta
migration-threshold="10" target-role="Started"
primitive
check-ext-conn ocf:pacemaker:ping \
params
host_list="192.168.0.1" multiplier="100"
attempts="3" \
op monitor
interval="10s" timeout="5s" start stop \
meta
migration-threshold="10"
group dbGroup
ClusterIP DBstore MySQL
clone pingclone
check-ext-conn \
meta
globally-unique="false"
location dbnode
dbGroup \
rule
$id="dbnode-rule" pingd: defined pingd \
rule
$id="dbnode-rule-0" -inf: not_defined pingd or pingd lte 10
\
rule
$id="dbnode-rule-1" 20: uname eq dbmaster-01.localdomain \
rule
$id="dbnode-rule-2" 20: uname eq dbmaster-01
property
$id="cib-bootstrap-options" \
dc-version="1.1.6-3.el6-a02c0f19a00c1eb2527ad38f146ebc0834814558"
\
cluster-infrastructure="openais" \
expected-quorum-votes="2" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
start-failure-is-fatal="false"
rsc_defaults
$id="rsc-options" \
resource-stickiness="100"
沒有留言:
張貼留言