如何使用HHVM Memcached? HHVM是内置扩展Memcached,所以只要安装下Memcached服务端。
需要的东西:
libevent 最新版
wget https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz
memcached 最新版
wget http://www.memcached.org/files/memcached-1.4.22.tar.gz
安装步骤
Libevent安装
[root@jw-test01 software]# tar zxvf libevent-2.0.22-stable.tar.gz [root@jw-test01 software]# cd libevent-2.0.22-stable [root@jw-test01 libevent]# ./configure --prefix=/usr/local/libevent/ [root@jw-test01 libevent]# make [root@jw-test01 libevent]# make install
Memcached安装
[root@jw-test01 software]# tar -zxvf memcached-1.4.22.tar.gz [root@jw-test01 software]# cd memcached-1.4.22 [root@jw-test01 memcached]# ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent/ [root@jw-test01 memcached]# make [root@jw-test01 memcached]# make install
编写Memcached启动脚本memcached.sh
#!/bin/bash # author:kuangl # date:2013-05-30 # description: Starts and stops the Memcached services. # pidfile: /tmp/memcached1.pid # config: /usr/local/memcached # chkconfig: - 55 45 # source function library . /etc/rc.d/init.d/functions memcached="/usr/local/memcached/bin/memcached" [ -e $memcached ] || exit 1 start() { echo "Starting memcached:" daemon $memcached -d -m 1000 -u root -l 127.0.0.1 -p 11211 -c 1500 -P /tmp/memcached1.pid } stop() { echo "Shutting down memcached" killproc memcached } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 3 start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?
将脚本memcached.sh复制到init.d目录下
[root@jw-test01 scripts]# cp memcached.sh /etc/init.d/memcached
将memcached加入系统启项
[root@jw-test01 scripts]# chkconfig --add memcached [root@jw-test01 scripts]# chkconfig --level 35 memcached on
启动memcached
[root@jw-test01 scripts]# service memcached restart Shutting down memcached [确定] Starting memcached: [确定] [root@jw-test01 scripts]# ps -ef |grep memcached root 27616 1 0 22:18 ? 00:00:00 /usr/local/memcached/bin/memcached -d -m 1000 -u root -l 127.0.0.1 -p 11211 -c 1500 -P /tmp/memcached1.pid
The post HHVM安装Memcached appeared first on WordPress Note.