When you need to rename your peers, your bricks, etc. without destroy your cluster, you will must stop your glusterfs service, and then rename all the occurrences in the glusterfs data files.
I will provide you an script (without any warranty), that I used to automate this task.
WARNING: Before proceed be sure of backup your data, and proceed with caution.
Do not execute any command without understanding what it do exactly, be sure that you are in the correct path, make the correct names replacements in each command if apply (indicated in uppercase), and ensure that all your new peer names are resolvable by DNS.
THE NEXT STEPS MUST BE PERFORMED ON ALL THE NODES
Step 1: stop glusterd service.
sudo systemctl stop glusterd.service
Step 2: list the content of the /var/lib/glusterd/vols directory.
ls -l /var/lib/glusterd/vols
Step 3: renaming volumes data files, for each volume do:
cd /var/lib/glusterd/vols/YOURVOLUMENAME
ls -l | grep .data.vol #<-- gets the list of files you need to rename for the current volume
sudo mv clusterdata.OLDNAME1.data.vol clusterdata.NEWNAME1.data.vol
sudo mv clusterdata.OLDNAME2.data.vol clusterdata.NEWNAME2.data.vol
sudo mv clusterdata.OLDNAME-N.data.vol clusterdata.NEWNAME-N.data.vol
Step 4: renaming volumes bricks, for each volume do:
cd /var/lib/glusterd/vols/YOURVOLUMENAME/bricks
ls -l | grep :-data #<-- gets the list of brick files you need to rename for the current volume
sudo mv OLDNAME1\:-data NEWNAME1\:-data
sudo mv OLDNAME2\:-data NEWNAME2\:-data
sudo mv OLDNAME-N\:-data NEWNAME-N\:-data
Step 5: Detect all the occurrences of the OLDNAME in the config files:
cd /var/lib/glusterd
sudo grep -rnw . -e 'OLDNAME'
Step 6: Automatically replace all the occurrences of the OLDNAME in the config files:
cd /var/lib/glusterd
sudo find . -type f -exec sed -i 's/OLDNAME/NEWNAME/g' {} \;
Step 7: Check that all the occurrences has been replaced:
sudo grep -rnw . -e 'OLDNAME'
sudo grep -rnw . -e 'NEWNAME'
ONLY WHEN YOU HAVE COMPLETED THE STEPS ON ALL NODES ...
Start the glusterd service en each node, and check status.
sudo systemctl start glusterd.service
sudo systemctl status glusterd.service
sudo gluster peer status
sudo gluster volume status
sudo gluster volume info