Setup OpenVZ to use the DRBD device

Prepare the filesystem to hold VEs

Use the previous created drbd filesystem.

mkdir /vz
mount -t ext3 /dev/drbd0 /vz

Also create /vz on node2

Configure OpenVZ

Configure OpenVZ to use /vz, edit /etc/vz/vz.conf:

cd /etc/vz/
cp vz.conf vz.conf.orig
[ -f vz.conf.orig ] && sed -e 's%/var/lib/vz%/vz%g' vz.conf.orig > vz.conf 

Restart to take effect:

invoke-rc.d vz restart

Create VE

Example for a CentOS VE:

# create centos ve
vzctl create 1011 --ostemplate centos-5-x86
vzctl set 1011 --onboot no --save
vzctl set 1011 --ipadd 192.168.0.11 --save
vzctl set 1011 --nameserver 192.168.0.1 --save
vzctl set 1011 --hostname vps1011.example.com --save

Test the VE

Test the VE to make sure it is working.

vzctl start 1011
vzctl enter 1011

Sync the config to node2

Use scp:

scp /etc/vz/vz.conf node2:/etc/vz/vz.conf
scp /etc/vz/conf/1011.conf node2:/etc/vz/conf/1011.conf

Use rsync to sync the config from node1 to node2.

# rsyncd.conf config for OpenVZ config
[etc-vz]
        comment = OpenVZ config area
        path = /etc/vz
        read only = no
        write only = no
        list = yes
        host allow = 127.0.0.1 192.168.0.101

Then set cron job to run at node2:

# at node2:
rsync -av node1::etc-vz/* /etc/vz/

Disable auto start

Do this on all nodes.

update-rc.d -f vz remove
ha/setup_openvz_to_use_the_drbd_device.txt · Last modified: 2010-06-30 10:52 by admin
Back to top
GNU Free Documentation License 1.3
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0