|
Table of Contents
1, the installation preparation for memcached
2, install, configure Memcached
3, Memcached common management commands
4, Memcached test
1, the installation preparation for memcached
1.1, the system environment
root @ com: ~ # cat / etc / issue
Debian GNU / Linux 8 n l
root @ com: ~ # uname -r
3.16.0-4-amd64
1.2, change the source software, install common software packages
root @ com: ~ # vim /etc/apt/sources.list # to delete the contents of this document and some Central Plains all, and add the following
deb http://mirrors.163.com/debian/ jessie main
deb http://mirrors.163.com/debian/ jessie-updates main
deb http://mirrors.163.com/debian/ jessie-backports main
deb-src http://mirrors.163.com/debian/ jessie main
deb-src http://mirrors.163.com/debian/ jessie-updates main
deb-src http://mirrors.163.com/debian/ jessie-backports main
deb http://mirrors.163.com/debian-security/ jessie / updates main
deb-src http://mirrors.163.com/debian-security/ jessie / updates main
root @ com: ~ # apt-get update # source software changes after using this command to update the package list
Then install the following three software, this is not a necessary step is optional.
123 root @ com: ~ # apt-get install vim
root @ com: ~ # apt-get install sudo
root @ com: ~ # apt-get install chkconfig
2, install, configure Memcached
root @ com: ~ # apt-cache show memcached # to view the information source memcached package
Package: memcached
Version: 1.4.21-1.1 # Here is the version number
Installed-Size: 206
Maintainer: David Martinez Moreno
Architecture: amd64
Depends: libc6 (> = 2.17), libevent-2.0-5 (> = 2.0.10-stable), libsasl2-2, perl, init-system-helpers (> = 1.18 ~), lsb-base (> = 3.2- 13), adduser
Suggests: libcache-memcached-perl, libmemcached, libanyevent-perl, libyaml-perl, libterm-readkey-perl
Description-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 in mod_perl
apps to avoid storing large chunks of data in Apache memory, and to share
this burden across several machines.
Description-md5: f7b1936bf072e208b59db960aca4de8a
Homepage: http://www.memcached.org/
Tag: devel :: profiler, implemented-in :: c, interface :: daemon, network :: server,
role :: program, secteam :: squeeze-limited-support,
secteam :: wheezy-limited-support
Section: web
Priority: optional
Filename: pool / main / m / memcached / memcached_1.4.21-1.1_amd64.deb
Size: 97362
MD5sum: db1f2159c2a7086d85b9839577490239
SHA1: a2139100c90351e25f232da7415caa0ff3dae052
SHA256: 8efbb75ed1c65343cc72d0e50058b25a671b386eaafe41e456ca4ad29c4630b8
123456789101112131415161718192021222324252627282930313233343536373839404142 root @ com: ~ # apt-get install memcached # here to install memcached software
root @ com: ~ # dpkg -L memcached # Here is generated after viewing memcached package installed which files, but does not show "/etc/memcached.conf" This document is 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
root @ com: ~ # vim /etc/memcached.conf
Here simply modify the two parameters, one that can be used to specify memcached memory size, as follows:
-m 1024 # default is 64M, to modify the size of the actual desired
The second is to modify the listening IP address, default memcached listen only on the local loopback address 127.0.0.1, the following changes to the actual cost to the NIC IP interface:
-l 172.31.11.96
3, Memcached common management commands
root @ com: ~ # service memcached start # start memcached
root @ com: ~ # ss -tnl | grep 11211
LISTEN 0 128 172.31.11.96:11211 *: *
root @ com: ~ # service memcached status # Check whether the memcached started
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
root @ com: ~ # service memcached stop # stop memcached
root @ com: ~ # chkconfig --list | grep memcached # to see what is in start level since the launch of 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 # I'm here to directly test tools xshell
Connecting to 172.31.11.96:11211 ...
Connection established.
To escape to local shell, press 'Ctrl + Alt +]'.
Status stats # input to the memcached stats command to obtain information
STAT pid 17416
STAT uptime 1637
STAT time 1439447639
STAT version 1.4.21
STAT libevent 2.0.21-stable
STAT pointer_size 64
STAT rusage_user 0.036000
STAT rusage_system 0.052000
STAT curr_connections 5
STAT total_connections 7
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 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 22
STAT bytes_written 1103
STAT limit_maxbytes 1073741824 # Here is the memory size in bytes
STAT accepting_conns 1
STAT listen_disabled_num 0
STAT threads 4
STAT conn_yields 0
STAT hash_power_level 16
STAT hash_bytes 524288
STAT hash_is_expanding 0
STAT malloc_fails 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT expired_unfetched 0
STAT evicted_unfetched 0
STAT evictions 0
STAT reclaimed 0
STAT crawler_reclaimed 0
STAT lrutail_reflocked 0
END |
|
|
|