Linux Views 4

Setting up DRBD on Linux, part 2

Setting up DRBD on Linux, part 2 image 1

Setting up DRBD on Linux, part 1

Starting DRBD


In part 1 we finished the node setup and the drbd .res file.
I will now describe how to start DRBD.

  • After the initial setup, start the service (on primary and secondary at the same time)
  • service drbd start
  • Create metadata (on primary and secondary at the same time). Running the command above creates the /dev/drbd0 device.
  • drbdadm create-md all # The space used as a drbd volume must not already have a filesystem. # If you get an error such as 'drbdmeta 1 v08 /dve/xxx internalcreate-md' terminated with exit code 40, use the command below # dd if=/dev/zero of=/dev/(drbd마운트) bs=1M count=128
  • Make a primary. On first start it runs as secondary/secondary, so you need to run the command above so that mirroring can proceed.
  • drbdadm primary nfs # nfs is the resource name. The resource name stored in the .res file.
  • Mount (on the primary node)
  • mkfs.ext4 /dev/drbd0 mount /dev/drbd0 /mnt

Operating DRBD


  • Monitoring. Use the monitoring commands to check the connect state.
  • cat /proc/drbd service drbd status
  • Mirroring test. If the primary has gone down, immediately promote the secondary to primary as follows.
  • # make the primary a secondary umount /mnt drbdadm secondary nfs # make the secondary a primary mount /dev/drbd /mnt ls -al /mnt
  • Replacing a secondary node
    If you replace an existing secondary node, edit the .res file (configure both nodes at the same time).
    Then start the service on the secondary node. Next, on the primary node, run the command that connects to the new node.
  • drbdadm connect nfs
  • service drbd start

Reactions

Comments 0

A nickname and a password are required. The same password edits or deletes the comment later. Comments appear after a review.

Comments appear after a review. The password is used again to edit or delete.