• Linux下安装memecache缓存程序


    Memcache是一个高性能的分布式的内存对象缓存系统,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各种格式的数据.简单的说就是将数据调用到内存中,然后从内存中读取,从而大大提高读取速度。

    安装平台:centos4.7虚拟机

    环境:mysql+apache+PHP5

    所用到的安装包:

    Libevent(memcached用到了libevent这个库,在编译时用到)下载:https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
    memcache下载:http://www.danga.com/memcached/dist/

    Libevent安装:

    [root@localhost soft]# tar -zxf libevent-2.0.19-stable.tar.gz
    [root@localhost soft]]# cd libevent-2.0.19-stable
    [root@localhost libevent-2.0.19-stable]# ./configure --prefix=/usr
    [root@localhost libevent-2.0.19-stable]# make
    [root@localhost libevent-2.0.19-stable]# make install
    安装后使用ls -al /usr/lib |grep libevent查看一下是否存在libevent。

    memcache安装:

    [root@localhost soft]# tar -zxf memcached-1.4.15.tar.gz
    [root@localhost soft]]# cd memcached-1.4.15
    [root@localhost memcached-1.4.15]# ./configure --with-libevent=/usr/
    [root@localhost memcached-1.4.15]# make && make install

    验证memcached是否安装成功:

    [root@localhost memcached-1.4.15]# ls -al /usr/local/bin/mem*
    -rwxr-xr-x 1 root root 244827 11-05 21:45 /usr/local/bin/memcached
    [root@localhost memcached-1.4.15]# which memcached
    /usr/local/bin/memcached
    [root@localhost memcached-1.4.15]#

    启动memcache:

    [root@localhost bin]# memcached -d -u root    //开启memcache命令
    [root@localhost bin]# netstat -anp            //查看memcache的默认端口11211是否启动
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
    tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      8031/mysqld         
    tcp        0      0 0.0.0.0:11211               0.0.0.0:*                   LISTEN      20849/memcached 

    通过telnet连接memcache:

    [root@localhost bin]# telnet 127.0.0.1 11211
    Trying 127.0.0.1...
    Connected to localhost (127.0.0.1).
    Escape character is '^]'.
    stats
    STAT pid 20849
    STAT uptime 182
    STAT time 1352123775
    STAT version 1.4.15
    STAT libevent 2.0.19-stable
    STAT pointer_size 32
    STAT rusage_user 0.000000
    STAT rusage_system 0.005999
    STAT curr_connections 10
    STAT total_connections 11
    STAT connection_structures 11
    STAT reserved_fds 20
    STAT cmd_get 0
    STAT cmd_set 0
    STAT cmd_flush 0
    STAT cmd_touch 0
    STAT get_hits 0
    STAT get_misses 0
    STAT delete_misses 0
    STAT delete_hits 0
    STAT incr_misses 0
    STAT incr_hits 0
    STAT decr_misses 0
    STAT decr_hits 0
    STAT cas_misses 0
    STAT cas_hits 0
    STAT cas_badval 0
    STAT touch_hits 0
    STAT touch_misses 0
    STAT auth_cmds 0
    STAT auth_errors 0
    STAT bytes_read 7
    STAT bytes_written 0
    STAT limit_maxbytes 67108864
    STAT accepting_conns 1
    STAT listen_disabled_num 0
    STAT threads 4
    STAT conn_yields 0
    STAT hash_power_level 16
    STAT hash_bytes 262144
    STAT hash_is_expanding 0
    STAT bytes 0
    STAT curr_items 0
    STAT total_items 0
    STAT expired_unfetched 0
    STAT evicted_unfetched 0
    STAT evictions 0
    STAT reclaimed 0
    END
  • 相关阅读:
    Cocos游戏引擎,让小保安成就大梦想
    Android 高仿QQ5.2双向側滑菜单DrawerLayout实现源代码
    Java中字符串相等与大小比較
    Android四大基本组件之 Activity
    C++基础学习教程(五)
    HAWQ技术解析(八) —— 大表分区
    Jenkins 安装与使用--实例
    Android多点触控技术,实现对图片的放大缩小平移,惯性滑动等功能
    Mycat(4):消息表mysql数据库分表实践
    谋哥:《App自推广》开篇之回到远古人类
  • 原文地址:https://www.cnblogs.com/zhuque/p/2763345.html
Copyright © 2020-2023  润新知