----- Original Message -----
> From: "david zhang700" <[email protected]>
> To: [email protected]
> Sent: Thursday, July 24, 2014 11:39:34 AM
> Subject: [Gluster-users] how to get hash range of a brick?
> 
> hi,who can tell me how to get hash range of a brick? thank you!
> David

The command:

getfattr -n trusted.glusterfs.dht -e hex $brick

Will tell ya.  Run that on each brick.  IDK if this is useful but I keep a map 
of hash ranges when I do testing so I know where a file _should_ be:

    gluster volume info $volname | egrep '^Brick[0-9]+' |sed 's/: /=/' > 
/dev/shm/${volname}_brickinfo
    sed -i "s/^Brick/${volname}_Brick/g" /dev/shm/${volname}_brickinfo
    # Build hash range for bricks
    echo "Starting volume to populate xattrs"
    gluster v start $volname --mode=script
    sleep 5
    echo "Stopping volume"
    gluster v stop $volname --mode=script
    touch /dev/shm/${volname}_hashrange
    for line in $(/bin/cat /dev/shm/${volname}_brickinfo); do
        host=$(/bin/echo $line | /bin/cut -d '=' -f 2 | /bin/cut -d ':' -f 1)
        brick=$(/bin/echo $line | /bin/cut -d '=' -f 2 | /bin/cut -d ':' -f 2)
        range=$(ssh -i /root/.ssh/my_key $host "getfattr -n 
trusted.glusterfs.dht -e hex $brick")
        hash_range=$(/bin/echo $range | /bin/cut -d '=' -f 2 | /bin/sed 
's/0x0000000100000000//g')
        end_range=${hash_range:8}
        begin_range=$(/bin/echo $hash_range | /bin/sed "s/$end_range//g")
        echo "${line}:${begin_range}:${end_range}" >> 
/dev/shm/${volname}_hashrange
    done

-b



> 
> _______________________________________________
> Gluster-users mailing list
> [email protected]
> http://supercolony.gluster.org/mailman/listinfo/gluster-users
_______________________________________________
Gluster-users mailing list
[email protected]
http://supercolony.gluster.org/mailman/listinfo/gluster-users

Reply via email to