High Availability MySQL Design Manual

1. Objectives

    Our primary objective is to provide a MySQL database to our stakeholders
that experiences no unscheduled downtime without requiring user level awareness
or any modifications to existing applications.  Such a system should remain
fully functional in the event of any single failure of database software,
machine, networking equipment and building power.

    A secondary objective is to provide performance similar to or better than
our existing database systems.  The primary metrics for determining relative
performance being latency and throughput.

2. Design

3. Operations

    3.1 Designate a master

        To designate a MySQL node as a master for the purposes of replication
        it is necessary to create a database user with permission to replicate
        that slave nodes can then use to connect and receive transaction logs.

        Anthony Brennan recommends creating a seperate user with a unique
        password per slave node, so that nodes can be removed without
        interfering with system operations.

        Applying the following salt configuration directive to the master is

                - password_hash: "${output of SELECT PASSWORD('your_passwd');"

                - grant: replication slave
                - database: "*.*"
                - user: ${slave_node_hostname}_user

    3.2 Activate a slave

Appendix A: Initial Setup

    1: Create containers
        On each host {dc-3558-411, mc-3015-411, m3-3101-411} create a container
        for a MySQL node.

            root@dc-3558-411:~# lxc-create -t cscf-ubuntu -n \

            root@mc-3015-411:~# lxc-create -t cscf-ubuntu -n \

            root@m3-3101-411:~# lxc-create -t cscf-ubuntu -n \

    2: Allocate NVME storage
        On each host {dc-3558-411, mc-3015-411, m3-3101-411} create a logical
        volume for database information

            root@dc-3558-411:~# lvcreate -L 100G -n mysql-102.cs intel_nvme
            root@dc-3558-411:~# mkfs -t ext4 \
            root@mc-3015-411:~# lvcreate -L 100G -n mysql-104.cs intel_nvme
            root@dc-3558-411:~# mkfs -t ext4 \
            root@m3-3101-411:~# lvcreate -L 100G -n mysql-106.cs intel_nvme
            root@dc-3558-411:~# mkfs -t ext4 \

    3. Add entries to mount NVME storage inside containers
        On each host {dc-3558-411, mc-3015-411, m3-3101-411} create an entry
        in each containers fstab file.

            root@dc-3558-411:~# echo /dev/mapper/intel_nvme-mysql--102.cs\
/var/lib/lxc/mysql-102.cs.uwaterloo.ca/rootfs/var/lib/mysql ext4\
            root@mc-3015-411:~# echo /dev/mapper/intel_nvme-mysql--104.cs\
/var/lib/lxc/mysql-104.cs.uwaterloo.ca/rootfs/var/lib/mysql ext4\
            root@m3-3101-411:~# echo /dev/mapper/intel_nvme-mysql--106.cs\
/var/lib/lxc/mysql-106.cs.uwaterloo.ca/rootfs/var/lib/mysql ext4\

    4. Create a unique server-id per MySQL instance
        On each MySQL node {mysql-102, mysql-104, mysql-106} create a MySQL
        configuration file with a unique server-id parameter.

            root@mysql-102:~# echo "server-id = 1" >> \
            root@mysql-104:~# echo "server-id = 2" >> \
            root@mysql-106:~# echo "server-id = 3" >> \

    5. Configure each MySQL instance to listen on its network address
        On each MySQL node {mysql-102, mysql-104, mysql-106} append a
        "bind-address" configuration directive to the host specific
        configuration file.

            root@mysql-102:~# echo "bind-address = ${NODE_IP}" >> \
            root@mysql-104:~# echo "bind-address = ${NODE_IP}" >> \
            root@mysql-106:~# echo "bind-address = ${NODE_IP}" >> \

-- AnthonyBrennan - 2016-02-18

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r3 - 2016-04-08 - DanielAllen
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback