6月 162016
 

安装

[root@localhost ~]# yum install memcached

查看安装路径

[root@localhost ~]# rpm -lq memcached
/etc/rc.d/init.d/memcached
/etc/sysconfig/memcached
/usr/bin/memcached
/usr/bin/memcached-tool
/usr/share/doc/memcached-1.4.4
/usr/share/doc/memcached-1.4.4/AUTHORS
/usr/share/doc/memcached-1.4.4/CONTRIBUTORS
/usr/share/doc/memcached-1.4.4/COPYING
/usr/share/doc/memcached-1.4.4/ChangeLog
/usr/share/doc/memcached-1.4.4/NEWS
/usr/share/doc/memcached-1.4.4/README
/usr/share/doc/memcached-1.4.4/protocol.txt
/usr/share/doc/memcached-1.4.4/readme.txt
/usr/share/doc/memcached-1.4.4/threads.txt
/usr/share/man/man1/memcached.1.gz
/var/run/memcached
[root@localhost ~]#

启动服务

查看端口监听

查看默认配置

[root@localhost ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
[root@localhost ~]#

使用telnet登录验证服务

C:\Users\harveymei>telnet 192.168.2.44 11211
stats
STAT pid 1207
STAT uptime 47
STAT time 1466062672
STAT version 1.4.4
STAT pointer_size 64
STAT rusage_user 0.000000
STAT rusage_system 0.002999
STAT curr_connections 10
STAT total_connections 11
STAT connection_structures 11
STAT cmd_get 0
STAT cmd_set 0
STAT cmd_flush 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 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 threads 4
STAT conn_yields 0
STAT bytes 0
STAT curr_items 0
STAT total_items 0
STAT evictions 0
END
quit
遗失对主机的连接。
C:\Users\harveymei>

下载源码包

[root@localhost ~]# curl -O http://www.memcached.org/files/memcached-1.4.25.tar.gz

安装依赖包

[root@localhost ~]# yum install gcc libevent-devel

编译安装

[root@localhost ~]# tar xzf memcached-1.4.25.tar.gz
[root@localhost ~]# cd memcached-1.4.25
[root@localhost memcached-1.4.25]# ./configure --prefix=/usr/local/memcached
[root@localhost memcached-1.4.25]# make
[root@localhost memcached-1.4.25]# make install

启动服务

[root@localhost ~]# cd /usr/local/memcached/bin/
[root@localhost bin]# ./memcached -d -u nobody
[root@localhost bin]#

查看运行进程和端口监听
使用防火墙限定可以访问memcached服务的服务器源地址

iptables -I INPUT -p tcp -s 192.168.1.100 --dport 11211 -j ACCEPT
iptables -I INPUT -p udp -s 192.168.1.100 --dport 11211 -j ACCEPT

使用1.4.3或以上版本的memcached支持使用SASL进行登录验证,需要在编译时加入–enable-sasl参数。

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据