目录
1、安装memcached的准备工作
2、安装、配置 Memcached
3、Memcached常用管理命令
4、Memcached测试
1、安装memcached的准备工作
1.1、系统环境
root@com:~# cat /etc/issue
Debian GNU/Linux 8 \n \l
root@com:~# uname -r
3.16.0-4-amd64
1.2、更改软件源,安装常用软件包
root@com:~# vim /etc/apt/sources.list #把此文件中原有的内容全部删除,并增加如下内容
deb jessie main
deb jessie-updates main
deb jessie-backports main
deb-src jessie main
deb-src jessie-updates main
deb-src jessie-backports main
deb jessie/updates main
deb-src jessie/updates main
root@com:~# apt-get update #更改软件源后用此命令更新包列表
再安装如下三个软件,这不是必要的步骤,可选。
123 root@com:~# apt-get install vim
root@com:~# apt-get install sudo
root@com:~# apt-get install chkconfig
2、安装、配置 Memcached
root@com:~# apt-cache show memcached #查看源中的memcached包的信息
Package: memcached
Version: 1.4.21-1.1 #这里是版本号
Installed-Size: 206
Maintainer: David Martínez Moreno <ender@debian.org>
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:
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 #这里是安装memcached软件
root@com:~# dpkg -L memcached #这里是查看memcached这个包安装后产生的了哪些文件,但没有显示出“/etc/memcached.conf”这个文件,很奇怪
/.
/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
这里只需修改两个参数,一是指定memcached所能使用的内存大小,如下:
-m 1024 #默认是64M,请修改成实际所需要的大小
二是修改监听的IP地址,默认时memcached只监听在127.0.0.1这个本地回环地址上,如下修改成本地网卡接口上的实际IP:
-l 172.31.11.96
3、Memcached常用管理命令