---
title: "MySQL and DRDB on Rackspace - testing"
date: "2012-07-11"
modified: "2013-03-04"
path: "/76-mysql-and-drdb-on-rackspace-testing.html"
section: "/ramblings"
aliases:
  - "/76"
  - "/76-mysql-and-drdb-on-rackspace-testing"
  - "/76.html"
  - "/ramblings/76-mysql-and-drdb-on-rackspace-testing.html"
---

## Initial Server Setup

```
dpkg-reconfigure tzdata

apt-get update
apt-get upgrade

aptitude install libauthen-pam-perl libio-pty-perl libmd5-perl libnet-ssleay-perl apt-show-versions openssl

wget http://www.webmin.com/download/deb/webmin-current.deb

dpkg -i webmin-current.deb
```

## Server Access

Webmin URL access: `https://xxx.xxx.xxx.xxx:10000/`

## Setup MySQL

```
aptitude install mysql-server
/etc/init.d/webmin restart
# edit the module config and set the password to whatever the root password is
```

## DRDB Specific

Check that it is working:

```
cat /proc/drbd
```

```
root@mysql-a:~# cat /proc/drbd
version: 8.3.8 (api:88/proto:86-94)
srcversion: 299AFE04D7AFD98B3CA0AF9
```

Get the local IP address:

```
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 40:40:5b:8e:52:2d brd ff:ff:ff:ff:ff:ff
    inet 46.38.184.186/24 brd 46.38.184.255 scope global eth0
    inet6 fe80::4240:5bff:fe8e:522d/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 40:40:46:29:50:21 brd ff:ff:ff:ff:ff:ff
    inet 10.176.91.215/18 brd 10.176.127.255 scope global eth1
    inet6 fe80::4240:46ff:fe29:5021/64 scope link
       valid_lft forever preferred_lft forever
```

Make a resource file name ending with \*.res:

```
nano /etc/drbd.d/drbd-res0.res
```

Add the following replacing with the correct host IP addresses:

```
resource drbd-resource-0 {
  protocol C;

  disk {
    on-io-error panic;
  }

  syncer {
    rate 100M;
  }

  on host-a {
    device    /dev/drbd0;
    disk      /dev/hda8;
    address   10.176.91.215:7789;
    meta-disk  internal;
  }

  on host-b {
    device    /dev/drbd0;
    disk      /dev/hda8;
    address   10.176.91.216:7789;
    meta-disk  internal;
  }

}
```

Create 11gB block device:

```
dd if=/dev/zero of=/drbd-loop.img bs=1024 count=10485760
```

References: [Rack Hacker](http://rackerhacker.com/redundant-cloud-hosting-configuration-guide/setting-up-a-redundant-database-and-caching-layer/)

---

More to come shortly - contact me if you need progress on this, been very busy so this may not get updated.
