Install
Linux: centos5.4
Install libevent Library
cd /usr/local/srcwget http://monkey.org/~provos/libevent-1.3b.tar.gztar zxvf libevent-1.3b.tar.gzcd libevent-1.3b./configuremake && make install
Installed successfully
Install memcache
cd /usr/local/srcwget http://danga.com/memcached/dist/memcached-1.2.5.tar.gztar zxvf memcached-1.2.5.tar.gzcd memcached-1.2.5./configuremake && make install
Start
CD usr/local/Binbin] # memcached-H error memcached: Error while loading shared libraries: libevent-1.3b.so.1: cannot open shared object file: no such file or directory
Google solution: http://bbs.yiwz.net/archiver? Tid-86.html
Run ld_dubug = libs to know the library loading path when memcached is started. The details are as follows:
[root@bogon usr/local/bin]# LD_DEBUG=libs memcached –v 5112: find library=libevent-1.3b.so.1 [0]; searching 5112: search cache=/etc/ld.so.cache 5112: search path=/lib/tls/i686/sse2:/lib/tls/i686:/lib/tls/sse2:/lib/tls:/lib/i686/sse2:/lib/i686:/lib/sse2:/lib:/usr/lib/tls/i686/sse2:/usr/lib/tls/i686:/usr/lib/tls/sse2:/usr/lib/tls:/usr/lib/i686/sse2:/usr/lib/i686:/usr/lib/sse2:/usr/lib (system search path) 5112: trying file=/lib/tls/i686/sse2/libevent-1.3b.so.1 5112: trying file=/lib/tls/i686/libevent-1.3b.so.1 5112: trying file=/lib/tls/sse2/libevent-1.3b.so.1 5112: trying file=/lib/tls/libevent-1.3b.so.1 5112: trying file=/lib/i686/sse2/libevent-1.3b.so.1 5112: trying file=/lib/i686/libevent-1.3b.so.1 5112: trying file=/lib/sse2/libevent-1.3b.so.1 5112: trying file=/lib/libevent-1.3b.so.1 5112: trying file=/usr/lib/tls/i686/sse2/libevent-1.3b.so.1 5112: trying file=/usr/lib/tls/i686/libevent-1.3b.so.1 5112: trying file=/usr/lib/tls/sse2/libevent-1.3b.so.1 5112: trying file=/usr/lib/tls/libevent-1.3b.so.1 5112: trying file=/usr/lib/i686/sse2/libevent-1.3b.so.1 5112: trying file=/usr/lib/i686/libevent-1.3b.so.1 5112: trying file=/usr/lib/sse2/libevent-1.3b.so.1 5112: trying file=/usr/lib/libevent-1.3b.so.1
Then create a link for the libevent-1.3b.so.1:
[root@bogon ~]# sudo ln -s /usr/local/lib/libevent-1.3b.so.1 /lib/libevent-1.3b.so.1
Check whether the creation is successful
[root@bogon ~]# ls -al /lib|grep libeventlrwxrwxrwx 1 root root 33 Aug 25 19:52 libevent-1.3b.so.1 -> /usr/local/lib/libevent-1.3b.so.1
In this case
bin] # memcached –h
memcached 1.2.5-p <num> TCP port number to listen on (default: 11211)-U <num> UDP port number to listen on (default: 0, off)-s <file> unix socket path to listen on (disables network support)-a <mask> access mask for unix socket, in octal (default 0700)-l <ip_addr> interface to listen on, default is INDRR_ANY-d run as a daemon-r maximize core file limit-u <username> assume identity of <username> (only when run as root)-m <num> max memory to use for items in megabytes, default is 64 MB-M return error on memory exhausted (rather than removing items)-c <num> max simultaneous connections, default is 1024-k lock down all paged memory. Note that there is a limit on how much memory you may lock. Trying to allocate more than that would fail, so be sure you set the limit correctly for the user you started the daemon with (not for -u <username> user; under sh this is done with 'ulimit -S -l NUM_KB').-v verbose (print errors/warnings while in event loop)-vv very verbose (also print client commands/reponses)-h print this help and exit-i print memcached and libevent license-b run a managed instanced (mnemonic: buckets)-P <file> save PID in <file>, only used with -d option-f <factor> chunk size growth factor, default 1.25-n <bytes> minimum space allocated for key+value+flags, default 48
Now memcache is successfully completed
By default, memcached is installed in/usr/local/bin.
Start:
[root@bogon bin]# memcached -d -m 128 -u root -p 11211
Check whether startup is enabled
[root@bogon bin]# telnet 127.0.0.1 11211Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.
The content of the memcached startup option used here is as follows.
Option description
The TCP port used by P. The default value is 11211.
MB maximum memory size. The default value is 64 MB.
VV is started in very vrebose mode. debugging information and errors are output to the console.
D is started as a daemon in the background
View the internal status of memcached
[root@bogon bin]# cd /usr/local/bin[root@bogon bin]# telnet 127.0.0.1 11211Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.statsSTAT pid 6779STAT uptime 14217STAT time 1314343512STAT version 1.2.5STAT pointer_size 32STAT rusage_user 0.002999STAT rusage_system 0.027995STAT curr_items 0STAT total_items 0STAT bytes 0STAT curr_connections 3STAT total_connections 4STAT connection_structures 4STAT cmd_get 0STAT cmd_set 0STAT get_hits 0STAT get_misses 0STAT evictions 0STAT bytes_read 56STAT bytes_written 482STAT limit_maxbytes 134217728STAT threads 1ENDQuit
So far, your memcached has been successfully installed.