Linux成长库

mencached 1.4.25快速安装部署

2017-08-04  本文已影响4人  泡菜爱上WaSabi

1.下载相关安装包(menmcache安装包和依赖库的包)

http://memcached.org/downloads

http://libevent.org/

memcached-1.4.25.tar.gz

libevent-2.0.21-stable.tar.gz

3、由于是源码安装,所以需要编译安装

解压

tar -xf memcached-1.4.25.tar.gz

tar -xf libevent-2.0.21-stable.tar.gz

编译、安装

cd libevent-2.0.21-stable

./configure --prefix=/usr/local/libevent

make && make install

cd memcached-1.4.25

./configure --prefix=/usr/local/memcached  --with-libevent=/usr/local/libevent/

make && make install

编写启动脚本

vim /etc/init.d/memcached

#!/bin/sh

#

# memcached:    MemCached Daemon

# author byq

# chkconfig:    - 90 25

# description:  MemCached Daemon

#

# Source function library.

. /etc/rc.d/init.d/functions

. /etc/sysconfig/network

start()

{

echo -n $"Starting memcached: "

daemon $MEMCACHED -u daemon -d -m 1024 -l 127.0.0.1 -p 11211

echo

}

stop()

{

echo -n $"Shutting down memcached: "

killproc memcached

echo

}

MEMCACHED="/usr/local/memcached/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

添加开机自动启动

chmod +x /etc/init.d/memcached

chkconfig  --add memcached

chkconfig  --level 235  memcached  on

root@localhost local]#  chkconfig  --list | grep mem

memcached      0:关闭 1:关闭 2:启用 3:启用 4:关闭 5:启用 6:关闭

启动memcached服务

service memcached start

Starting memcached:                                        [确定]

查看端口和进程

ss -tnl

State      Recv-Q Send-Q                            Local Address:Port                              Peer Address:Port

LISTEN    0      128                                    127.0.0.1:11211                                        *:*

ps aux | grep mem

daemon    33186  0.0  0.0 326976  1064 ?        Ssl  17:36  0:00 /usr/local/memcached/bin/memcached -u daemon -d -m 1024 -l 127.0.0.1 -p 11211

root      33336  0.0  0.0 103256  856 pts/0    S+  17:50  0:00 grep --color mem

上一篇下一篇

猜你喜欢

热点阅读