centos7.3部署memcached服务

我们需要下载libevent和memcached这两个压缩包进行安装,可使用以下百度网盘链接进行下载

链接:https://pan.baidu.com/s/1vehZ5odzXFKwNjWT9_W0TA
提取码:bsk9

默认将以上文件下载到root家目录下

1.提前安装好依赖

yum install -y apr* autoconf automake bison cloog-ppl compat* cpp curl curl-devel fontconfig fontconfig-devel freetype 
freetype* freetype-devel gcc gcc-c++ gtk+-devel gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel
krb5-devel libcom_err-devel libpng* libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel
libXpm* libtiff libtiff* libX* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils
ppl telnet t1lib t1lib* nasm nasm* wget zlib-devel gmp-devel

2.解压和安装libevent和memcached

tar -zxvf libevent-2.0.22-stable.tar.gz 
cd libevent-2.0.22-stable
./configure --prefix=/usr/local/libevent
make
make install
cd
tar -zxvf memcached-1.4.25.tar.gz 
cd memcached-1.4.25
./configure --prefix=/usr/local/memcached -with-libevent=/usr/local/libevent
make
make install 

3.启动memcached。注意:-l需要输入本机ip地址

groupadd memcached 
useradd -g memcached memcached -s /bin/false 
ln -s /usr/local/memcached/bin/memcached   /usr/local/bin/memcached
/usr/local/memcached/bin/memcached -d -m 4096 -u root -l 172.16.1.188 -p 11211 -c 1024 -P /usr/local/memcached/memcached.pid

4.检测memcached是否运行正常,端口有在监听就是运行着的

netstat -tlnp|grep 11211

5.测试memcached

telnet 172.16.1.188 11211

红色箭头所指就是我输入的东西。大概意思是设置了一个长度为7的test变量,其值为example,可以看到,我输入get test后,获取到了test的值example

 

参考链接

https://www.osyunwei.com/archives/9547.html

https://blog.51cto.com/13728740/2293824

posted on 2019-05-27 17:06  标配的小号  阅读(228)  评论(0编辑  收藏  举报

导航