CentOS installation, configuration memcached

Source: Internet
Author: User
Tags cdata memcached

Check to see if memcached is already installed.
Input memcached-h will output memcached version, or print phpinfo view;

Memcached need libevent support, no libevent, first install Libevent
Yum Install Libevent-devel

memcached installation can be compiled by source code installation, you can also use Yum;
Source Code Compilation Installation

1 #wget http://memcached.googlecode.com/files/memcached-1.4.10.tar.gz  2 # TAR-ZXVF memcached-1.4. Ten . tar.gz   3 #cd memcached-1.4. Ten  4 #./configure--prefix=/usr/local/webserver/memcached--with-libevent=/usr/  5# Make  6 #make Install  

Or

1 yum install-y memcached


After confirming the installation, the default configuration file is/etc/sysconfig/memcached, which makes it easy to make memory, port and so on.
or use the command to configure:

1 #/usr/local/webserver/memcached/bin/memcached-d-M 32-l 127.0.0.1-p 11211-u root-p/tmp/memcached.pid

No prompt to start successfully
Parameter hints:
-P Listening Port
-L connected IP address, default is native
-D Start Memecache service
-D Restart Restart
-D stop|shutdown Shutdown service
-D Install installation
-D Uninstall Uninstall
-U Run as identity only valid under root
-m maximum memory usage, unit MB, default 64MB, Max 2G
-M error returned when memory is exhausted
-c Maximum number of simultaneous connections, default is 1024
-F Block Size growth because the default is 1.25
-N Minimum allocated space, key+value+flags default 48
-H Display Help


Then make sure that the firewall has the correct port open, add the firewall rule in/etc/sysconfig/iptables, and open the corresponding port:

1 -A input-m State--state new-m tcp-p TCP--dport 11211-j ACCEPT

Restart Firewall service iptables restart;


Use the Telnet host 11211-Status test to view the current status of Memcache;
Magento need another plugin to support memcached, enter the following command

1 yum install-y php-pecl-memcache

Last Restart service httpd restart


Modify App/etc/local.xml, configure memcached for Magento, file as follows

1 <Session_save><! [Cdata[memcache]]></Session_save>  2 <Session_save_path><! [Cdata[tcp://10.10.10.1:11211?persistent=1&weight=2&timeout=10&retry_interval=10]]></Session_save_path>  3 <Cache>  4     <Backend>Memcached</Backend>  5     <memcached>  6         <Servers>  7             <Server>  8                 <Host><! [Cdata[10.10.10.1]]></Host>  9                 <Port><! [Cdata[11211]]></Port>  Ten                 <Persistent><! [Cdata[1]]></Persistent>   One             </Server>   A         </Servers>   -         <Compression><! [Cdata[0]]></Compression>   -         <Cache_dir><! [cdata[]]></Cache_dir>   the         <Hashed_directory_level><! [cdata[]]></Hashed_directory_level>   -         <Hashed_directory_umask><! [cdata[]]></Hashed_directory_umask>   -         <File_name_prefix><! [cdata[]]></File_name_prefix>   -     </memcached>   + </Cache>  

Remember to replace the above IP for the correct host address;

CentOS installation, configuration memcached

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.