Get the App
SLTechnology News&Howtos  ›  Servers  › 

Centos7 configuration memcached

Shulou Source: shulou.com Published: 2022-06-03 00:32:45 09月25日 Update

Memcached is a distributed cache system used to speed up website access, especially for large websites that require frequent access to databases.

1. Install memcached

yum install memcached

yum install libmemcached

netstat -ntpl

systemctl status memcached

systemctl start memcached

netstat -ntupl

2. Configure memcached to listen only on 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 Do not enable UDP listening

systemctl restart memcached

netstat -ntpl

systemctl status memcached

3. Check memcached running, you can see a lot of information

memstat --servers="127.0.0.1"

4. configure memcached enable 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. Install cyrus SASL library

yum install cyrus-sasl-devel cyrus-sasl-plain

6. Configure 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

Tags: Configuration website speed monitoring salient frequent information distributed effects data database system cache high speed check run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Redmi Shulou Tech Info vpn