inux Memcached 安装
URL:http://www.runoob.com/memcached/memcached-install.html
# 编译安装需要安装下列插件
[root@localhost software]#yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
源代码安装
memcached 依赖 libevent-devel
[root@localhost software]# yum -y install libevent-devel
# 下载 memcahed 安装包
[root@localhost software]# wget http://memcached.org/latest
# 解压
[root@localhost software]#tar -zxvf latest
# 配置
[root@localhost memcached-1.5.12]# ./configure --prefix=/usr/local/memcached
# 编译
[root@localhost memcached-1.5.12]#make
# 安装
[root@localhost memcached-1.5.12]#sudo make install
# 启动服务端,要远程访问的话 把:127.0.0.1 改成对应的IP 192.168.1.210 ,绑定所有IP就可以写 0.0.0.0
[root@localhost memcached-1.5.12]#/usr/local/memcached/bin/memcached -d -m 2048 -u root -l 127.0.0.1 -p 12888 -c 1024 -P /tmp/memcached.pid
# 配置远程访问
[root@localhost memcached-1.5.12]#/usr/local/memcached/bin/memcached -d -m 2048 -u root -l 0.0.0.0 -p 12888 -c 1024 -P /tmp/memcached.pid
-d选项是启动一个守护进程,
-m是分配给Memcache使用的内存数量,单位是MB,我这里是2048MB,
-u是运行Memcache的用户,我这里是root,
-l是监听的服务器IP地址,如果有多个地址的话,我这里指定了服务器的IP地址127.0.0.1
-p是设置Memcache监听的端口,我这里设置了12888,最好是1024以上的端口,
-c选项是最大运行的并发连接数,默认是1024,我这里设置了1024,按照你服务器的负载量来设定,
-P是设置保存Memcache的pid文件,我这里是保存在 /tmp/memcached.pid,
# 检查是否启动成功
[root@localhost memcached-1.5.12]#ps aux |grep memcached | grep -v grep
# 结束memcached
[root@localhost memcached-1.5.12]#kill `cat /tmp/memcached.pid`