Install, configure, and monitor Memcached
Memcached is a distributed object Cache System Based on key => value. Although redis is relatively powerful, Memcached still has advantages in some scenarios, such as database cache.
The following installation is completed on CentOS 5/6 64-bit Operating System
Directory:
- Libevent Installation
- Install and configure Memcached
- Zabbix monitoring Memcached
- Manage Memcached on the Web
1. Libevent Installation
Wget
Tar zxf release-1.4.15-stable.tar.gz
Cd libevent-release-1.4.15-stable/
Generally, you can run./configure directly, and the document in it also says this.
[Root @ Nginx libevent-release-1.4.15-stable] #./configure
-Bash:./configure: No such file or directory
You will find an error. In fact, the configure file has not yet been generated, and you need to execute./autogen. sh in the following directory
[Root @ Nginx libevent-release-1.4.15-stable] #./autogen. sh
./Autogen. sh: line 11: aclocal: command not found
The error message "aclocal" is not found because autoconf automake libtool is not installed.
Yum-y install autoconf automake libtool
./Autogen. sh
./Configure -- prefix =/usr/local/libevent1.4.15
Make & make install
Note: When installing libevent, You need to generate the configure file, which may take a lot of detours.
2. Install Memcached
Wget
Tar zxf memcached-1.4.25.tar.gz
Cd memcached-1.4.25
./Configure -- prefix =/usr/local/memcached1.4.25 -- with-libevent =/usr/local/libevent1.4.15
# Note: the installation address of libevent must be specified here.
Make & make install
Memcached command line monitoring tool:
Upload the memcached-tool in the attachment to the/usr/local/memcached1.4.25/bin directory.
Upload the memcached file in the attachment to the/etc/init. d/directory.
1234 chmod + x/etc/init. d/memcached
Chmod + x/usr/local/memcached1.4.25/bin/memcached-tool
Mkdir-p/var/run/memcached
Ln-s/usr/local/memcached1.4.25/bin/*/usr/bin/
To customize the memcached startup parameters, you can directly modify the/etc/init. d/memcached file.
PORT = 11211
USER = nobody
MAXCONN = 10240
CACHESIZE = 3096
OPTIONS = ""
View Memcache status
[Root @ Nginx ~] # Memcached-tool 127.0.0.1: 11211 stats
# Wagner. 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
Pai_flush 0
Performance_get 0
Performance_set 0
Pai_touch 0
Conn_yields 0
Connection_structures 11
Crawler_items_checked 0
Crawler_reclaimed 0
Curr_connections 10
Curr_items 0
Decr_hits 0
Decr_misses 0
Delete_hits 0
Delete_misses 0
Evicted_unfetched 0
Evictions 0
Expired_unfetched 0
Get_hits 0
Get_misses 0
Hash_bytes 524288
Hash_is_expanding 0
Hash_power_level 16
Incr_hits 0
Incr_misses 0
Libevent 1.4.15
Limit_maxbytes 3246391296
Listen_disabled_num 0
Lrutail_reflocked 0
Malloc_fails 0
Pid 13376
Pointer_size 64
Reclaimed 0
Reserved_fds 20
Rusage_system 0.000999
Rusage_user 0.000000
Threads 4
Time 1452663956
Time_in_listen_disabled_us 0
Total_connections 11
Total_items 0
Touch_hits 0
Touch_misses 0
Uptime 13
Version 1.4.25
The above are the status items of memcached.
3. Zabbix monitoring script:
Add
UserParameter = memcached. stats [*],/usr/bin/memcached-tool 127.0.0.1: 11211 stats | awk '/$1/{print $2}' | head-1
Restart the zabbix_agentd service.
Then import the zabbix memcached Template
4. Manage memcached using memadmin monitoring
This must be run in a php environment with the memcache Module
In general, the installation of memcached is relatively simple, and it also has a simple Status interface, so that we can monitor it easily.
The memcached monitoring tool and startup script memadmin memcached-tool and memcached Startup File and monitoring tool are used in this article. Download The memcached template:
------------------------------------------ Split line ------------------------------------------
Free in http://linux.bkjia.com/
The username and password are both www.bkjia.com
The specific download directory is in/July 6, 2016,/July 22, January,/Memcached installation, configuration, and monitoring/
For the download method, see
------------------------------------------ Split line ------------------------------------------
Install and configure Memcached source code in CentOS 6.6
Memcached installation and startup script
Performance problems of using Memcached in PHP
Install Memcached in Ubuntu and its command explanation
Install and apply Memcached
Use Nginx + Memcached's small image storage solution
Getting started with Memcached
For details about Memcached, click here
Memcached: click here
This article permanently updates the link address: