[Gluster-users] how to get hash range of a brick?

Prashanth Pai ppai at redhat.com
Fri Sep 5 06:18:12 UTC 2014


Hi,

Probably, a really late reply but here you go:
This small python script(gf_dm_hash.py) should get hash of filename:
http://joejulian.name/blog/dht-misses-are-expensive/

Regards,
 -Prashanth Pai

----- Original Message -----
From: "david zhang700" <david.zhang700 at gmail.com>
To: "Ben Turner" <bturner at redhat.com>
Cc: gluster-users at gluster.org
Sent: Friday, July 25, 2014 8:56:41 AM
Subject: Re: [Gluster-users] how to get hash range of a brick?

thank you. so how can I know Davies Meyer hash value of a file? is that the 
value of trusted.gfid?

-----原始邮件----- 
From: Ben Turner
Sent: Friday, July 25, 2014 4:51 AM
To: david zhang700
Cc: gluster-users at gluster.org
Subject: Re: [Gluster-users] how to get hash range of a brick?

----- Original Message -----
> From: "david zhang700" <david.zhang700 at gmail.com>
> To: gluster-users at gluster.org
> 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
> Gluster-users at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-users 

_______________________________________________
Gluster-users mailing list
Gluster-users at gluster.org
http://supercolony.gluster.org/mailman/listinfo/gluster-users


More information about the Gluster-users mailing list