zoukankan      html  css  js  c++  java
  • 7、单机运行环境搭建之 --CentOS6.4安装Memcached

    接上文。

    1、准备文件

    cd /usr/src
    

      最新版下载地址 :http://code.google.com/p/memcached/downloads/list

     

      wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz

    wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz 

     2、安装libevent

    cd /usr/src
    tar -zxvf libevent-2.0.20-stable.tar.gz
    cd libevent-2.0.20-stable
    用./configure命令进行配置,检查当前的环境
    ./configure -prefix=/usr
    make
    make install

     3、安装memcached

    cd /usr/src
    tar -zxvf memcached-1.4.15.tar.gz
    cd memcached-1.4.15
    ./configure
    make
    make install

    4、验证安装

    ll /usr/local/bin | grep memcached

    5、启动memcached

    ln -s /usr/lib/libevent-2.0.so.5 /lib64/libevent-2.0.so.5
    /usr/local/bin/memcached -d -m 512 -c 512 -p 11211 -u root -t 10

     6、memcached启动停止脚本

    vi /etc/rc.d/init.d/memcached

    内容如下:

    #!/bin/sh
    #
    # memcached: MemCached Daemon
    #
    # chkconfig: - 90 25
    # description: MemCached Daemon
    #
    # Source function library.
    . /etc/rc.d/init.d/functions
    . /etc/sysconfig/network
    #[ ${NETWORKING} = "no" ] && exit 0
    #[ -r /etc/sysconfig/dund ] || exit 0
    #. /etc/sysconfig/dund
    #[ -z "$DUNDARGS" ] && exit 0
    start()
    {
    echo -n $"Starting memcached: "


    daemon $MEMCACHED -u daemon -d -m 1024 -u nobody  -p 11211


    echo
    }
    stop()
    {
    echo -n $"Shutting down memcached: "
    killproc memcached
    echo
    }

    MEMCACHED="/usr/local/bin/memcached"

    [ -f $MEMCACHED ] || exit 1 
    # See how we were called.
    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    ;;
    restart)
    stop
    sleep 3
    start
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1
    esac
    exit 0

    然后执行如下命令:

    cd  /etc/rc.d/init.d
    
    chmod 777 memcached
    
    chkconfig  --add memcached 
    
    chkconfig  --level 235  memcached  on
    
    chkconfig  --list | grep mem
  • 相关阅读:
    JZOJ 4298. 【NOIP2015模拟11.2晚】我的天
    JZOJ 4314. 【NOIP2015模拟11.4】老司机
    JZOJ 4313. 【NOIP2015模拟11.4】电话线铺设
    SP2416 DSUBSEQ
    JZOJ 2020.08.03【NOIP提高组】模拟 &&【NOIP2015模拟11.5】
    Android一些网站介绍
    http://www.androiddevtools.cn/
    Eclipse的安装使用
    JDK环境配置
    关于appcompat_v7的说明
  • 原文地址:https://www.cnblogs.com/littlehb/p/2995458.html
Copyright © 2011-2022 走看看