-
Notifications
You must be signed in to change notification settings - Fork 0
/
geo-rep_cleanup.sh
37 lines (30 loc) · 1.36 KB
/
geo-rep_cleanup.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
#!/bin/bash
############################################################################
#How to run:
# geo-rep_cleanup.sh <secondary_ip1> <secondary_ip2> <secondary_ip3> <primary_ip2>
# <primary_ip3> <primary_client_ip> <secondary_client_ip>
#
# primary_ip1 is not taken as one of the parameters,
# as this script is to be executed on a primary node and ip of the node
# where the commands are executed is not necessary
############################################################################
echo cleaning up geo-rep setup
yes | gluster volume geo-replication primary $secondary_ip1::secondary stop
yes | gluster volume geo-replication primary $secondary_ip1::secondary delete reset-sync-time
echo cleaning up mount points
ssh $primary_client_ip umount -l /primary_mnt1
ssh $primary_client_ip rm -rf /primary_mnt1
ssh $secondary_client_ip umount -l /secondary_mnt
ssh $secondary_client_ip rm -rf /secondary_mnt
echo cleanup primary volume and bricks
yes | gluster volume stop primary
yes | gluster volume delete primary
rm -rf /brick1
ssh $primary_ip2 rm -rf /brick2
ssh $primary_ip3 rm -rf /brick3
echo cleaning up secondary volume and bricks
yes | ssh $secondary_ip1 gluster volume stop secondary
yes | ssh $secodary_ip2 gluster volume delete secondary
yes | ssh $secondary_ip1 rm -rf /brick*
yes | ssh $secondary_ip2 rm -rf /brick*
yes | ssh $secondary_ip3 rm -rf /brick*