introduction to drbd

47
Sudoers Barcelona Octubre 2013 alba ferrer

Upload: dawnlua

Post on 28-Jan-2015

119 views

Category:

Technology


0 download

DESCRIPTION

Talk about DRBD in Sudoers Barcelona's October meeting.

TRANSCRIPT

Page 1: Introduction to DRBD

Sudoers BarcelonaOctubre 2013

alba ferrer

Page 2: Introduction to DRBD

What is it?

Distributed Replicated Block Device

Page 3: Introduction to DRBD

What is it?

Distributed Replicated Block Device

Software-based, shared-nothing replicated storage solution mirroring the contents of block devices

Page 4: Introduction to DRBD

What is it?

Distributed Replicated Block Device

Software-based, shared-nothing replicated storage solution mirroring the contents of block devices

• In real time

Page 5: Introduction to DRBD

What is it?

Distributed Replicated Block Device

Software-based, shared-nothing replicated storage solution mirroring the contents of block devices

• In real time• Transparently

Page 6: Introduction to DRBD

What is it?

Distributed Replicated Block Device

Software-based, shared-nothing replicated storage solution mirroring the contents of block devices

• In real time• Transparently• Synchronously/asynchronously

Page 7: Introduction to DRBD

Kernel module

Page 8: Introduction to DRBD

User space admin tools• drbsetup

• Used to configure the kernel module• All parameters in command-line

Page 9: Introduction to DRBD

User space admin tools• drbsetup

• Used to configure the kernel module• All parameters in command-line

• drbdmeta• Create/dump/restore/modify DRBD metadata

(more on this later)

Page 10: Introduction to DRBD

User space admin tools• drbsetup

• Used to configure the kernel module• All parameters in command-line

• drbdmeta• Create/dump/restore/modify DRBD metadata

(more on this later)

• drbdadm• High-level, frontend for drbdsetup/drbdmeta• Reads from /etc/drbd.conf• Has a dry-run option (-d)

Page 11: Introduction to DRBD

Resources

• A particular replicated storage device

Page 12: Introduction to DRBD

Resources

• A particular replicated storage device

• Resource name• DRBD device: virtual block device (major=147).

The associated block device is always /dev/drbdm (m=minor)

• Disk configuration: local copy of the data• Network configuration: comms with peer

Page 13: Introduction to DRBD

ConfigurationPer resource (/etc/drbd.d/mysql.res):

resource mysql {device minor 0; # /dev/drbd0disk /dev/sdb;meta-disk internal;

on alice {address 192.168.133.111:7000;

}on bob {

address 192.168.133.112:7000;}

syncer {rate 10M; # static resync rate of

10MByte/s}

}

Page 14: Introduction to DRBD

Configuration

Global (/etc/drbd.d/global_common.conf):global {

usage-count yes;}

common {protocol C;disk {

on-io-error detach;}syncer {

al-extents 3833;}

}

Page 15: Introduction to DRBD

Resource roles

• Primary: read and write ops• Secondary: receives updates from primary,

disallows any other access.

• Promotion: from secondary to primary drbdadm primary all

• Demotion: from primary to secondarydrbdadm secondary all

Page 16: Introduction to DRBD

Modes

• Single-primary• Dual-primary (>= 8.0)

Page 17: Introduction to DRBD

Modes

• Single-primary• Dual-primary (>= 8.0)

• Replication modes:• Protocol A: asynchronous• Protocol B: memory synchronous• Protocol C: synchronous

Page 18: Introduction to DRBD

Features: efficient synchronization

• Synchronization != replication

Page 19: Introduction to DRBD

Features: efficient synchronization

• Synchronization != replication• Inconsistent remote dataset during sync

• Useless

Page 20: Introduction to DRBD

Features: efficient synchronization

• Synchronization != replication• Inconsistent remote dataset during sync

• Useless• Service in active node unaffected

Page 21: Introduction to DRBD

Features: efficient synchronization

• Synchronization != replication• Inconsistent remote dataset during sync

• Useless• Service in active node unaffected• Synchronization and replication happen at the

same time

Page 22: Introduction to DRBD

Features: efficient synchronization

• Only one write op per several successive writes in active node in a block

