5

I have a 2 peer GlusterFS system. It was initially created using simple hostnames file01 and file02. These hosts were added to /etc/hosts to make it work.

Now we want to start using FQDN because we want to attach other servers to the volumes using the GlusterFS native client. We don't want to have to maintain hosts files for every server.

Is it possible to reconfigure the current setup to use the full hostnames file01.example.com and file02.example.com?

Thank you!

2 Answers 2

4

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
3

according to http://lists.gluster.org/pipermail/gluster-users/2017-January/029587.html

  1. Stop glusterd process on N1, N2.
  2. If you are trying to change the hostname of N1, then in N2 you'd need to replace the occurrences of old hostname with new hostname in all the files located at /var/lib/glusterd
  3. Restart GlusterD on all the nodes and check the peer status.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .