Directory
1, the installation of memcached preparation work
2, installation, configuration Memcached
3, memcached Common Management command
4. memcached Test
1, the installation of memcached preparation work
1.1. System Environment
[Email protected]:~# cat/etc/issuedebian gnu/linux 8 \ \l[email protected]:~# UNAME-R3.16.0-4-AMD64
1.2, change the software source, install common software packages
[Email protected]:~# vim/etc/apt/sources.list #把此文件中原有的内容全部删除 and add the following: Deb Http://mirrors.163.com/debian/jessie Maindeb http://mirrors.163.com/debian/jessie-updates Maindeb Http://mirrors.163.com/debian/jessie-backports MAINDEB-SRC Http://mirrors.163.com/debian/jessie maindeb-src http://mirrors.163.com/debian/jessie-updates MAINDEB-SRC http://mirrors.163.com/debian/jessie-backports Maindeb http://mirrors.163.com/debian-security/jessie/ Updates MAINDEB-SRC http://mirrors.163.com/debian-security/jessie/updates Main
[Email protected]:~# apt-get Update #更改软件源后用此命令更新包列表
Install the following three software, which is not a necessary step, optional.
[Email protected]:~# apt-get install vim [email protected]:~# apt-get Install sudo[email protected]:~# apt-get install C Hkconfig
2, installation, configuration Memcached
[email protected]:~# apt-cache show memcached # View information for the memcached package in the source package: memcachedversion: 1.4.21-1.1 #这里是版本号Installed-size : 206maintainer: david martínez moreno <[email protected]>architecture: amd64Depends: libc6 (>= 2.17), libevent-2.0-5 (>= 2.0.10-stable), libsasl2-2, perl, init-system-helpers (>= 1.18~), lsb-base (>= 3.2-13), addusersuggests: libcache-memcached-perl, libmemcached, libanyevent-perl, libyaml-perl, libterm-readkey-perldescription-en: high-performance memory object Caching system danga interactive developed memcached to enhance the speed of livejournal.com, a site which was already doing 20 million+ dynamic page views per day for 1 million users with a bunch of Webservers and a bunch of database servers. memcached dropped the database load to almost nothing, yielding faster page load times for users, better resource utilization, and faster access to the databases on a memcache miss. . memcached optimizes Specific high-load serving applications that are designed to take advantage of its versatile no-locking memory access system. Clients are available in several different programming languages, to suit the needs of the specific application. traditionally this has been used&nbSp;in mod_perl apps to avoid storing large chunks of data in Apache memory, and to share this burden across several Machines. Description-md5: f7b1936bf072e208b59db960aca4de8ahomepage: http://www.memcached.org/tag: devel: :p rofiler, implemented-in::c, interface::d aemon, network::server, role::p rogram, secteam::squeeze-limited-support, secteam::wheezy-limited-supportsection: webpriority: optionalfilename: pool/main/m/memcached/memcached_1.4.21-1.1_amd64.debsize: 97362md5sum: db1f2159c2a7086d85b9839577490239sha1: a2139100c90351e25f232da7415caa0ff3dae052sha256: 8efbb75ed1c65343cc72d0e50058b25a671b386eaafe41e456ca4ad29c4630b8
[email protected]:~# apt-get install memcached #这里是安装memcached软件 [Email protected]:~# dpkg -L memcached #这里是查看memcached这个包安装后产生的了哪些文件, but did not show "/ etc/memcached.conf "This file, very strange/./lib/lib/systemd/lib/systemd/system/lib/systemd/system/memcached.service/usr/usr/ include/usr/include/memcached/usr/include/memcached/protocol_binary.h/usr/bin/usr/bin/memcached/usr/share/usr/ share/man/usr/share/man/man1/usr/share/man/man1/memcached.1.gz/usr/share/memcached/usr/share/memcached/ Memcached.conf.default/usr/share/memcached/scripts/usr/share/memcached/scripts/mc_slab_mover/usr/share/ memcached/scripts/readme.damemtop/usr/share/memcached/scripts/damemtop.yaml/usr/share/memcached/scripts/ damemtop/usr/share/memcached/scripts/memcached-tool/usr/share/memcached/scripts/systemd-memcached-wrapper/usr/ share/memcached/scripts/start-memcached/usr/share/doc/usr/share/doc/memcached/usr/share/doc/memcached/news.gz/ Usr/share/doc/memcached/protocol.txT.gz/usr/share/doc/memcached/changelog. Debian.gz/usr/share/doc/memcached/news. debian.gz/usr/share/doc/memcached/changelog.gz/usr/share/doc/memcached/copyright/usr/share/doc/memcached/ Readme. Debian/usr/share/doc/memcached/readme.md/etc/etc/init.d/etc/init.d/memcached/etc/default/etc/default/memcached
[Email protected]:~# vim/etc/memcached.conf Here you only need to modify two parameters, one is to specify the amount of memory that memcached can use, as follows:-M 1024x768 #默认是64M, Please modify the actual required size two is to modify the listening IP address, by default, memcached only listen on the 127.0.0.1 this local loopback address, as follows to modify the cost of the actual ip:-l on the NIC interface 172.31.11.96
3, memcached Common Management command
[email protected]:~# service memcached start #启动memcached [Email protected]:~# ss -tnl | grep 11211LISTEN 0 128 172.31.11.96:11211 *:* [email protected]:~# service memcached status #查看memcached的是否已启动 memcached.service - memcached daemon loaded: loaded (/lib/systemd/system/memcached.service; enabled) Active: active (running) since thu 2015-08-13 14:06:44 cst; 2min 47s ago Main PID: 17416 (memcached) cgroup: /system.slice/memcached.service └─17416 /usr/bin/memcached -m 1024 -p 11211 -u memcache -l 172.31.11.96[email protected]:~# service memcached stop #停止memcached [Email protected]:~# chkconfig --list | grep memcached #查看在哪些启动级别memcached是自启动memcached 0:off 1:off 2:on 3:on 4:on 5:on 6:off
4, memcached test
xshell:\> telnet 172.31.11.96 11211 #我这里直接用xshell工具进行测试Connecting to 172.31.11.96:11211...connection established. to escape to local shell, press ' ctrl+alt+] ' .stats #输入stats命令获取到memcached的状态信息STAT pid 17416stat uptime 1637stat time 1439447639stat version 1.4.21stat libevent 2.0.21-stablestat pointer_size 64stat rusage_user 0.036000stat rusage_system 0.052000stat curr_connections 5stat total_connections 7stat connection_ Structures 6stat reserved_fds 20stat cmd_get 0stat cmd_set 0stat cmd_ Flush 0stat cmd_touch 0stat get_hits 0stat get_missEs 0stat delete_misses 0stat delete_hits 0stat incr_misses 0stat incr_ Hits 0stat decr_misses 0stat decr_hits 0stat cas_misses 0stat cas_hits 0stat cas_badval 0stat touch_hits 0stat touch_misses 0stat auth_cmds 0STAT auth_errors 0STAT bytes_read 22STAT bytes_written 1103STAT limit_maxbytes 1073741824 #这里是内存大小 , Unit is byte stat accepting_conns 1stat listen_disabled_num 0stat threads 4stat Conn_yields 0stat hash_power_level 16stat hash_bytes 524288stat hash_is_ Expanding 0stat malloc_fails 0stat bytes 0stat curr_items 0stat total_ Items 0stat expired_unfetched 0stat evicted_unfetched 0stat evictions 0stat reclaimed 0staT crawler_reclaimed 0stat lrutail_reflocked 0end
This article is from the "focus on operations, and Linux Dances" blog, please be sure to keep this source http://zhaochj.blog.51cto.com/368705/1687985
Debian 8.1 (AMD64) Deployment memcached