Centos6 使用yum安裝memcached

yum 搜索 memcached相關安裝包

[root@centos6 ~]# yum search memcached
=========================================== N/S Matched: memcached ===========================================
libmemcached.i686 : Client library and command line tools for memcached server
libmemcached.x86_64 : Client library and command line tools for memcached server
libmemcached-devel.i686 : Header files and development libraries for libmemcached
libmemcached-devel.x86_64 : Header files and development libraries for libmemcached
libmemcached-last-libs.x86_64 : libmemcached libraries
libmemcached-opt-libs.x86_64 : libmemcached libraries
memcached-devel.i686 : Files needed for development using memcached protocol
memcached-devel.x86_64 : Files needed for development using memcached protocol
perl-Cache-Memcached.noarch : Perl client for memcached
memcached.x86_64 : High Performance, Distributed Memory Object Cache
複製代碼

使用yum安裝memcached

[root@centos6 ~]# yum install -y memcached
Installed:
  memcached.x86_64 0:1.4.4-5.el6                                                                              

Dependency Installed:
  libevent.x86_64 0:1.4.13-4.el6                                                                              

Complete!
[root@centos6 ~]# 
複製代碼

啓動memcached服務

# 查看memcached的當前狀態
[root@centos6 ~]# service memcached status
memcached is stopped
[root@centos6 ~]# 
# 啓動memcached的服務
[root@centos6 ~]# service memcached start
Starting memcached:                                        [  OK  ]
[root@centos6 ~]# 
[root@centos6 ~]# service memcached status
memcached (pid  2782) is running...
[root@centos6 ~]# 
# 查看memcached相關啓動參數
[root@centos6 ~]# ps -ef | grep memcached
495        2782      1  0 15:32 ?        00:00:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/memcached.pid
root       2803   2620  0 15:33 pts/0    00:00:00 grep memcached
[root@centos6 ~]# 
複製代碼

查看memcached版本

[root@centos6 sysconfig]# memcached -h
memcached 1.4.4
...
[root@centos6 sysconfig]# 
複製代碼

配置加入linux服務

[root@centos6 ~]# chkconfig --level 2345 memcached on
複製代碼

配置memcached啓動參數

[root@centos6 ~]# vim /etc/sysconfig/memcached 

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
複製代碼
  • PORT,服務啓動端口。
  • USER,服務啓動用戶。
  • MAXCONN,服務配置支持最大鏈接數。
  • CACHESIZE,服務支持的最大內存,以M爲單位。

配置修改了以後,重啓memcached服務便可生效。linux

使用memcached-tool檢測memcached服務

[root@centos6 ~]# 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        2782
            pointer_size          64
           rusage_system    0.033994
             rusage_user    0.000000
                 threads           4
                    time  1557215298
       total_connections          11
             total_items           0
                  uptime         924
                 version       1.4.4
[root@centos6 ~]# 
複製代碼

相關文章
相關標籤/搜索