[Level 2] Install Memcached(BSD License) on CentOS 5.4

If you don't know what memcached is, please refer to the link here.

1. Download the source from official website.
http://memcached.org/
2. Unzip/Untar the source.
# gzip -cd ./memcached-1.4.4.tar.gz | tar xvf -

3. Configure source/Make/Make install.
# cd ./memcached-1.4.4
# ./configure
# make && make install
PS. In my environment, when I configure the source, the error message show up, and told me that the memcached need libevent. If you have the same problem, just download it from here. And compile it by yourself. And I create a symbolic link for libevent.
# ln -s /usr/local/lib/libevent-1.4.so.2 /lib64/libevent-1.4.so.2


4. Start memcached.
# vi /etc/memcached.conf                                    ## memcached configuration file
# memcached -l 127.0.0.1 -P 11211 -m 128 -d`   ## for deamon
# memcached -l 127.0.0.1 -P 11211 -m 128 -vv` ## for development debug

5. test it.
a. test it by command:
You can telnet the memcached server with telnet command.
And send the message by manual.
ex. ( I high-light want I type in blue )
# telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1 (127.0.0.1).
Escape character is '^]'.
set test1 0 0 10
testing001
STORED
set test2
ERROR
set test2 0
ERROR
set test2 0 0
ERROR
set test2 0 0 10
testing002
STORED
add test1 0 0 10
testing001-add
CLIENT_ERROR bad data chunk
ERROR
add test1 0 0 10
testing100
NOT_STORED
replace test1 0 0 10
testing003
STORED
get test1
VALUE test1 0 10
testing003
END
get test1 test2
VALUE test1 0 10
testing003
VALUE test2 0 10
testing002
END

b. test it with python script:
I donwload the python module for memcached for testing. Click here to get the module.
# gzip -cd ./python-memcached-1.45.tar.gz | tar xvf -
# cd ./python-memcached-1.45.tar.gz
# /usr/bin/python ./setup.py build
# /usr/bin/python ./setup.py install
# /usr/bin/python ./memcache.py


PS.
Max object size is 1MB (configurable at build time)


Wish this helps.

regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 1] Rar tool for Solaris.

[Level 2] iif in Python