Shared storage: Difference between revisions

From GigaTux Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 36: Line 36:
# Run drbdadm up r0
# Run drbdadm up r0
# On one of the nodes only, run drbdadm -- --overwrite-data-of-peer primary r0
# 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 clvm cman
# Create a minimal cluster configuration file /etc/cluster/cluster.conf:
# Create a minimal cluster configuration file /etc/cluster/cluster.conf:

Revision as of 20:29, 11 March 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;
}
  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 clvm cman
  7. Create a minimal cluster configuration file /etc/cluster/cluster.conf:
<cluster name="vmachines" config_version="1">
  <cman expected_votes="1" two_node="1">
  </cman>
  <clusternodes>
    <clusternode name="cloud1" votes="1" nodeid="1">
      <fence>
         <method name="1">
           <device name="dummy" nodename="cloud1" />
         </method>
      </fence>
      <unfence>
        <device name="dummy" nodename="cloud1" action="on" />
      </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>
  1. Create /sbin/dummyfence with the conents:
#!/bin/bash
echo "success: dummyfence $2"
exit 0
  1. chmod u+x this
  2. Create /var/run/lvm directory
  3. Run /etc/init.d/cman and /etc/init.d/clvm
  4. pvcreate /dev/drbd1
  5. vgcreate --clustered y lvm_r0 /dev/drbd1

Enabling CLVM is as easy as setting locking_type=3 in lvm.conf. Possibly run lvmconf --enable-cluster on live systems.