MySQL Apache Failover System with DRBD, Pacemaker, Corosync 2.x
Configuration
The configuration for this system is equal with my previous article, the differences are on the corosync config and the way to start pacemaker and drbdlinks. In the corosync version newer than 2.x, pacemaker is no longer started by corosync, so pacemaker should be loaded automatically during start up. Below is the example configuration of the corosnyc.conf:totem { version: 2 token: 3000 token_retransmits_before_loss_const: 10 join: 60 consensus: 3600 vsftype: none max_messages: 20 clear_node_high_bit: yes secauth: off threads: 0 rrp_mode: none transport: udpu cluster_name: Dbcluster } nodelist { node { ring0_addr: fo2 nodeid: 1 } node { ring0_addr: fo3 nodeid: 2 } } quorum { provider: corosync_votequorum } logging { fileline: off to_stderr: yes to_logfile: yes logfile: /var/log/corosync/corosync.log to_syslog: no syslog_facility: daemon debug: off timestamp: on logger_subsys { subsys: AMF debug: off tags: enter|leave|trace1|trace2|trace3|trace4|trace6 } }
Pacemaker console
In the pacemaker console, change the method that starts drbdlinks fromprimitive Links heartbeat:drbdlinks
to
primitive Links lsb:drbdlinks
And now we are ready to go, to apply the configuration, just restart the corosync and pacemaker daemon.
Ubuntu Server
On ubuntu server, access to some directory is restricted by apparmor application. To prevent misbehavior of the fail over system, make sure these line were added to the mysql apparmor configuration file (/etc/apparmor.d/usr.sbin.mysqld) :/etc/mysql/*.pem r, /etc/mysql/conf.d/ r, /etc/mysql/conf.d/* r, /etc/mysql/*.cnf r, /usr/lib/mysql/plugin/ r, /usr/lib/mysql/plugin/*.so* mr, /usr/sbin/mysqld mr, /usr/share/mysql/** r, /var/log/mysql.log rw, /var/log/mysql.err rw, /var/lib/mysql/ r, /var/lib/mysql/** rwk, /var/lib/mysql.drbdlinks/ r, /var/lib/mysql.drbdlinks/** r, /var/lib/mysqld/ r, /var/lib/mysqld/** rwk, /sync/mysqldb/ r, /sync/mysqldb/** rwk, /sync/mysql/ r, /sync/mysql/** rwk, /var/log/mysql/ r, /var/log/mysql/* rw, /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, /run/mysqld/mysqld.pid rw, /run/mysqld/mysqld.sock rw,
Comments