data distribution in gluster - red hat

23
Data Distribution in Gluster Niels de Vos [email protected] Software Maintenance Engineer Red Hat UK, Ltd. February, 2012

Upload: trinhthuy

Post on 29-Jan-2017

222 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Data Distribution in Gluster - Red Hat

Data Distribution in Gluster

Niels de [email protected]

Software Maintenance EngineerRed Hat UK, Ltd.

February, 2012

Page 2: Data Distribution in Gluster - Red Hat

Agenda

● Terminology

● Striped Volumes

● Replicated Volumes

● Distributed Volumes

● Distributed Replicated Volumes

● Elastic Hashing

Page 3: Data Distribution in Gluster - Red Hat

Terminology

● Brick:● Mountpoint used for data storage

● Volume:● Multiple bricks combined

● Node:● Server running the Gluster Daemon● Contains the Brick(s)● Provides access to the Volume(s)

● Trusted Pool

Page 4: Data Distribution in Gluster - Red Hat

Terminology: Brick

● Mountpoint used for data storage

● Underlying physical storage for Volumes

Brick

Page 5: Data Distribution in Gluster - Red Hat

Creating a Brick

# mkfs -t xfs -i size=512 /dev/sdb1# mkdir -p /bricks/storage# vi /etc/fstab# mount /bricks/storage

Page 6: Data Distribution in Gluster - Red Hat

Terminology: Volume

● Multiple bricks combined

● Mountable by Gluster clients

brick-A brick-B

Volume

Page 7: Data Distribution in Gluster - Red Hat

Node

Terminology: Node

● Server running the Gluster Daemon

● Contains the Brick(s)

● Provides access to the Volume(s)

brick-A brick-B

Page 8: Data Distribution in Gluster - Red Hat

Striped Volumes

● Comparable with RAID-0

● Sparse files contain parts of the actual data

● Contents of the files are distributed over Bricks

● Losing one Brick results in loss of all the files

● No redundancy available (at the moment)

Page 9: Data Distribution in Gluster - Red Hat

node-2node-1

0 2 4 31 5

Brick Brick

Striped Volume

x allocated data block unallocated/sparse data block

Striped Volumes

Mount point

File

Page 10: Data Distribution in Gluster - Red Hat

Creating a Striped Volume

# gluster volume create my-striped-vol \ stripe 2 \ node1:/bricks/stripe node2:/bricks/stripe# gluster volume start my-striped-vol# gluster volume info my-striped-volVolume Name: my-striped-volType: StripeStatus: StartedNumber of Bricks: 2Transport-type: tcpBricks:Brick1: node1:/bricks/stripeBrick2: node2:/bricks/stripe

Page 11: Data Distribution in Gluster - Red Hat

Replicated Volumes

● Comparable with RAID-1

● File duplication for redundancy

● Complete files available

Page 12: Data Distribution in Gluster - Red Hat

node-2node-1

Brick on node-1 Brick on node-2

Replicated Volume

allocated physical file

Replicated Volumes

Mount point

File

Page 13: Data Distribution in Gluster - Red Hat

Creating a Replicated Volume

# gluster volume create my-replicated-vol \ replica 2 \ node1:/bricks/repl node2:/bricks/repl# gluster volume start my-replicated-vol# gluster volume info my-replicated-volVolume Name: my-replicated-volType: ReplicateStatus: StartedNumber of Bricks: 2Transport-type: tcpBricks:Brick1: node1:/bricks/replBrick2: node2:/bricks/repl

Page 14: Data Distribution in Gluster - Red Hat

Distributed Volumes

● Just a Bunch Of Bricks (JBOB)

● Comparable with JBOD (Just a Bunch Of Disks)

● No duplicating

● Complete files available

Page 15: Data Distribution in Gluster - Red Hat

node-2node-1

Brick Brick

Distributed Volume

Allocated physical file

Distributed Volumes

Mount point

File

Page 16: Data Distribution in Gluster - Red Hat

Creating a Distributed Volume

# gluster volume create my-distributed-vol \ node1:/bricks/dist node2:/bricks/dist# gluster volume start my-distributed-vol# gluster volume info my-distributed-volVolume Name: my-distributed-volType: DistributeStatus: StartedNumber of Bricks: 2Transport-type: tcpBricks:Brick1: node1:/bricks/distBrick2: node2:/bricks/dist

Page 17: Data Distribution in Gluster - Red Hat

Distributed Replicated Volumes

● Just a Bunch Of Bricks (JBOB)

● Comparable with JBOD (Just a Bunch Of Disks) and RAID-1

● File duplication for redundancy

● Complete files available

Page 18: Data Distribution in Gluster - Red Hat

node-1 node-2

brick-A brick-A

Distributed Volume

allocated physical file

Distributed Replicated Volumes

Mount point

File

brick-B brick-B

Replicated Volume 0 Replicated Volume 1

Page 19: Data Distribution in Gluster - Red Hat

Creating a Distributed Replicated Volume

# gluster volume create my-dist-repl-vol \ replica 2 \ node{1,2}:/bricks/dist-repl-A \ node{1,2}:/bricks/dist-repl-B# gluster volume start my-dist-repl-vol# gluster volume info my-dist-repl-volVolume Name: my-distributed-volType: Distributed-ReplicateStatus: StartedNumber of Bricks: 2 x 2 = 4Transport-type: tcpBricks:Brick1: node1:/bricks/dist-repl-ABrick2: node2:/bricks/dist-repl-ABrick3: node1:/bricks/dist-repl-BBrick4: node2:/bricks/dist-repl-B

Page 20: Data Distribution in Gluster - Red Hat

Elastic Hashing & File Distribution

● Only known attribute is the path

● A hash based on the filename gets calculated● Davies-Meyer hashing function

● A hash has a finite number of results {0..N}

● A brick has a range of hash results

● Loop through the bricks and check if the hash result is in the hash range

Page 21: Data Distribution in Gluster - Red Hat

Distributed Hash Table Xlator

file

select the next brick

file I/O

hash = dht_hash_compute()

brick.start >= hash&&

brick.end <= hash

select the first brick

Related sources:xlators/cluster/dht/src/dht-layout.c:dht_layout_search()libglusterfs/src/hashfn.c

Page 22: Data Distribution in Gluster - Red Hat

Keep in Touch

[email protected]● http://lists.nongnu.org/archive/html/gluster-devel/

● #gluster on Freenode

● twitter.com/RedHatStorage

Page 23: Data Distribution in Gluster - Red Hat

Questions?