Shared storage: Difference between revisions

From GigaTux Wiki
Jump to navigation Jump to search
Created page with "# Configure the network between the two servers # Allow through ports 7788-7799 only # Create new logical volume on both devices (cloud), 2G # Install drbd8-utils # Change the st..."
 
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
# Configure the network between the two servers
# Configure the network between the two servers
# Allow through ports 7788-7799 only
# Allow through ports 7788-7799 only
# Create new logical volume on both devices (cloud), 2G
# Create the logical volume cloud
# Install drbd8-utils
# Install drbd8-utils
# Change the startup group in /etc/drbd.d/global_common.conf to read:
# Change the startup group in /etc/drbd.d/global_common.conf to read:
Line 7: Line 7:
   wfc-timeout 10;
   wfc-timeout 10;
   degr-wfc-timeout: 10;
   degr-wfc-timeout: 10;
}
net {
  ping-timeout: 100;
  }
  }
# Create /etc/drbd.d/r0.res:
# Create /etc/drbd.d/r0.res:
Line 35: Line 38:
# Add drbd to /etc/modules and modprobe it
# Add drbd to /etc/modules and modprobe it
# Run drbdadm up r0
# Run drbdadm up r0
# On one of the nodes only, run drbdadm -- --overwrite-data-of-peer primary resource
# On one of the nodes only, run drbdadm -- --overwrite-data-of-peer primary r0
# After sync, run drbd-primary r0 on both nodes
# After sync, run drbdadm primary r0 on both nodes
# apt-get install clvm cman
# apt-get install corosync openais corosync-dev libdlm-dev
# Create a minimal cluster configuration file /etc/cluster/cluster.conf:
# Install customised lvm2 package. This is basically the lvm2 source following the instructions [http://www.pixelchaos.net/2009/04/23/openais-an-alternative-to-clvm-with-cman/ here] with the rules file having ''--enable-cluster=internal'' and ''--enable-clvm=corosync,openais''. Remember to run ''apt-get build-dep lvm2'' and ''apt-get install devscripts'' first.
<cluster name="vmachines" config_version="1">
# Copy clvm daemon to /usr/sbin/. This is in debian/build/install_deb/usr/sbin/clvmd
  <cman expected_votes="1" two_node="1">
# mkdir /etc/ais
  </cman>
# Download the /etc/init.d/openais script from the site but also do the following:
  <clusternodes>
## chmod u+x
    <clusternode name="cloud1" votes="1" nodeid="1">
## Change reference to openais-cfgtool to corysync-cfgtool
      <fence>
## Add ''killall corosync'' to stop) and restart)
          <method name="1">
# Download the /etc/init.d/clvm init script but also do the following:
            <device name="dummy" nodename="cloud1" />
## Add BEGIN INIT INFO section as per cloud1
          </method>
# Run insserv openais
      </fence>
# Run insserv clvm
      <unfence>
# Allow through firewall: ''iptables -A INPUT -p udp -i eth1 -m multiport --ports 5405 -j ACCEPT''
        <device name="dummy" nodename="cloud1" action="on" />
# Change filter directive in /etc/lvm/lvm to read ''filter = [ "a/sd.*/", "a/drbd.*/", "r/.*/" ]''. Information on this is available [https://bugzilla.redhat.com/show_bug.cgi?id=530881 in this bug].
      </unfence>
    </clusternode>
    <clusternode name="cloud2" votes="1" nodeid="2">
      <fence>
          <method name="2">
            <device name="dummy" nodename="cloud2" />
          </method>
      </fence>
      <unfence>
        <device name="dummy" nodename="cloud2" action="on" />
      </unfence>
      </clusternode>
  </clusternodes>
  <logging to_syslog="yes" to_logfile="yes" syslog_facility="daemon" syslog_priority="info">
  </logging>
  <fence_daemon post_join_delay="3" />
  <totem rrp_mode="none" secauth="off"/>
  <fencedevices>
    <fencedevice name="dummy" agent="dummyfence" />
  </fencedevices>
</cluster>
# Create /sbin/dummyfence with the conents:
#!/bin/bash
echo "success: dummyfence $2"
exit 0
# chmod u+x this
# Create /var/run/lvm directory
# Run /etc/init.d/cman and /etc/init.d/clvm
# pvcreate /dev/drbd1
# pvcreate /dev/drbd1
# vgcreate --clustered y lvm_r0 /dev/drbd1
# vgcreate --clustered y lvm_r0 /dev/drbd1
 
# Enable CLVM by setting locking_type=3 in lvm.conf. Possibly run lvmconf  --enable-cluster on live systems.
Enabling CLVM is as easy as setting locking_type=3 in lvm.conf. Possibly run lvmconf  --enable-cluster on live systems.

Latest revision as of 12:05, 15 April 2013

  1. Configure the network between the two servers
  2. Allow through ports 7788-7799 only
  3. Create the logical volume cloud
  4. Install drbd8-utils
  5. Change the startup group in /etc/drbd.d/global_common.conf to read:
startup {
  wfc-timeout 10;
  degr-wfc-timeout: 10;
}
net {
  ping-timeout: 100;
}
  1. Create /etc/drbd.d/r0.res:
resource r0 {
  on cloud1 {
    device    /dev/drbd1;
    disk      /dev/lvm1/cloud;
    address   192.168.1.1:7789;
    meta-disk internal;
  }
  on cloud2 {
    device    /dev/drbd1;
    disk      /dev/lvm1/cloud;
    address   192.168.1.2:7789;
    meta-disk internal;
  }
  net {
    allow-two-primaries;
  }
  startup {
    become-primary-on both;
  }
  syncer {
    rate 20M;
  }
}
  1. Run drbdadm create-md r0
  2. Add drbd to /etc/modules and modprobe it
  3. Run drbdadm up r0
  4. On one of the nodes only, run drbdadm -- --overwrite-data-of-peer primary r0
  5. After sync, run drbdadm primary r0 on both nodes
  6. apt-get install corosync openais corosync-dev libdlm-dev
  7. Install customised lvm2 package. This is basically the lvm2 source following the instructions here with the rules file having --enable-cluster=internal and --enable-clvm=corosync,openais. Remember to run apt-get build-dep lvm2 and apt-get install devscripts first.
  8. Copy clvm daemon to /usr/sbin/. This is in debian/build/install_deb/usr/sbin/clvmd
  9. mkdir /etc/ais
  10. Download the /etc/init.d/openais script from the site but also do the following:
    1. chmod u+x
    2. Change reference to openais-cfgtool to corysync-cfgtool
    3. Add killall corosync to stop) and restart)
  11. Download the /etc/init.d/clvm init script but also do the following:
    1. Add BEGIN INIT INFO section as per cloud1
  12. Run insserv openais
  13. Run insserv clvm
  14. Allow through firewall: iptables -A INPUT -p udp -i eth1 -m multiport --ports 5405 -j ACCEPT
  15. Change filter directive in /etc/lvm/lvm to read filter = [ "a/sd.*/", "a/drbd.*/", "r/.*/" ]. Information on this is available in this bug.
  16. pvcreate /dev/drbd1
  17. vgcreate --clustered y lvm_r0 /dev/drbd1
  18. Enable CLVM by setting locking_type=3 in lvm.conf. Possibly run lvmconf --enable-cluster on live systems.