[Gluster-users] Transforming server with existing data into a GlusterFS node

Christopher Hawkins chawkins at bplinux.com
Thu Feb 5 12:59:27 UTC 2009


I recall a good bit of discussion about this a while back... There is a part of the wiki devoted to this topic: 
http://www.gluster.org/docs/index.php/Setting_up_AFR_on_two_servers_with_pre-existing_data 

Also I wrote a 'set-attrs' script for setting glusterfs attributes on existing data, essentially "converting" it to gluster format. Included below... It will ignore anything that already has glusterfs attributes, and will set them on anything that doesn't. 

#!/bin/bash 

DIR=$1 

if [ -z $DIR ] 
then 
echo 
echo "Error - no path was given." 
echo 
echo "USAGE: set-attrs /path/to/check" 
echo 
echo "Run set-attrs to check all files and directories in the" 
echo "given path for glusterfs attributes. Any files without" 
echo "a glusterfs version will be given a version attr of 2" 
echo "and a createtime attr equal to the files last modified time." 
echo 
echo "Output information is logged to syslog (usually /var/log/messages)" 
echo 
exit 0 
fi 

set_attrs() { 

get_ver="getfattr --absolute-names -n trusted.glusterfs.version" 
set_ver="setfattr -n trusted.glusterfs.version" 
set_ct="setfattr -n trusted.glusterfs.createtime" 

if test "`$get_ver $i 2>/dev/null | fgrep -c trusted.glusterfs.version=`" = "0" 
then 
mods=$((mods+1)) 
# comment out next line to turn off logging 
initlog -n set-attrs -s "Setting attrs on $i" 
CT=`stat -c %Y $i` 
$set_ct -v $CT $i 
$set_ver -v 2 $i 
fi 
} 

mods=0 
checks=0 

initlog -n set-attrs -s "Starting a set-attrs run on path: $DIR" 

for i in `find $DIR -print` 
do 
set_attrs $i 
checks=$((checks+1)) 
done 

initlog -n set-attrs -s "Completed. $checks checks and $mods mods in this run" 

exit 0 


----- Original Message ----- 
From: "Stas Oskin" <stas.oskin at gmail.com> 
To: gluster-users at gluster.org 
Sent: Wednesday, February 4, 2009 6:39:34 PM GMT -05:00 US/Canada Eastern 
Subject: [Gluster-users] Transforming server with existing data into a GlusterFS node 



Hi. 

I wonder, is it possible to transform a server with existing data into GlusterFS node? 
Meaning, define a volume then gradually move all the files into it? 

Or it's much better to start a new one from scratch? 

Regards. 

_______________________________________________ Gluster-users mailing list Gluster-users at gluster.org http://zresearch.com/cgi-bin/mailman/listinfo/gluster-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-users/attachments/20090205/39f2b48e/attachment.html>


More information about the Gluster-users mailing list