Two our servers serv1 and serv2 have Debian 7 x64 and GlusterFS 3.4. Unexpectedly serv2 which was in another DC got network issues, when DC fixed their own issues with routers we got “unsynced entries” Nagios alert for serv1:
root@serv1 ~ # /root/bin/check_glusterfs -v sites -n 2 -w 10 -c 5 WARNING: 3 unsynced entries root@serv1 ~ #
There were three error entries in glustershd.log on serv1:
root@serv1 /var/log/glusterfs # grep "No such file or directory" glustershd.log | grep Path [2015-12-12 19:22:53.228807] W [client-rpc-fops.c:471:client3_3_open_cbk] 0-sites-client-1: remote operation failed: No such file or directory. Path: <gfid:790d240d-6d8b-4540-9049-06664408cec7> (00000000-0000-0000-0000-000000000000) [2015-12-12 19:22:53.241330] W [client-rpc-fops.c:471:client3_3_open_cbk] 0-sites-client-1: remote operation failed: No such file or directory. Path: <gfid:8f6a612a-6fda-45ee-aa84-e9cb847047c2> (00000000-0000-0000-0000-000000000000) [2015-12-12 19:22:53.256951] W [client-rpc-fops.c:471:client3_3_open_cbk] 0-sites-client-1: remote operation failed: No such file or directory. Path: <gfid:2b6f14c4-e863-480a-9d72-c5027cc10666> (00000000-0000-0000-0000-000000000000)
How to get GlusterFS internal file identifiers (GFIDs) without digging into logs:
root@serv1 /var/log/glusterfs # gluster volume heal sites info Gathering Heal info on volume sites has been successful Brick serv1.domain.com:/opt/gls/sites/brick Number of entries: 3 <gfid:790d240d-6d8b-4540-9049-06664408cec7> <gfid:8f6a612a-6fda-45ee-aa84-e9cb847047c2> <gfid:2b6f14c4-e863-480a-9d72-c5027cc10666> Brick serv2.domain.com:/opt/gls/sites/brick Number of entries: 0 root@serv1 /var/log/glusterfs #
Apart from these entries, the cluster is working fine and files are synced between nodes without any issues. The number of entries is not increasing.
GlusterFS heal operation on volume sites not helped to fix issue:
root@serv1 /var/log/glusterfs # gluster volume heal sites Launching Heal operation on volume sites has been successful Use heal info commands to check status root@serv1 /var/log/glusterfs # gluster volume heal sites info Gathering Heal info on volume sites has been successful Brick serv1.domain.com:/opt/gls/sites/brick Number of entries: 3 <gfid:790d240d-6d8b-4540-9049-06664408cec7> <gfid:8f6a612a-6fda-45ee-aa84-e9cb847047c2> <gfid:2b6f14c4-e863-480a-9d72-c5027cc10666> Brick serv2.domain.com:/opt/gls/sites/brick Number of entries: 0 root@serv1 /var/log/glusterfs #
How you can fix such issues when you have no file paths, but only gfid’s?
GlusterFS internal file identifier (GFID) is a uuid that is unique to each file across the entire cluster. This is analogous to inode number in a normal filesystem.
At the time of writing I found three methods to obtain file path from GFID: https://gluster.readthedocs.org/en/latest/Troubleshooting/gfid-to-path/
I’ve used method 3 with bash GFID resolver proposed at https://gist.github.com/semiosis/4392640
root@serv1 ~ # ./gfid-resolver.sh /opt/gls/sites/brick 790d240d-6d8b-4540-9049-06664408cec7 790d240d-6d8b-4540-9049-06664408cec7 == File: /opt/gls/sites/brick/somedomain.com/htdocs/images/_thumbs_98x138/7d3a770000649f3b72e15152958211dd.jpg root@serv1 ~ # ./gfid-resolver.sh /opt/gls/sites/brick 8f6a612a-6fda-45ee-aa84-e9cb847047c2 8f6a612a-6fda-45ee-aa84-e9cb847047c2 == File: /opt/gls/sites/brick/somedomain.com/htdocs/images/_thumbs_98x138/a7dcc888f4f8b73bcd1aa53b2b8ca667.jpg root@serv1 ~ # ./gfid-resolver.sh /opt/gls/sites/brick 2b6f14c4-e863-480a-9d72-c5027cc10666 2b6f14c4-e863-480a-9d72-c5027cc10666 == File: /opt/gls/sites/brick/somedomain.com/htdocs/images/_thumbs_98x138/fef9da3fa55971c679407c277f7e0330.jpg root@serv1 ~ #
Now when you have exact file path and file name you need to find GlisterFS hard link to it:
root@serv1:~/img# find /opt/gls/sites/ -samefile /opt/gls/sites/brick/somedomain.com/htdocs/images/_thumbs_98x138/a7dcc888f4f8b73bcd1aa53b2b8ca667.jpg -print /opt/gls/sites/brick/.glusterfs/8f/6a/8f6a612a-6fda-45ee-aa84-e9cb847047c2 /opt/gls/sites/brick/somedomain.com/htdocs/images/_thumbs_98x138/a7dcc888f4f8b73bcd1aa53b2b8ca667.jpg root@serv1:~/img#
Then temporarily move file a7dcc888f4f8b73bcd1aa53b2b8ca667.jpg somewhere and remove (with rm -f “file”) broken link /opt/gls/sites/brick/.glusterfs/8f/6a/8f6a612a-6fda-45ee-aa84-e9cb847047c2.
Only then volume healing really “heal” volume, and broken entry disappeared:
root@serv1 ~/img # gluster volume heal sites Launching Heal operation on volume sites has been successful Use heal info commands to check status root@serv1 ~/img # gluster volume heal sites info Gathering Heal info on volume sites has been successful Brick serv1.domain.com:/opt/gls/sites/brick Number of entries: 2 <gfid:790d240d-6d8b-4540-9049-06664408cec7> <gfid:2b6f14c4-e863-480a-9d72-c5027cc10666> Brick serv2.domain.com:/opt/gls/sites/brick Number of entries: 0 root@serv1 ~/img #
Then I did same operations with other two entries and after final healing both bricks are OK:
root@serv1 ~/img # gluster volume heal sites info Gathering Heal info on volume sites has been successful Brick serv1.domain.com:/opt/gls/sites/brick Number of entries: 0 Brick serv2.domain.com:/opt/gls/sites/brick Number of entries: 0 root@serv1 ~/img #
Now you need to move back your files to their original positions, make sure you copy not to brick path (/opt/gls/sites), but to real GlusterFS mount point (/home/sites) so replication will sync it with serv2:
root@serv1 ~/bin # df -h Filesystem Size Used Avail Use% Mounted on ... /dev/mapper/vg0-sites 700G 44G 656G 7% /opt/gls/sites localhost:/sites 700G 44G 656G 7% /home/sites
Now we are done, sync is OK:
root@serv1 ~/img # /root/bin/check_glusterfs -v sites -n 2 -w 10 -c 5 OK: 2 bricks; free space 655GB root@serv1 ~/img #
P.S.
check_glusterfs nagios plugin used for serv1 is https://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/GlusterFS-checks/details