-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgluster_nyrhug.sh
64 lines (51 loc) · 1.67 KB
/
gluster_nyrhug.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
#############
# add storage
#############
./gluster_attach_disk.sh rhgs35-1 brickvol 10G vdb
./gluster_attach_disk.sh rhgs35-2 brickvol 10G vdb
./gluster_attach_disk.sh rhgs35-3 brickvol 10G vdb
export bricknum=######TERMINAL NUMBER####
###############
# Open firewall
###############
#all hosts
firewall-cmd --add-service=glusterfs
firewall-cmd --add-service=glusterfs --permanent
############
# peer hosts
############
# first host
gluster peer probe rhgs35-2
gluster peer probe rhgs35-3
################
# format & mount
################
vgcreate glustervg1 /dev/vdb
lvcreate --type thin-pool -L 9G glustervg1/vg1tp
lvcreate -V 1G glustervg1/vg1tp --name brick${bricknum}
mkfs.xfs -f -i size=512 -n size=8192 /dev/mapper/glustervg1-brick${bricknum}
#add to /etc/fstab
echo /dev/mapper/glustervg1-brick${bricknum} /bricks/brick${bricknum} xfs rw,inode64,noatime,nouuid,nofail 1 2 >> /etc/fstab
mkdir -p /bricks/brick${bricknum}/brick
mount -a
semanage fcontext -a -t glusterd_brick_t /bricks/brick${bricknum}
restorecon -Rv /bricks/brick${bricknum}
###############
# Create volume
###############
gluster volume create volume1 replica 3 rhgs35-1:/bricks/brick1/brick rhgs35-2:/bricks/brick2/brick rhgs35-3:/bricks/brick3/brick
gluster volume start volume1
gluster volume info volume1
################
# gluster client
################
#subscription-manager repos --enable=rh-gluster-3-client-for-rhel-7-server-rpms
yum install glusterfs glusterfs-fuse
mkdir -p /mnt/volume1
mount -t glusterfs -o backup-volfile-servers=rhgs35-2:rhgs35-3 rhgs35-1:/volume1 /mnt/volume1
################
# do stuff
################
dd if=/dev/urandom of=./bar count=102400
getfattr -d -m. foo