Hello,

 

I installed libketama following the instructions online.  After installing
libketama and php_ketama, are there any other steps needed to make this
work? 

 

I am assuming I need to add extension=ketama.so in php.ini?  

 

Here is the function that I am using to get a connection for a key.  How do
I change this code to use ketama hashing?  Do I have to change the file
ketama.servers and how?

 

        function _getConForKey($key)

        {

                $hashCode = 0;

 

                for ($i = 0, $len = strlen($key); $i < $len; $i++)

                {

                        $hashCode = (int)(($hashCode*33)+ord($key[$i])) &
0x7fffffff;

                }

 

                if (($ns = count($this->connections)) > 0)

                {

                        return $this->connections[$hashCode%$ns];

                        //return $this->connections[0];

                }

 

                return false;

        }

 

 

Also, while installing, I looked at the README provided:

 

$ cd php-4.4.x/ext

$ ln -s /your/ketama/php_ketama ketama

$ cd ..

$ rm -Rf autom4te.cache

$ ./buildconf --force

$ ./configure --all_your_configure_options
--with-ketama[=/your/ketama/prefix]

$ make

$ su -c "make install"

 

What options should I be setting when running ./configure
-all_your_configure_options?  What is the /your/ketama/prefix?

 

I also don't have the "buildconf" and running that line didn't work.  This
is what I did instead:

 

cd /usr/lib64/php4

wget http://static.last.fm/ketama/ketama-0.1.1.tar.bz2

bzip2 -cd ketama-0.1.1.tar.bz2 | tar xvf -

mv ketama libketama

 

cd libketama/libketama/

make

make install

 

cd /usr/lib64/php4

ln -s libketama/php_ketama ketama

 cp libketama/libketama/libketama.so /usr/lib64/

 

cd /usr/lib64/php4/libketama/php_ketama

phpize

rm -Rf autom4te.cache

./configure --enable-ketama

make

make install

 

I would appreciate any help you can give me.

 

Thanks,

YG

 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to