How to install the Memcached caching system on Ubuntu 18.04 and 16.04 LTS

Step 1: Install Memcached

First of all, apt package cache on the system update, then install the Memcached service on the system. Execute the following command from a command prompt.

Step Two: Configure Memcached

You can find more information about Memcache configuration here. For the initial level configuration, check the following settings Memcache profile /etc/memcached.conf under.

  • -d => daemon running in Memcached mode. You can use this option to Memcached server is configured to run as a service.
  • => Define the maximum amount of memory that can be used Memcached daemon -m. (Default: 64 MB)
  • -p => Memcached is defined as the listening port. (Default: 11211)
  • -l => define the IP address for Memcached monitoring. Set all IP (Interface) 0.0.0.0 system configured to listen on.

After making changes, restart Memcached service.

The third step: verification setting Memcache

Use the following command to check and verify whether Memcached services running on the system. This will show you the current statistics Memcached server. Therefore, these values ​​may differ from the following results.

Output:

STAT maxbytes 67108864
STAT maxconns 1024
STAT tcpport 11211
STAT udpport 0
STAT inter 127.0.0.1
STAT verbosity 0
STAT oldest 0
STAT evictions on
STAT domain_socket NULL
STAT umask 700
STAT growth_factor 1.25
STAT chunk_size 48
STAT num_threads 4
STAT num_threads_per_udp 4
STAT stat_key_prefix :
STAT detail_enabled no
STAT reqs_per_event 20
STAT cas_enabled yes
STAT tcp_backlog 1024
STAT binding_protocol auto-negotiate
STAT auth_enabled_sasl no
STAT item_size_max 1048576
STAT maxconns_fast yes
STAT hashpower_init 0
STAT slab_reassign yes
STAT slab_automove 1
STAT slab_automove_ratio 0.80
STAT slab_automove_window 30
STAT slab_chunk_max 524288
STAT lru_crawler yes
STAT lru_crawler_sleep 100
STAT lru_crawler_tocrawl 0
STAT tail_repair_time 0
STAT flush_enabled yes
STAT dump_enabled yes
STAT hash_algorithm murmur3
STAT lru_maintainer_thread yes
STAT lru_segmented yes
STAT hot_lru_pct 20
STAT warm_lru_pct 40
STAT hot_max_factor 0.20
STAT warm_max_factor 2.00
STAT temp_lru no
STAT temporary_ttl 61
STAT idle_timeout 0
STAT watcher_logbuf_size 262144
STAT worker_logbuf_size 65536
STAT track_sizes no
STAT inline_ascii_response no
END

Step 4 - Memcached PHP install module

Now, on your Ubuntu system from ppa: ondrej / php PPA to install the latest PHP. If you have PHP installed on your system, skip the following command to install PHP.

Now, PHP Memcached module installed on your system. The following command will perform the required configuration.

How to install the Memcached caching system on Ubuntu 18.04 and 16.04 LTS

After the installation is complete, you must restart the Apache service.

<?php
  phpinfo();
?>

Now, access info.php on the Web interface and search Memcache, you will get the following results.

How to install the Memcached caching system on Ubuntu 18.04 and 16.04 LTS

OK, that's it. You learn. If you have any questions, please post your question in the comments section below Linux commune.

Guess you like

Origin www.linuxidc.com/Linux/2020-03/162742.htm