Installation configuration for CENTOS7 under memcached

Source: Internet
Author: User
Tags memcached

1. Download

Official website Http://memcached.org/memcached relies on libevent-devel need to install Libevent-devel first
1 Yum Install Libevent-devel

Installation completed continue to install memcached
1 wgethttp//memcached.org/files/memcached-1.4.35.tar.gz2  3 Tar-ZXVF memcached-1.4. *.Tar. GZ4  5CD memcached-1.4. *.Tar. GZ6  7./configure && Make&&sudo  Make Install

The installation is successful and can be
1 /usr/local/bin2 found memcached

2. Start and close 1. Start the server
1 Ten 127.0. 0.1  12000  -p/tmp/memcached.pid

Description

1 -d option is to start a daemon,2 -m is allocated to memcache using the amount of memory, in megabytes, I here is 10MB,3 -  U is the user running memcache, I here is root,4 -L is the server IP address listening, if there are more than one address, I specify the server IP address 127. 0.0. 1 5 -p is set memcache listening port, I set 12000 here, preferably more than 1024 ports,6 -C option is the maximum number of concurrent connections running, the default is 1024, I set up here 256, according to your server load amount to set,7 -P is set to save memcache pid file, I here is saved in/tmp/memcached.pid,

Check whether the startup was successful:
1[Email protected] bin]#PSAux |grepmemcached2Apache9949  0.0  0.4 324676  4104? SslTen: +   0: on/usr/local/bin/memcached-d-MTen-U apache-l127.0.0.1-P12000-C the-p/tmp/Memcached.pid3Root10652  0.0  0.0 112648   960pts/0r+ One: ,   0:xx grep--color=auto memcached
2. End memcached
1 kill 'cat /tmp/memcached.pid '
You can also start multiple daemons, but the ports cannot be duplicated. Use memcached1 in 3.php. Install php-pecl-memcached
1 Yum Install php-pecl-memcached2  3 add module to PHP4 vim/etc/ php.ini 5 Add 6  7 extension=memcached.so
See this to indicate that the module was successfully installed.

2. Write Test PHP
1 <? PHP 2 $m = new Memcached (); 3 $m->addserver ('localhost'12000); 4 Print_r ($m->getversion ());

If the version number Array ([localhost:12000] = 1.4.35) is displayed as normal, the PHP connection memcached succeeds if the display Array ([localhost:12000] = 255.255.255)the connection fails Workaround:First, note that when you start the memcached service, you specify-u apache second, SELinux is turned onRun
1 /usr/sbin/setsebool httpd_can_network_connect=1

OK, you can use it normally.    

Centos7 the installation configuration under 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.