16 Apr 2009, 5:46pm
jobs:

3 comments




  • how to install memchached 1.2.2 from source

    I have installed an instance of mem­chached ver­sion 1.2.2 on one of our servers (Debian etch) today and to keep you from spend­ing a whole after­noon, see my everything-step-by-step instruc­tion below.

    Mem­chached is a dis­trib­uted hash map, which can be used for exam­ple to speed up any kind of web appli­ca­tion, see web­site for details. In our case, we want to use it as tem­po­rary data store. I will report about the expe­ri­ences in a lat­ter post.

    intro­duc­tion

    Always refer to this page for details, but I cre­ated a ver­sion with less text but includ­ing steps to really start from scratch.

    All lines start­ing with # are com­mand lines, i.e. you need to type into a linux shell.
    Out­put of any kind is always sur­rounded by ” even if it is mul­ti­line output.

    con­tent

    a. get libevent (needed to install mem­cached)
    b. get mem­cached and ver­ify instal­la­tion
    c. use and test mem­cached within Java with junit/ant

    a. installing libevent 1.3

    a.1. check for cur­rent ver­sion of libevent

    a.1a.

    Log in as root or get super user rights by call­ing su

    # updat­edb
    # locate libevent

    If there is out­put includ­ing “libevent1” and/or “libevent-1″ (ignore pack­age files like *.deb) -> a.1b, oth­er­wise a.2

    a.1b. remov­ing old libevent version

    # apt-get remove –purge libevent1
    # Y

    # updat­edb
    # locate libevent
    Should now return noth­ing or pack­age files only, i.e. you are ready for installation

    a.2. installing libevent 1.3

    a.2a down­load­ing and unpacking

    # cd /usr/local/src
    # wget http://monkey.org/~provos/libevent-1.3b.tar.gz
    # tar zxvf libevent-1.3b.tar.gz
    # cd libevent-1.3b

    a.2b. con­fig­ur­ing

    # ./configure
    check the out­put, if it con­tains some­thing like “con­fig­ure: error: no accept­able C com­piler found in $PATH” -> a.2c. oth­er­wise a.2d.

    a.2c. com­pil­ing

    # apt-get install gcc

    Redo a.2b.
    I got out­put like “C com­piler can­not cre­ate exe­cuta­bles”, read­ing file ‘config.log’ did not help me at all. Googling finally did, as I found a forum entry, point­ing out a miss­ing lib.
    So try this:

    # apt-get install libc-dev

    Redo a.2b.
    If that did  not solve it… sorry … google on, there is no sense in going on with­out solv­ing this issue. :-/

    a.2d. make it!

    # make && make install

    If you get some­thing like “-bash: make: com­mand not found” -> A.2e, oth­er­wise A.3.

    a.2e.

    # apt-get install make

    Redo a.2d.

    a.3. con­fig­u­ra­tion

    Press the Esc key as you read [esc] in the com­mands below.

    # vim /etc/ld.so.conf.d/libevent-i386.conf
    # i/usr/local/lib/[esc]:wq
    # ldconfig

    b. install mem­chached and ver­ify installation

    b.1. down­load, unpack and install memchached

    # cd /usr/local/src
    # wget http://danga.com/memcached/dist/memcached-1.2.2.tar.gz
    # tar zxvf memcached-1.2.2.tar.gz
    # cd memcached-1.2.2
    # ./configure
    # make && make install

    After installing gcc and libc-dev in sec­tion a, this one went eas­ily for me — if you skipped sec­tion a and run in prob­lems here, please install gcc and libc-dev (see a.2c).

    b.2. ver­ify instal­la­tion of memchached

    b.2a. start mem­chached server

    # mem­cached –u www-data –vv

    Out­put should end with line “<3 server lis­ten­ing”. Per­fect! :)

    b.2b test server

    I will refer to this shell in front of you as server shell below. Now, open another shell on the same machine, I will refer to it a client shell.

    # tel­net local­host 11211

    You should see some­thing like “<7 new client con­nec­tion” on the server shell, switch back to client shell.

    # set test1 1 10000 1
    # a

    You should see “STORED” on client shell and the two fol­low­ing lines on server shell
    ”<7 set test1 1 10000 1
    >7 STORED

    Per­fect!
    You did it, your mem­cached is up and run­ning :)

    c. mem­cached and Java

    I wrote a lit­tle test pack­age using a Java client library for mem­cached from here, together with junit and ant. You can down­load it to have a look how sim­ple using mem­cache is and to ver­ify your instal­la­tion with an included  junit test, auto­mated with an ant build file.

    […] ORIGINAL arti­cle can be view here […]

    The arti­cle is ver good. Write please more

    30 Nov 2010, 9:45am
    by Gox­So­Manawn


    Very nicce!

    *name

    *e-mail

    web site

    leave a comment