forked from ofesseler/gluster_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gluster-init.sh
33 lines (25 loc) · 898 Bytes
/
gluster-init.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
#! /bin/bash
#GlusterFS configuration variables
VOLNAME="data"
# Start gluster manually (systemd is not running)
/usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO &
# Wait to start configuring gluster
sleep 30
# Create a volume
gluster volume create "$VOLNAME" "$(hostname)":/"$VOLNAME" force
# Start Gluster volume
gluster volume start "$VOLNAME"
# Enable gluster profile
gluster volume profile "$VOLNAME" start
# Mount the volume
glusterfs --volfile-server=localhost --volfile-id="$VOLNAME" /mnt/"$VOLNAME"
# Write something to the volume
dd if=/dev/zero of=/mnt/"$VOLNAME"/test.zero bs=1M count=10
dd if=/dev/urandom of=/mnt/"$VOLNAME"/test.random bs=1M count=10
# Show the exporter version
/usr/bin/gluster_exporter --version
# Start gluster_exporter
/usr/bin/gluster_exporter --gluster.volumes="data" --profile
# Stop glusterfs
kill -9 "$(cat /var/run/glusterd.pid)"
exit 0