Yum 安装memcached 与缓存清空

1、安装

root@pts/0 # yum -y install memcached

2、启动服务

        root@pts/0 # /etc/init.d/memcached start

3、配置文件

        root@pts/0 # vim /etc/sysconfig/memcached

         《Yum 安装memcached 与缓存清空》

        安装目录:

/usr/share/doc/memcached-1.4.4

4、清空memcache缓存方法

方法一:

    挨个重启每台的memcache服务

     /etc/init.d/memcached restart

   192.168.1.5 192.168.1.6 192.168.1.7 192.168.1.8 192.168.1.111 192.168.1.112 192.168.1.1.113 192.168.1.114

  方法二:

   telnet localhost 22422

   flush_all

   quit

   或者

   echo “flush_all” | nc localhost 22422

    提示”OK”

    《Yum 安装memcached 与缓存清空》

 查看当前的memcache连接数:

 

[root@mem1 ~]# netstat -n | grep :11211 | wc -l

15752    

 

查看默认允许的连接数:

[root@mem1 ~]# cat /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don’t

# want to do the full Sys V style init stuff.

 

touch /var/lock/subsys/local

/usr/local/bin/memcached -d -m 15360 -u root -l 172.20.1.54 -p 11211 -c 40960

/usr/local/bin/memcached -d -m 512 -u root -l 172.20.1.54 -p 11212 -c 10000

 

这里设置的11211端口默认连接数是40960

 

Memcache也有自己的查看工具:

如何查看memcache服务器端版本: ./memcached -h

memcache的运行状态可以方便的用 stats 命令显示。

首先用telnet 127.0.0.1 11211这样的命令连接上memcache,然后直接输入stats就可以得到当前memcache的状态。

这些状态的说明如下:

pid

memcache服务器的进程ID

uptime

服务器已经运行的秒数

time

服务器当前的unix时间戳

version

memcache版本

pointer_size

当前操作系统的指针大小(32位系统一般是32bit

rusage_user

进程的累计用户时间

rusage_system

进程的累计系统时间

curr_items

服务器当前存储的items数量

total_items

从服务器启动以后存储的items总数量

bytes

当前服务器存储items占用的字节数

curr_connections

当前打开着的连接数

total_connections

从服务器启动以后曾经打开过的连接数

connection_structures

服务器分配的连接构造数

cmd_get

get命令(获取)总请求次数

cmd_set

set命令(保存)总请求次数

get_hits

总命中次数

get_misses

总未命中次数

evictions

为获取空闲内存而删除的items数(分配给memcache的空间用满后需要删除旧的items来得到空间分配给新的items

bytes_read

总读取字节数(请求字节数)

bytes_written

总发送字节数(结果字节数)

limit_maxbytes

分配给memcache的内存大小(字节)

threads

当前线程数

    原文作者:memcached
    原文地址: https://www.cnblogs.com/chaichuan/p/4204576.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