memcached安装部署及启动错误排查

1、安装 libevent:

cd /usr/local

rz

tar xf libevent-2.0.22-stable.tar.gz 

cd libevent-2.0.22-stable

./configure

make

make install

cd ../

mv libevent-2.0.22-stable.tar.gz /server/tools/

# 查看版本信息

ls -al /usr/local/lib | grep libevent


2、安装memcached

cd /usr/local

rz

tar xf memcached-1.4.15.tar.gz 

cd memcached-1.4.15

./configure

make

make install

cd ../

mv memcached-1.4.15.tar.gz /server/tools/


3、启动memcached服务端


echo "/user/local/lib" >> /etc/ld.so.conf

ldconfig

memcached -p 11211 -u root -m 16m -c 10240 -d


======================================================

# 如果启动报如下错误,表示memcached 找不到libevent 的位置

[root@cmwap local]#memcached -p 11211 -u root -m 16m -c 10240 -d

memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

# 解决办法:


whereis libevent


# 再看memcached 从哪里找它

LD_DEBUG=libs memcached -v 2>&1 > /dev/null | less


#找到这条语句

26421:       trying file=/usr/lib64/libevent-2.0.so.5


# 创建软链接

ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

======================================================

# 启动memcached

memcached -p 11211 -u root -m 16m -c 10240 -d


# 查看端口监听

[root@cmwap local]# lsof -i :11211

COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

memcached 25444 root   26u  IPv4  82781      0t0  TCP *:memcache (LISTEN)

memcached 25444 root   27u  IPv6  82782      0t0  TCP *:memcache (LISTEN)

memcached 25444 root   28u  IPv4  82785      0t0  UDP *:memcache 

memcached 25444 root   29u  IPv6  82786      0t0  UDP *:memcache 


[root@cmwap local]# ps -ef|grep mem

root     25444     1  0 23:06 ?        00:00:00 memcached -p 11211 -u root -m 16m -c 10240 -d

root     25452 18160  0 23:06 pts/1    00:00:00 grep mem


#添加到开机自启动

echo "memcached -p 11211 -u root -m 16m -c 10240 -d">>/etc/rc.local


本文转自    蜗牛远途   51CTO博客,原文链接:http://blog.51cto.com/ywliyq/1766982
上一篇:inotify用法简介及结合rsync实现主机间的文件实时同步


下一篇:用户转化率的七大关键因素,突飞猛进不再是梦