memcache 缓存 安装

一、下载软件包

# wget http://memcached.org/latest

 

 

二、解压安装

# yum -y install libevent-devel

 

# tar xvf memcached-1.4.15.tar.gz

# cd memcached-1.4.15

# ./configure –prefix=/usr/local/memcached –with-libevent=/usr/lib64 –enable-64bit

# make && make install

 

拷贝启动脚本:

# cd scripts/

# cp memcached.sysv /etc/init.d/memcached

# chkconfig –add memcached

# chkconfig –level 2345  memcached on

 

三、修改配置

# vim /etc/init.d/memcached

PORT=11211   #启动端口

MAXCONN=1024  #定义最大连接数

CACHESIZE=64  #最大的内存使用大小,默认是是64MB

OPTIONS=”-vv“ #打印出警告和错误信息,客户端的请求和返回信息

DATE=$(date +%Y%m%d)

LOG_FILE=”/var/log/memcached/memcached-$DATE.log“  #定义日志打印位置

MEMCACHED_BIN=”/usr/local/memcached/bin/memcached“  #定义memcached执行程序路径

 

start () {

    echo -n $”Starting $prog: “

    # insure that /var/run/memcached has proper permissions

    daemon $MEMCACHED_BIN -d -p $PORT -u $USER  -m $CACHESIZE -c $MAXCONN -P /var/run/memcached/memcached.pid $OPTIONS >>$LOG_FILE 2>>$LOG_FILE

    RETVAL=$?

    echo

    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached

}

 

四、启动服务

# /etc/init.d/memcached start

# netstat -ntlp

 

资源链接

 

http://snowolf.iteye.com/blog/1447348 

猜你喜欢

转载自chongzai.iteye.com/blog/1846176
0条评论
添加一条新回复