Page 23: Introduction to DRBD

Features: efficient synchronization

• Only one write op per several successive writes in active node in a block

• Linear access to blocks

Page 24: Introduction to DRBD

Features: efficient synchronization

• Only one write op per several successive writes in active node in a block

• Linear access to blocks• Configure rate of sync

Page 25: Introduction to DRBD

Features: efficient synchronization

• Only one write op per several successive writes in active node in a block

• Linear access to blocks• Configure rate of sync

• Checksum-based synchronization

Page 26: Introduction to DRBD

Features: data verification

• On-line device verification• block-by-block data integrity check

between nodes

Page 27: Introduction to DRBD

Features: data verification

• On-line device verification• block-by-block data integrity check

between nodes• Replication traffic integrity checking

• end-to-end message integrity checking using cryptographic message digest algorithms

Page 28: Introduction to DRBD

Features: disk

• Support for disk flushes

Page 29: Introduction to DRBD

Features: disk

• Support for disk flushes• Disk error handling strategies

• Passing• Masking• DIY

Page 30: Introduction to DRBD

Features: disk

• Support for disk flushes• Disk error handling strategies

• Passing• Masking• DIY

• Deal with outdated data• DRBD won't promote an outdated

resource -> fencing

Page 31: Introduction to DRBD

Features: replication• Three-way replication

Page 32: Introduction to DRBD

Features: replication

• Long distance replication with DRBD Proxy• Not free

• Truck based replication

Page 33: Introduction to DRBD

Split-brain

Split brain is a situation where, due to temporary failure of all network links between cluster nodes, and possibly due to intervention by a cluster management software or human error, both nodes switched to the primary role while disconnected.

Page 34: Introduction to DRBD

Split-brain

• Configurable notifications

Page 35: Introduction to DRBD

Split-brain

• Configurable notifications• Automatic recovery methods

• Discard modifications on 'younger' primary.• Discard modifications on 'older' primary.• Discard modifications on primary with

fewer changes.• Graceful recovery if one primary had no

changes.

Page 36: Introduction to DRBD

Metadata

• Various pieces of information about the data DRBD keeps in a dedicated area• The size of the DRBD device• The generation identifier• The activity log• The quick-sync bitmap

Page 37: Introduction to DRBD

Metadata

• Can be stored internally or externally

Page 38: Introduction to DRBD

Metadata

• Can be stored internally or externally• Size

root@bob:~ # blockdev --getsz /dev/drbd0root@bob:~ # 8388280

(8388280/2^18) * 8 + 72 = 328 sectors328 sectors = 0,16MB

Page 39: Introduction to DRBD

What it’s not/What it can’t do

• It’s not a backup system

Page 40: Introduction to DRBD

What it’s not/What it can’t do

• It’s not a backup system

• It can’t add features to upper layers

Page 41: Introduction to DRBD

What it’s not/What it can’t do

• It’s not a backup system

• It can’t add features to upper layers• DRBD cannot auto-detect file system

corruption • DRBD cannot add active-active clustering

capability to file systems like ext3 or XFS.

Page 42: Introduction to DRBD

Limitations

• Only two nodes• Stacked resources• Version 9

Page 43: Introduction to DRBD

Limitations

• Only two nodes• Stacked resources• Version 9

• There is no automatic failover.

Page 44: Introduction to DRBD

Limitations

• Only two nodes• Stacked resources• Version 9

• There is no automatic failover.• Promotion/demotion is manual.

Page 45: Introduction to DRBD

Limitations

• Only two nodes• Stacked resources• Version 9

• There is no automatic failover.• Promotion/demotion is manual.• Needs a CRM to be useful

PACEMAKER FTW

Page 46: Introduction to DRBD

Funcionament

root@alice:/etc/drbd.d # cat /proc/drbd

version: 8.3.13 (api:88/proto:86-96)GIT-hash: 234a142f7cf5bb21ffa1e95afa4f31608089c8b8 build by buildsystem@linbit, 2012-09-12 14:27:28 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r----- ns:152 nr:4 dw:156 dr:4017 al:5 bm:1 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0

Page 47: Introduction to DRBD

More info

• drbd.org

• www.drbd.org/home/mailinglists

• www.linbit.com