centos7配置Memcached

Memcached是一套分佈式的高速緩存系統,用於提高網站訪問速度,尤爲對於一些大型的、須要頻繁訪問數據庫的網站,訪問速度提高效果十分顯著。數據庫

 

1.安裝memcachedvim

yum install memcached緩存

yum install libmemcached分佈式

netstat -ntplmemcached

systemctl status memcached網站

systemctl start memcachedspa

netstat -ntuplrest

 

2.配置memcached只監聽127.0.0.1server

vim /etc/sysconfig/memcached class

  PORT="11211"

  USER="memcached"

  MAXCONN="1024"

  CACHESIZE="64"

  OPTIONS="-l 127.0.0.1 -U 0「   # -U 0 不啓用UDP監聽

 

systemctl restart memcached

netstat -ntpl

systemctl status memcached

 

3.檢查memcached運行,能看到不少信息

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

相關文章
相關標籤/搜索