码迷,mamicode.com
首页 > 系统相关 > 详细

在Linux上安装Memcached服务

时间:2015-09-21 23:44:47      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:

1, 下载libevent,并安装

  下载地址为:https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz

  解压:

  tar -zxvf libevent-2.0.21-stable.tar.gz

  安装:

  ./configure --prefix=/usr (指定安装到/usr/local/libevent目录下)

  编译:make

  make install

  安装完成!

2, 下载:#http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz

  或者:http://download.chinaunix.net/download.php?id=32229&ResourceID=6665

  命令: tar -zxvf memcached-1.4.17.tar.gz

  安装:

  ./configure --prefix=/usr/local/memcached-1.4.17

  若安装过程中提示找不到libevent路径时,使用--with-libevent=libevent安装的目录

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

    编译:make

  make install

  安装完成!

3.   启动

  /usr/local/memcached-1.4.17/bin/memcached -d -m 128 -u root -p 11211 -c 1024 -P /tmp/memcached.pid

  启动参数说明:

  -d 选项是启动一个守护进程。

  -u root 表示启动memcached的用户为root。

  -m 是分配给Memcache使用的内存数量,单位是MB,默认64MB。

  -M return error on memory exhausted (rather than removing items)。

  -u 是运行Memcache的用户,如果当前为root 的话,需要使用此参数指定用户。

  -p 是设置Memcache的TCP监听的端口,最好是1024以上的端口。

  -c 选项是最大运行的并发连接数,默认是1024。

  -P 是设置保存Memcache的pid文件。

4.  停止

  先查看进程的id

  ps -ef|grep memcached

  root    15144    1  0 08:43 ?        00:00:00 /usr/local/memcached-1.4.17/bin/memcached -d -m 128 -u root -p 11211 -c 1024 -P /tmp/memcached.pid

  15144为pid

  停止命令为:kill -9 15144

在Linux上安装Memcached服务

标签:

原文地址:http://www.cnblogs.com/maomaochong123/p/4827613.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!