Tuesday, April 19, 2016

Sharding volume in gluster - simple example



Sharding volume:
=============





$ glusterd -LDEBUG

$ gluster volume create tv1 gant:/opt/volume_test/tv_1/b1 gant:/opt/volume_test/tv_1/b2 force
volume create: tv1: success: please start the volume to access data

$ gluster volume start tv1
volume start: tv1: success

$ mount -t glusterfs gant:/tv1 /mnt/master/


$ gluster volume get tv1 features.shard
Option                                  Value                                  
------                                  -----                                  
features.shard                          off                                    

$ gluster volume get tv1 features.shard-block-size
Option                                  Value                                  
------                                  -----                                  
features.shard-block-size               4MB                                    


$ gluster volume set tv1 features.shard-block-size 10MB
volume set: success


$ gluster volume get tv1 features.shard-block-size
Option                                  Value                                  
------                                  -----                                  
features.shard-block-size               10MB                                   

$ gluster volume set tv1 features.shard on
volume set: success


$ mount | grep glusterfs
gant:/tv1 on /mnt/master type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)


$ dd if=/dev/urandom of=testfile count=12 bs=6MB
12+0 records in
12+0 records out
72000000 bytes (72 MB) copied, 4.96613 s, 14.5 MB/s

$ /root/brick_content.sh tv1
Bricks Present:
/opt/volume_test/tv_1/b1
/opt/volume_test/tv_1/b2

Contents of Bricks:
/opt/volume_test/tv_1/b1:
total 0

/opt/volume_test/tv_1/b2:
total 10244
-rw-r--r-- 2 root root 10485760 Apr 19 16:09 testfile

$ ls -ls
total 70313
70313 -rw-r--r-- 1 root root 72000000 Apr 19 16:10 testfile

$ ls -ls /opt/volume_test/tv_1/*/
/opt/volume_test/tv_1/b1/:
total 0

/opt/volume_test/tv_1/b2/:
total 10244
10244 -rw-r--r-- 2 root root 10485760 Apr 19 16:09 testfile

$ ls -ls /opt/volume_test/tv_1/*/.shard/ 
/opt/volume_test/tv_1/b1/.shard/:
total 60076
10240 -rw-r--r-- 2 root root 10485760 Apr 19 16:09 e93bb270-2d70-40da-b74b-1ac4635fb0e3.1
10240 -rw-r--r-- 2 root root 10485760 Apr 19 16:10 e93bb270-2d70-40da-b74b-1ac4635fb0e3.2
10240 -rw-r--r-- 2 root root 10485760 Apr 19 16:10 e93bb270-2d70-40da-b74b-1ac4635fb0e3.3
10240 -rw-r--r-- 2 root root 10485760 Apr 19 16:10 e93bb270-2d70-40da-b74b-1ac4635fb0e3.4
10240 -rw-r--r-- 2 root root 10485760 Apr 19 16:10 e93bb270-2d70-40da-b74b-1ac4635fb0e3.5
 8876 -rw-r--r-- 2 root root  9085440 Apr 19 16:10 e93bb270-2d70-40da-b74b-1ac4635fb0e3.6

/opt/volume_test/tv_1/b2/.shard/:
total 0
$
$ bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
10485760*5
52428800
52428800+9085440+10485760
72000000
(interrupt) Exiting bc.
$
$
$ gluster volume info tv1

Volume Name: tv1
Type: Distribute
Volume ID: d66102b6-13c1-491a-912e-206d809573de
Status: Started
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: gant:/opt/volume_test/tv_1/b1
Brick2: gant:/opt/volume_test/tv_1/b2
Options Reconfigured:
features.shard: on
features.shard-block-size: 10MB
transport.address-family: inet
performance.readdir-ahead: on
$
$

No comments:

Post a Comment