아 Memcached 홈페이지 배너가 너무 Geek(덕스럽) 하다. 이 포스트가 이 블로그에서 제일 많이 들어오는 거리 중 하나라서 기념 배너를 추가해봤다.
case centos
일단centos 배포본에는 memcached가 없다 그래서 소스컴파일로 설치한다.(root로 가정)
yum install libevent libevent-devel wget http://memcached.googlecode.com/files/memcached-1.4.9.tar.gz tar -xvzf memcached-1.4.9.tar.gz cd memcached-1.4.9 ./configure --with-libevent=/usr/lib/ make; make install
기본 설정 파일도 만들어주자.
vi /etc/memcached.conf #Memory a usar -m 16 # default port -p 11211 # user to run daemon nobody/apache/www-data -u nobody # only listen locally -l 127.0.0.1
init script 도 생성해준다. 참조 사이트
- http://www.vbseo.com/blogs/danny-bembibre/daemon-scripts-memcached-44/
- http://www.dev411.com/wiki/Memcached_startup_files_for_Red_Hat_%28RHEL%29
일단 만들어 놓은 스크립트가 있으니 다운받아 사용도록 하자
memcached init script downlod : memcached_script.tar.gz
wget http://yupmin.net/wp-content/uploads/2010/08/memcached_script.tar.gz tar xvfz memcached_script.tar.gz mv start-memcached /usr/local/bin/start-memcached mv memcached /etc/init.d/memcached chmod 755 /usr/local/bin/start-memcached chmod 755 /etc/init.d/memcached
case ubuntu
유분투에는 쉽게 설치 패키지가 준비되어있다.(root로 가정)
apt-get install memcached service memcached start
case centos
memcached php 관련 패키지는 centos에 있다.
yum install php-pecl-memcache
혹은 php버젼이 업데이트 되거나 몇가지 안되는 경우가 있다 이럴땐 직접 컴파일한다.
wget http://pecl.php.net/get/memcache-2.2.5.tgz tar xvfz memcache-2.2.5.tgz cd memcache-2.2.5 phpize ./configure --enable-memcache make cp modules/memcache.so /usr/lib/php/modules
php에 모듈을 셋팅해주자.
vi /etc/php.d/memcache.ini extension=memcache.so
memcached php test : http://dorkage.net/2009/02/memcached-test/
이외에 또한 memcache php 모듈과 다르게 memcached php모듈이 있는데 필요하면 깔아둔다.
참조 : http://libmemcached.org http://pecl.php.net/package/memcached
wget http://launchpad.net/libmemcached/1.0/0.53/+download/libmemcached-0.53.tar.gz ./configre make; make install wget http://pecl.php.net/get/memcached-2.0.0b2.tgz tar xvfz memcached-2.0.0b2.tgz cd memcached-2.0.0b2 phpize ./configure --with-libmemcached-dir=/usr/local/lib/ make; make install vi /etc/php.d/memached.ini extension=memcached.so
A quick way to get memcached status : http://www.mysqlperformanceblog.com/2008/11/26/a-quick-way-to-get-memcached-status/
watch "echo stats | nc 127.0.0.1 11211"
mysql 컨퍼런스에서 한 외국인 강사가 발표했던 키노트 : http://download.tangent.org/talks/Memcached%20Study.pdf
