- 浏览: 984266 次
文章分类
- 全部博客 (428)
- Hadoop (2)
- HBase (1)
- ELK (1)
- ActiveMQ (13)
- Kafka (5)
- Redis (14)
- Dubbo (1)
- Memcached (5)
- Netty (56)
- Mina (34)
- NIO (51)
- JUC (53)
- Spring (13)
- Mybatis (17)
- MySQL (21)
- JDBC (12)
- C3P0 (5)
- Tomcat (13)
- SLF4J-log4j (9)
- P6Spy (4)
- Quartz (12)
- Zabbix (7)
- JAVA (9)
- Linux (15)
- HTML (9)
- Lucene (0)
- JS (2)
- WebService (1)
- Maven (4)
- Oracle&MSSQL (14)
- iText (11)
- Development Tools (8)
- UTILS (4)
- LIFE (8)
最新评论
-
Donald_Draper:
Donald_Draper 写道刘落落cici 写道能给我发一 ...
DatagramChannelImpl 解析三(多播) -
Donald_Draper:
刘落落cici 写道能给我发一份这个类的源码吗Datagram ...
DatagramChannelImpl 解析三(多播) -
lyfyouyun:
请问楼主,执行消息发送的时候,报错:Transport sch ...
ActiveMQ连接工厂、连接详解 -
ezlhq:
关于 PollArrayWrapper 状态含义猜测:参考 S ...
WindowsSelectorImpl解析一(FdMap,PollArrayWrapper) -
flyfeifei66:
打算使用xmemcache作为memcache的客户端,由于x ...
Memcached分布式客户端(Xmemcached)
Memcache知识点梳理 :http://369369.blog.51cto.com/319630/833234/
Memcached 教程 :http://www.runoob.com/memcached/memcached-tutorial.html
MemCache超详细解读:http://www.csdn.net/article/2016-03-16/2826609
安装libevent
先到官网http://libevent.org/下载最新版本压缩包并解压
配置目录:
编译:
安装
检查是否安装成功:
安装memcached
获取memcached源码:
解压
配置安装目录:
...
编译:
测试:
安装:
查看启动参数配置
启动memcached
连接memcached
具体Stats状态输出的解读可以查看这篇文章:
MemCache超详细解读:http://www.csdn.net/article/2016-03-16/2826609
这里显示了很多状态信息,下边详细解释每个状态项:
pid: memcache服务器进程ID
uptime:服务器已运行秒数
time:服务器当前Unix时间戳
version:memcache版本
pointer_size:操作系统指针大小
rusage_user:进程累计用户时间
rusage_system:进程累计系统时间
curr_connections:当前连接数量
total_connections:Memcached运行以来连接总数
connection_structures:Memcached分配的连接结构数量
cmd_get:get命令请求次数
cmd_set:set命令请求次数
cmd_flush:flush命令请求次数
get_hits:get命令命中次数
get_misses:get命令未命中次数
delete_misses:delete命令未命中次数
delete_hits:delete命令命中次数
incr_misses:incr命令未命中次数
incr_hits:incr命令命中次数
decr_misses:decr命令未命中次数
decr_hits:decr命令命中次数
cas_misses:cas命令未命中次数
cas_hits:cas命令命中次数
cas_badval:使用擦拭次数
auth_cmds:认证命令处理的次数
auth_errors:认证失败数目
bytes_read:读取总字节数
bytes_written:发送总字节数
limit_maxbytes:分配的内存总大小(字节)
accepting_conns:服务器是否达到过最大连接(0/1)
listen_disabled_num:失效的监听数
threads:当前线程数
conn_yields:连接操作主动放弃数目
bytes:当前存储占用的字节数
curr_items:当前存储的数据总数
total_items:启动以来存储的数据总数
evictions:LRU释放的对象数目
reclaimed:已过期的数据条目来存储新数据的数目
Memcached 教程 :http://www.runoob.com/memcached/memcached-tutorial.html
MemCache超详细解读:http://www.csdn.net/article/2016-03-16/2826609
安装libevent
先到官网http://libevent.org/下载最新版本压缩包并解压
[memcached@donald Documents]$ ls libevent-2.1.8-stable.tar.gz memcached-1.5.2 memcached-1.5.2.tar.gz [memcached@donald Documents]$ tar -zxvf libevent-2.1.8-stable.tar.gz
配置目录:
[memcached@donald libevent-2.1.8-stable]$./configure --prefix=/usr
编译:
[memcached@donald libevent-2.1.8-stable]$ make GEN test/rpcgen-attempted GEN include/event2/event-config.h make all-am make[1]: Entering directory `/home/memcached/Documents/libevent-2.1.8-stable' ...
安装
[memcached@donald libevent-2.1.8-stable]$ sudo make install
检查是否安装成功:
[memcached@donald libevent-2.1.8-stable]$ ls -al /usr/lib | grep libevent lrwxrwxrwx 1 root root 21 Oct 9 12:58 libevent-2.1.so.6 -> libevent-2.1.so.6.0.2 -rwxr-xr-x 1 root root 1325594 Oct 9 12:58 libevent-2.1.so.6.0.2 -rw-r--r-- 1 root root 2461544 Oct 9 12:58 libevent.a lrwxrwxrwx 1 root root 26 Oct 9 12:58 libevent_core-2.1.so.6 -> libevent_core-2.1.so.6.0.2 ... [memcached@donald libevent-2.1.8-stable]$
安装memcached
获取memcached源码:
memcached@donald memcached-1.5.2]$wget http://memcached.org/latest
解压
memcached@donald memcached-1.5.2]$tar -zxvf memcached-1.x.x.tar.gz [memcached@donald Documents]$ cd memcached-1.5.2/
配置安装目录:
[memcached@donald memcached-1.5.2]$ sudo ./configure --prefix=/usr/local --with-libevent=/usr checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c
...
编译:
[memcached@donald memcached-1.5.2]$ sudo make make all-recursive make[1]: Entering directory `/home/memcached/Documents/memcached-1.5.2' Making all in doc make[2]: Entering directory `/home/memcached/Documents/memcached-1.5.2/doc' make all-am make[3]: Entering directory `/home/memcached/Documents/memcached-1.5.2/doc' ...
测试:
[memcached@donald memcached-1.5.2]$ sudo make test
安装:
[memcached@donald memcached-1.5.2]$ [memcached@donald memcached-1.5.2]$ sudo make install make install-recursive make[1]: Entering directory `/home/memcached/Documents/memcached-1.5.2' Making install in doc make[2]: Entering directory `/home/memcached/Documents/memcached-1.5.2/doc' make install-am make[3]: Entering directory `/home/memcached/Documents/memcached-1.5.2/doc' make[4]: Entering directory `/home/memcached/Documents/memcached-1.5.2/doc' make[4]: Nothing to be done for `install-exec-am'. /bin/mkdir -p '/usr/local/share/man/man1' /bin/install -c -m 644 memcached.1 '/usr/local/share/man/man1' make[4]: Leaving directory `/home/memcached/Documents/memcached-1.5.2/doc' make[3]: Leaving directory `/home/memcached/Documents/memcached-1.5.2/doc' make[2]: Leaving directory `/home/memcached/Documents/memcached-1.5.2/doc' make[2]: Entering directory `/home/memcached/Documents/memcached-1.5.2' make[3]: Entering directory `/home/memcached/Documents/memcached-1.5.2' /bin/mkdir -p '/usr/local/bin' /bin/install -c memcached '/usr/local/bin' /bin/mkdir -p '/usr/local/include/memcached' /bin/install -c -m 644 protocol_binary.h '/usr/local/include/memcached' make[3]: Leaving directory `/home/memcached/Documents/memcached-1.5.2' make[2]: Leaving directory `/home/memcached/Documents/memcached-1.5.2' make[1]: Leaving directory `/home/memcached/Documents/memcached-1.5.2' [memcached@donald memcached-1.5.2]$
查看启动参数配置
[memcached@donald Documents]$ memcached -h memcached 1.5.2 -p, --port=<num> TCP port to listen on (default: 11211) TCP 监听端口 -U, --udp-port=<num> UDP port to listen on (default: 11211, 0 is off) UDP 监听端口 -s, --unix-socket=<file> UNIX socket to listen on (disables network support) -A, --enable-shutdown enable ascii "shutdown" command -a, --unix-mask=<mask> access mask for UNIX socket, in octal (default: 0700) -l, --listen=<addr> interface to listen on (default: INADDR_ANY) 监听地址 -d, --daemon run as a daemon 以守候模式运行 -r, --enable-coredumps maximize core file limit 最大核心文件限制 -u, --user=<user> assume identity of <username> (only when run as root) 运行用户 -m, --memory-limit=<num> item memory in megabytes (default: 64 MB) 内存大小 -M, --disable-evictions return error on memory exhausted instead of evicting 内存耗尽时返回错误,而不是删除,即不用LRU算法 -c, --conn-limit=<num> max simultaneous connections (default: 1024) 最大连接数 -k, --lock-memory lock down all paged memory -v, --verbose verbose (print errors/warnings while in event loop) -vv very verbose (also print client commands/responses) -vvv extremely verbose (internal state transitions) -h, --help print this help and exit -i, --license print memcached and libevent license -V, --version print version and exit -P, --pidfile=<file> save PID in <file>, only used with -d option 进程的pid存放地点,此处“p”为大写“P” -f, --slab-growth-factor=<num> chunk size growth factor (default: 1.25) 块大小增长因子,默认是1.25 -n, --slab-min-size=<bytes> min space used for key+value+flags (default: 48) 块最小size -L, --enable-largepages try to use large memory pages (if available) -D <char> Use <char> as the delimiter between key prefixes and IDs. This is used for per-prefix stats reporting. The default is ":" (colon). If this option is specified, stats collection is turned on automatically; if not, then it may be turned on by sending the "stats detail on" command to the server. -t, --threads=<num> number of threads to use (default: 4) 线程数 -R, --max-reqs-per-event maximum number of requests per event, limits the requests processed per connection to prevent starvation (default: 20) -C, --disable-cas disable use of CAS -b, --listen-backlog=<num> set the backlog queue limit (default: 1024) -B, --protocol=<name> protocol - one of ascii, binary, or auto (default) -I, --max-item-size=<num> adjusts max item size (default: 1mb, min: 1k, max: 128m) -F, --disable-flush-all disable flush_all command -X, --disable-dumping disable stats cachedump and lru_crawler metadump -o, --extended comma separated list of extended options most options have a 'no_' prefix to disable - maxconns_fast: immediately close new connections after limit - hashpower: an integer multiplier for how large the hash table should be. normally grows at runtime. set based on "STAT hash_power_level" - tail_repair_time: time in seconds for how long to wait before forcefully killing LRU tail item. disabled by default; very dangerous option. - hash_algorithm: the hash table algorithm default is murmur3 hash. options: jenkins, murmur3 - lru_crawler: enable LRU Crawler background thread - lru_crawler_sleep: microseconds to sleep between items default is 100. - lru_crawler_tocrawl: max items to crawl per slab per run default is 0 (unlimited) - lru_maintainer: enable new LRU system + background thread - hot_lru_pct: pct of slab memory to reserve for hot lru. (requires lru_maintainer) - warm_lru_pct: pct of slab memory to reserve for warm lru. (requires lru_maintainer) - hot_max_factor: items idle > cold lru age * drop from hot lru. - warm_max_factor: items idle > cold lru age * this drop from warm. - temporary_ttl: TTL's below get separate LRU, can't be evicted. (requires lru_maintainer) - idle_timeout: timeout for idle connections - slab_chunk_max: (EXPERIMENTAL) maximum slab size. use extreme care. - watcher_logbuf_size: size in kilobytes of per-watcher write buffer. - worker_logbuf_size: size in kilobytes of per-worker-thread buffer read by background thread, then written to watchers. - track_sizes: enable dynamic reports for 'stats sizes' command. - no_inline_ascii_resp: save up to 24 bytes per item. small perf hit in ASCII, no perf difference in binary protocol. speeds up all sets. - modern: enables options which will be default in future. currently: nothing - no_modern: uses defaults of previous major version (1.4.x) [memcached@donald Documents]$
启动memcached
[memcached@donald Documents]$ memcached -p 11211 -d -u memcached -l 192.168.126.128 -c 1024 [memcached@donald Documents]$ netstat -ntlp (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.126.128:11211 0.0.0.0:* LISTEN 29555/memcached tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN - tcp6 0 0 :::3306 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - tcp6 0 0 ::1:631 :::* LISTEN - [memcached@donald Documents]$
连接memcached
[memcached@donald Documents]$ telnet 192.168.126.128 11211 Trying 192.168.126.128... Connected to 192.168.126.128. Escape character is '^]'. stats 查看状态 STAT pid 29555 STAT uptime 382 STAT time 1507538855 STAT version 1.5.2 STAT libevent 2.1.8-stable STAT pointer_size 64 STAT rusage_user 0.146294 STAT rusage_system 0.089402 STAT max_connections 1024 STAT curr_connections 5 STAT total_connections 6 STAT rejected_connections 0 STAT connection_structures 6 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 get_expired 0 STAT get_flushed 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 time_in_listen_disabled_us 0 STAT threads 4 STAT conn_yields 0 STAT hash_power_level 16 STAT hash_bytes 524288 STAT hash_is_expanding 0 STAT slab_reassign_rescues 0 STAT slab_reassign_chunk_rescues 0 STAT slab_reassign_evictions_nomem 0 STAT slab_reassign_inline_reclaim 0 STAT slab_reassign_busy_items 0 STAT slab_reassign_busy_deletes 0 STAT slab_reassign_running 0 STAT slabs_moved 0 STAT lru_crawler_running 0 STAT lru_crawler_starts 765 STAT lru_maintainer_juggles 430 STAT malloc_fails 0 STAT log_worker_dropped 0 STAT log_worker_written 0 STAT log_watcher_skipped 0 STAT log_watcher_sent 0 STAT bytes 0 STAT curr_items 0 STAT total_items 0 STAT slab_global_page_pool 0 STAT expired_unfetched 0 STAT evicted_unfetched 0 STAT evicted_active 0 STAT evictions 0 STAT reclaimed 0 STAT crawler_reclaimed 0 STAT crawler_items_checked 0 STAT lrutail_reflocked 0 STAT moves_to_cold 0 STAT moves_to_warm 0 STAT moves_within_lru 0 STAT direct_reclaims 0
具体Stats状态输出的解读可以查看这篇文章:
MemCache超详细解读:http://www.csdn.net/article/2016-03-16/2826609
这里显示了很多状态信息,下边详细解释每个状态项:
pid: memcache服务器进程ID
uptime:服务器已运行秒数
time:服务器当前Unix时间戳
version:memcache版本
pointer_size:操作系统指针大小
rusage_user:进程累计用户时间
rusage_system:进程累计系统时间
curr_connections:当前连接数量
total_connections:Memcached运行以来连接总数
connection_structures:Memcached分配的连接结构数量
cmd_get:get命令请求次数
cmd_set:set命令请求次数
cmd_flush:flush命令请求次数
get_hits:get命令命中次数
get_misses:get命令未命中次数
delete_misses:delete命令未命中次数
delete_hits:delete命令命中次数
incr_misses:incr命令未命中次数
incr_hits:incr命令命中次数
decr_misses:decr命令未命中次数
decr_hits:decr命令命中次数
cas_misses:cas命令未命中次数
cas_hits:cas命令命中次数
cas_badval:使用擦拭次数
auth_cmds:认证命令处理的次数
auth_errors:认证失败数目
bytes_read:读取总字节数
bytes_written:发送总字节数
limit_maxbytes:分配的内存总大小(字节)
accepting_conns:服务器是否达到过最大连接(0/1)
listen_disabled_num:失效的监听数
threads:当前线程数
conn_yields:连接操作主动放弃数目
bytes:当前存储占用的字节数
curr_items:当前存储的数据总数
total_items:启动以来存储的数据总数
evictions:LRU释放的对象数目
reclaimed:已过期的数据条目来存储新数据的数目
相关推荐
Memcached安装配置及使用文档,来源于网络,仅供参考
5. **查看Memcached配置文件** ```bash cat /etc/sysconfig/memcached ``` 在配置文件中可以看到几个重要的配置项: - `PORT`: Memcached监听的端口,默认为11211。 - `USER`: 用于运行Memcached服务的用户,...
自己亲身安装memcached的详细过程,操作系统是CentOS6.2 64位,生产环境。 希望可以帮助到大家。
memcached 共享内存解决方案,memcached安装,使用
### MemCached在Windows环境下的安装与配置详解 #### 一、概述 MemCached是一种高性能、分布式内存对象缓存系统,可以极大地加速动态Web应用程序的速度,提高可扩展性。本文档将详细介绍如何在Windows 7 64位操作...
本文将详细介绍如何在Windows环境下安装和配置Memcached,并探讨其基本操作和状态查询。 首先,安装Memcached的步骤如下: 1. 访问 http://code.jellycan.com/memcached/ 下载适用于Windows的最新版本(例如1.2.6...
在本文中,我们将详细介绍如何安装和配置Memcached,以及如何查询其运行状态。 1. **安装Memcached** - 首先,你需要从官方源或指定网址下载适合你操作系统的Memcached版本。例如,Windows用户可以访问...
本篇文章将详细讲解如何安装和配置memcached,以及与之相关的libevent和magent。 首先,我们需要了解libevent库。libevent是一个事件通知库,它允许程序处理多个网络连接,并有效地处理来自不同源的事件。在安装...
### Memcached在Windows环境下的安装与配置详解 #### 一、Memcached的安装与基本配置 Memcached是一款高性能、分布式内存对象缓存系统,用于在动态应用中减少数据库负载,加速页面渲染,通过缓存数据库查询结果和...
Memcached 安装和配置 Memcached 是一个自由的开源高速缓存系统,用于加速动态 web 应用程序的性能。它通过减少数据库负载和增加应用程序的响应速度来提高网站的性能。以下是 Memcached 的安装和配置详解。 安装 ...
本文将详细介绍如何在Linux系统上安装和配置Memcached。 **1. 更新系统** 在安装任何新软件之前,我们需要确保系统是最新的。打开终端并运行以下命令来更新你的Linux发行版: ```bash sudo apt-get update sudo ...
CentOS 安装配置 Memcached 在本文中,我们将详细介绍如何在 CentOS 系统上安装和配置 Memcached。Memcached 是一个高性能的分布式内存对象缓存系统,广泛应用于各种 web 应用程序中,以提高应用程序的性能和响应...
本文将详细介绍如何在 Ubuntu 操作系统下使用源代码安装并配置 Apache、Tomcat 和 Memcached,实现集群中的 Session 共享与负载均衡。由于采用的是源码安装方式,可能会遇到一些细节上的差异,但总体思路与步骤应...
在本文中,我们将详细探讨如何在Linux环境下安装和配置Memcached。 首先,让我们了解一下Memcached的基本概念。Memcached基于一个简单的理念:将数据存储在内存中,以便快速访问。由于内存的读取速度远超硬盘,因此...
Memcached 缓存安装配置 Memcached 是一个自由开源的高速缓存系统,可以用来加速动态Web应用程序中的数据访问速度。本文将指导您如何安装和配置 Memcached,并介绍 Memcached 的基本概念和参数。 一、安装 ...
【memcached 安装教程】 Memcached 是一款高性能、分布式内存对象缓存系统,用于缓解数据库负载,提高网站性能。本文将详细介绍如何在 CentOS 上安装 memcached,以及解决可能遇到的问题。 **一、安装 libevent 库...
本篇文章将针对“memcached安装错误”这一主题,详细解析可能出现的问题及解决方案。 首先,msvcr71.dll是一个微软Visual C++运行库文件,对于某些基于VC++编译的程序(包括memcached)来说是必不可少的。如果你在...
9. **配置Memcached**:根据实际需求,可以通过修改`/etc/memcached.conf`文件来配置Memcached的内存大小、监听端口、日志文件等。重启服务使配置生效: ``` sudo killall memcached memcached -d -p 11211 -m ...
在这个教程中,我们将详细介绍如何在Linux系统上安装和配置Memcached,以及如何安装libevent、libmemcached和PHP的Memcache扩展。 一、安装前准备 在开始安装之前,确保你的Linux系统已经更新到最新版本,并安装了...