memcache安裝配置

wang_0720發表於2013-11-05
下載軟體




編譯安裝libevent
tar zxf libevent-2.0.20-stable.tar.gz
cd libevent-2.0.20-stable
./configure --prefix=/usr/local/libevent && make && make install
安裝memcache
tar zxf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent && make && make install
安裝php的memcache擴充套件
安裝libmemcached
tar zxf libmemcached-1.0.14.tar.gz
cd libmemcached-1.0.14
./configure --prefix=/usr/local/libmemcached
make
出錯
/libmemcached-1.0/memcached.h:46:27: error: tr1/cinttypes: No such file or directory
make[1]: *** [libmemcached/csl/libmemcached_libmemcached_la-context.lo] Error 1
make[1]: Leaving directory `/packages/libmemcached-1.0.9'
make: *** [all] Error 2

解決
安裝gcc44 gcc44-c++ libstdc++44-devel
rpm -ivh -nodeps gcc44 gcc44-c++ libstdc++4-devel
export CC=/usr/bin/gcc44
export CXX=/usr/bin/g++44

繼續編譯安裝,加引數--with-memcached
 
./configure --prefix=/usr/local/libmemcached --with-memcached
make && make install
安裝memcached的php擴充套件
tar zxf memcached-2.1.0.tgz
cd memcached-2.1.0
沒有configure檔案,用phpize生成configure檔案
/usr/local/php/bin/phpize 產生configure檔案
./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/
make
make install
編輯php.ini,加入extension=memcache.so
cat /usr/local/lib/php.ini |grep memcache
extension=memcache.so
啟動memcache
/usr/local/memcached/bin/memcached -u root -d restart -m 1500 -c 1024 -l 192.168.151.138 -p 11211 -vv >/var/log/memcache.log 2>&1
引數說明,具體見memcached -h
-p       TCP port number to listen on (default: 11211)
-U       UDP port number to listen on (default: 11211, 0 is off)
-l      interface to listen on (default: INADDR_ANY, all addresses)
              may be specified as host:port
-d            run as a daemon
-c       max simultaneous connections (default: 1024)
-m       max memory to use for items in megabytes (default: 64 MB)
-v            verbose (print errors/warnings while in event loop)
-vv           very verbose (also print client commands/reponses)
-vvv          extremely verbose (also print internal state transitions)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27181165/viewspace-775756/,如需轉載,請註明出處,否則將追究法律責任。

相關文章