共计 1909 个字符,预计需要花费 5 分钟才能阅读完成。
一.环境介绍
1)CentOS 6.6
2) memcached-1.4.24
二.部署安装
计划具体部署步骤:
步骤 1:安装
步骤 2:配置
步骤 3:运行
步骤 4:检查
现在开始:
1)安装
$ yum install -y wget gcc
$ wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar zxvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure –prefix=/usr/local/libevent
$ make && make install
$ wget http://www.memcached.org/files/memcached-1.4.24.tar.gz
$ tar zxvf memcached-1.4.24.tar.gz
$ cd memcached-1.4.24
$ ./configure –prefix=/usr/local/memcached –with-libevent=/usr/local/libevent
$ make && make install
$ ln -s /usr/local/memcached/bin/memcached /usr/local/bin/
2)配置
$ touch /etc/init.d/memcached
$ chmod 755 /etc/init.d/memcached
$ vi /etc/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
start()
{
echo -n $”Starting memcached: “
daemon /usr/local/bin/memcached -u daemon -d -m 2048 -l 0.0.0.0 -c 4096 -p 11211
echo
}
stop()
{
echo -n $”Shutting down memcached: “
killproc memcached
echo
}
[-f /usr/local/bin/memcached] || exit 0
# See how we were called.
case “$1” in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
;;
condrestart)
stop
start
;;
*)
echo $”Usage: $0 {start|stop|restart|reload|condrestart}”
exit 1
esac
exit 0
3)运行
$ /etc/init.d/memcached start
$ chkconfig memcached on
4)检查
# 主要是检查进程以及端口
$ ps aux|grep memcached
$ netstat -ntlp|grep memcached
$ echo “stats settings” | nc 127.0.0.1 11211
Memcached 安装及启动脚本 http://www.linuxidc.com/Linux/2013-07/87641.htm
PHP 中使用 Memcached 的性能问题 http://www.linuxidc.com/Linux/2013-06/85883.htm
Ubuntu 下安装 Memcached 及命令解释 http://www.linuxidc.com/Linux/2013-06/85832.htm
Memcached 的安装和应用 http://www.linuxidc.com/Linux/2013-08/89165.htm
使用 Nginx+Memcached 的小图片存储方案 http://www.linuxidc.com/Linux/2013-11/92390.htm
Memcached 使用入门 http://www.linuxidc.com/Linux/2011-12/49516p2.htm
Memcached 的详细介绍 :请点这里
Memcached 的下载地址 :请点这里
本文永久更新链接地址 :http://www.linuxidc.com/Linux/2015-07/119568.htm
![post-qrcode](https://www.xgss.net/wp-content/uploads/2023/07/二维码-微信公众号256x256.jpg)