Installazione di Memcached su CentOS 7
In questo articolo andremo a descrivere come installare Memcached sistema di caching di oggetti in memoria RAM su CentOS 7.
Consideriamo di partire da un macchina virtuale preinstallata CentOS 7 ( qui l’ articolo per l’installazione) ed aggiorniamola
yum update
installiamo il pacchetto Memcached
yum install memcached
avviamo il processo Memcached, di default la porta è 11211
systemctl start memcached
abilitiamo al boot
systemctl enable memcached
per ottenere la lista delle opzioni disponibili e la versione utilizzare l’ opzione -h, in particolare
memcached -h
mentre il file di configurazione è al seguente percorso
cd /etc/sysconfig/
vim memcached
avremo
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=””
quindi se volessimo allocare ad esempio per un sito web un caching di 2 GB (dipende da quanta ram abbiamo a disposizione) andremo a modificare il parametro
CACHESIZE = “2048”
riavviamo Memcached
systemctl enable memcached
Il tool per la verifica delle statistiche è
memcached-tool 127.0.0.1 stats
avremo
#127.0.0.1:11211 Field Value
accepting_conns 1
auth_cmds 0
auth_errors 0
bytes 0
bytes_read 7
bytes_written 0
cas_badval 0
cas_hits 0
cas_misses 0
cmd_flush 0
cmd_get 0
cmd_set 0
cmd_touch 0
conn_yields 0
connection_structures 11
curr_connections 10
curr_items 0
decr_hits 0
decr_misses 0
delete_hits 0
delete_misses 0
evicted_unfetched 0
evictions 0
expired_unfetched 0
get_hits 0
get_misses 0
hash_bytes 524288
hash_is_expanding 0
hash_power_level 16
incr_hits 0
incr_misses 0
libevent 2.0.21-stable
limit_maxbytes 67108864
listen_disabled_num 0
pid 1425
pointer_size 64
reclaimed 0
reserved_fds 20
rusage_system 1.141167
rusage_user 0.000000
threads 4
time 1587473139
total_connections 11
total_items 0
touch_hits 0
touch_misses 0
uptime 11957
version 1.4.15
E’ possibile collegare Memcached ad applicativi in PHP, Python o CMS come Joomla, WordPress.