Created
April 24, 2017 22:57
-
-
Save kolunar/5670f0f0d21f2e3b21bb7117c7320cae to your computer and use it in GitHub Desktop.
memcached installation on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ubuntu-12-04 | |
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-memcache-on-ubuntu-12-04 | |
Ubuntu-14-04 | |
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-memcache-on-ubuntu-14-04 | |
Read More: | |
https://www.digitalocean.com/community/tags/caching?type=tutorials | |
======================================================= | |
In /etc/memcached.conf | |
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default | |
# Note that the daemon will grow to this size, but does not start out holding this much | |
# memory | |
# -m 64 | |
-m 2048 | |
======================================================= | |
Start memcache by firing this command: | |
memcached -d -m 2048 -l 127.0.0.1 -p 11211 -u nobody (d = daemon, m = memory, u = user, l = IP to listen to, p = port) | |
Check your memcached server is running successfully: | |
ps -eaf | grep memcached | |
Command below is to get process id only | |
pidof memcached | |
======================================================== | |
Change the memcached configuration setting for CACHESIZE | |
1) Open /etc/sysconfig/memcached in a text editor. | |
2) Locate the value for CACHESIZE and change it to at least 1GB. | |
For example, CACHESIZE="1GB" | |
3) Save your changes and Restart memcached: | |
service memcached restart | |
======================================================== | |
NOTE: you might want to check webserver if apache2 or httpd then restart its service | |
To verify memcached is recognized by the web server: | |
Create a phpinfo.php file in the web server’s docroot: | |
<?php | |
// Show all information, defaults to INFO_ALL | |
phpinfo(); | |
?> | |
Go to that page in your web browser. For example, http://example.com/phpinfo.php | |
========================================================= | |
Memcached cheat-sheet | |
http://lzone.de/cheat-sheet/memcached | |
For distributed memcached or horizontal scaling | |
https://www.digitalocean.com/community/tutorials/how-to-share-php-sessions-on-multiple-memcached-servers-on-ubuntu-14-04 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment