Memcached是一套分布式的高速緩存系統(tǒng),用于提升網(wǎng)站訪問速度,尤其對于一些大型的、需要頻繁訪問數(shù)據(jù)庫的網(wǎng)站,訪問速度提升效果十分顯著。
創(chuàng)新互聯(lián)公司是專業(yè)的魯山網(wǎng)站建設(shè)公司,魯山接單;提供成都網(wǎng)站建設(shè)、成都做網(wǎng)站,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行魯山網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
1.安裝memcached
yum install memcached
yum install libmemcached
netstat -ntpl
systemctl status memcached
systemctl start memcached
netstat -ntupl
2.配置memcached只監(jiān)聽127.0.0.1
vim /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1 -U 0“ # -U 0 不啟用UDP監(jiān)聽
systemctl restart memcached
netstat -ntpl
systemctl status memcached
3.檢查memcached運(yùn)行,能看到很多信息
memstat --servers="127.0.0.1"
4.配置memcached啟用sasl
vim /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1 -U 0 -S -vv"
systemctl restart memcached
netstat -ntpl
memstat --servers="127.0.0.1"
echo $?
5.安裝cyrus SASL庫
yum install cyrus-sasl-devel cyrus-sasl-plain
6.配置sasl
vim /etc/sasl2/memcached.conf
mech_list: plain
log_level: 5
sasldb_path: /etc/sasl2/memcached-sasldb2
cat /etc/sasl2/memcached.conf
saslpasswd2 -a memcached -c -f /etc/sasl2/memcached-sasldb2 zeng
chown memcached:memcached /etc/sasl2/memcached-sasldb2
systemctl restart memcached
netstat -ntpl
memstat --servers="127.0.0.1"
echo $?
memstat --servers="127.0.0.1" --username=zeng --password=redhat