• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

linux centos5.8 安装memcached

mysql 搞代码 4年前 (2022-01-09) 11次浏览 已收录 0个评论

1.安装libevent yum install libevent.x86_64 libevent-devel.x86_64 没有libevent编译memcached为出错 checking for libevent directory… configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/ If it’s

1.安装libevent
yum install libevent.x86_64 libevent-devel.x86_64
没有libevent编译memcached为出错

checking for libevent directory... configure: error: libevent is required.  You can get it from http://www.monkey.org/~provos/libevent/      If it's already installed, specify its pa<span style="color:transparent">本文来源gaodai#ma#com搞*!代#%^码$网!</span>th using --with-libevent=/dir/

2.安装memcached

wget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gztar zxvf memcached-1.4.15.tar.gzcd memcached-1.4.15./configure --prefix=/opt/memcached-1.4.15makemake installln -s /opt/memcached-1.4.15 /opt/memcached

3.配置文件
vi /opt/memcached/my.conf

PORT="11200"IP="192.168.0.40"USER="root"MAXCONN="1524"CACHESIZE="3000"OPTIONS=""#memcached

4.启动/关闭脚本
vi /etc/init.d/memcached

#!/bin/bash## Save me to /etc/init.d/memcached# And add me to system start# chmod +x memcached# chkconfig --add memcached# chkconfig --level 35 memcached on## Written by lei## chkconfig: - 80 12# description: Distributed memory caching daemon## processname: memcached# config: /usr/local/memcached/my.confsource /etc/rc.d/init.d/functions### Default variablesPORT="11211"IP="192.168.0.40"USER="root"MAXCONN="1524"CACHESIZE="64"OPTIONS=""SYSCONFIG="/opt/memcached/my.conf"### Read configuration[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"RETVAL=0prog="/opt/memcached/bin/memcached"desc="Distributed memory caching"start() {    echo -n $"Starting $desc ($prog): "    daemon $prog -d -p $PORT -l $IP -u $USER -c $MAXCONN -m $CACHESIZE $OPTIONS    RETVAL=$?    echo    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached    return $RETVAL}stop() {    echo -n $"Shutting down $desc ($prog): "    killproc $prog    RETVAL=$?    echo    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/memcached    return $RETVAL}restart() {    stop    start}reload() {    echo -n $"Reloading $desc ($prog): "    killproc $prog -HUP    RETVAL=$?    echo    return $RETVAL}case "$1" in  start)    start    ;;  stop)    stop    ;;  restart)    restart    ;;  condrestart)    [ -e /var/lock/subsys/$prog ] && restart    RETVAL=$?    ;;  reload)    reload    ;;  status)    status $prog    RETVAL=$?    ;;   *)    echo $"Usage: $0 {start|stop|restart|condrestart|status}"    RETVAL=1esacexit $RETVAL

5.添加iptables 充许192.168.0.0/24访问

iptables -A INPUT -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 11200 -j ACCEPT

6.启动
/etc/init.d/memcached start

7.web 管理界面

http://www.junopen.com/memadmin/


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:linux centos5.8 安装memcached

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址