memcached

一、安装

//安装
[root@memcached ~]# yum install -y epel-release
[root@memcached ~]# yum install -y libevent mencached libmemcached
[root@memcached ~]# /etc/init.d/memcached start
[root@memcached ~]# ps aux|grep memcached
495       2641  0.2  0.0  56280   900 ?        Ssl  01:06   0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid
root      2649  0.0  0.0   5980   740 pts/0    S+   01:06   0:00 grep memcached

 

二、基本选项

-d    启动一个守护进程  { 一般后面不加内容}

-m   分配memcache使用的内存数量,单位:M

-u    运行memcache的用户   {如果当前为root,则需要指定用户}

-l     监听的服务器ip地址

-p    监听memcache的端口     {默认为11211}

-c     最大运行的并发连接数       {默认是1024}

-P     保存memcache的pid文件

 

三、查看memcached的运行状态

[root@memcached ~]# memcached-tool 127.0.0.1:11211 stats
#127.0.0.1:11211   Field       Value
         accepting_conns           1
               auth_cmds           0
             auth_errors           0
                   bytes           0
              bytes_read           7
           bytes_written           0
              cas_badval           0
                cas_hits           0
              cas_misses           0
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
             conn_yields           0
   connection_structures          11
        curr_connections          10
              curr_items           0
               decr_hits           0
             decr_misses           0
             delete_hits           0
           delete_misses           0
               evictions           0
                get_hits           0
              get_misses           0
               incr_hits           0
             incr_misses           0
          limit_maxbytes    67108864
     listen_disabled_num           0
                     pid        2641
            pointer_size          32
           rusage_system    0.062990
             rusage_user    0.024996
                 threads           4
                    time  1461086392
       total_connections          11
             total_items           0
                  uptime         791
                 version       1.4.4


//常查看的参数是:

-->   get_hits  有多少数据是直接从缓存中取得  
        cmd_get
        cmd_set

OR

[root@memcached ~]# memstat --servers=127.0.0.1:11211
Listing 1 Server

Server: 127.0.0.1 (11211)
         pid: 2641
         uptime: 1473
         time: 1461087074
         version: 1.4.4
         pointer_size: 32
         rusage_user: 0.50992
         rusage_system: 0.122981
         curr_items: 0
         total_items: 0
         bytes: 0
         curr_connections: 10
         total_connections: 12
         connection_structures: 11
         cmd_get: 0
         cmd_set: 0
         get_hits: 0
         get_misses: 0
         evictions: 0
         bytes_read: 0
         bytes_written: 0
         limit_maxbytes: 67108864
         threads: 4

 

posted @ 2016-04-19 17:32  Frankiee  阅读(285)  评论(0编辑  收藏  举报