memcached windows/linux 装配和启动

memcached windows/linux 安装和启动

windows 

  • 安装命令:memcached.exe -d install

memcached windows/linux 装配和启动

  • 启动服务:memcached.exe -d start
  • 停止服务:memcached.exe -d stop
  • 测试:
memcached windows/linux 装配和启动

Linux

memcached windows/linux 装配和启动
  • 安装
参考官网给出的步骤,我用的是Centos,所以,第一步输入: yum install libevent-devel
wget http://memcached.org/latest
tar -zxvf memcached-1.4.24.tar.gz
mv memcached-1.4.24 memcached
cd memcached
./configure && make && make install
  • 启动:memcached -d -u root -P /tmp/memcached.pid
  • 停止:kill `cat /tmp/memcached.pid`
  • 测试方法同windows

写了个简单的.sh 启动命令

#!/bin/bash

if [ "$2" = "" ]; then
        port="11211"
else
        port="$2"
fi

#echo $port

start(){
        /usr/soft/memcached/memcached -d -u root -p $port -P /tmp/memcached.pid
        echo "memcached start"
        return 0
}

stop(){
        kill `cat /tmp/memcached.pid`
        echo "memcached stop"
        return 0
}

case $1 in
        start)
                start
        ;;
        stop)
                stop
        ;;
        *)
                echo "Usage: {start|stop}"
        ;;
esac


版权声明:本文为博主原创文章,未经博主允许不得转载。