In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to install Memcache under CentOS 5.4". In the operation of practical cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
I. Source package preparation
The server side is mainly to install the memcache server side, and the latest version is memcached-v1.4.4.
Download:
In addition, memcache uses libevent as a library for socket processing, so you also need to install libevent
The latest version of libevent is libevent-1.4.13-stable. (if your system already has libevent installed, you don't have to install it.)
Prepare the source installation package for memcached's php extension:
Download the linux instruction:
The copy code is as follows:
Wget http://memcached.googlecode.com/files/memcached-1.4.4.tar.gz
Wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
Wget http://pecl.php.net/get/memcache-2.2.5.tgz
II. Installation and configuration
1. Install libevent first
The copy code is as follows:
Tar zxvf libevent-1.4.13-stable.tar.gz
Cd libevent-1.4.13-stable
. / configure-- prefix=/usr
Make
Make install
2. Test whether libevent is installed successfully.
The copy code is as follows:
Ls-al / usr/lib | grep libevent
Libevent-1.1a.so.1
Libevent-1.1a.so.1.0.2
Libevent-1.4.so.2
Libevent-1.4.so.2.1.3
Libevent.a
Libevent_core-1.4.so.2
Libevent_core-1.4.so.2.1.3
Libevent_core.a
Libevent_core.la
Libevent_core.so
Libevent_extra-1.4.so.2
Libevent_extra-1.4.so.2.1.3
Libevent_extra.a
Libevent_extra.la
Libevent_extra.so
Libevent.la
Libevent.so
Depending on the version, the list of files may be different.
3. To install memcached, you need to specify the installation location of libevent in the installation
The copy code is as follows:
Tar zxvf memcached-1.4.4.tar.gz
Cd memcached-1.4.4
. / configure-with-libevent=/usr
Make & & make install
Memcached will be automatically placed in / usr/local/bin/memcached after installation is completed.
4. Test whether memcached is installed successfully.
The copy code is as follows:
Ls-al/ usr/local/bin/mem*
-rwxr-xr-x 1 root root 201869 12-14 21:44 / usr/local/bin/memcached
5. Install the php extension of memcache
① installs memcache extensions for php
The copy code is as follows:
Tar vxzf memcache-2.2.5.tgz
Cd memcache-2.2.5
/ usr/local/webserver/php/bin/phpize
. / configure-- enable-memcache-- with-php-config=/usr/local/php/bin/php-config-- with-zlib-dir
Make
Make install
After the above installation of ②, there will be a prompt similar to this:
Installing shared extensions: / usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/
③ modifies extension_dir = ". /" in php.ini to
The copy code is as follows:
Extension_dir = "/ usr/local/php/lib/php/extensions/no-debug-non-zts-2007xxxx/"
④ adds a line to load the memcache extension: extension=memcache.so
III. Basic settings of memcached
1. Start the server side of memcache:
The copy code is as follows:
Memcached-d-m 10-u root-l 202.207.177.177-p 11211-c 256-p / tmp/memcached.pid
Parameter description:
The-d option is to start a daemon
-m is the amount of memory allocated to memcache in mb, and this is 10mb.
-u is the user running memcache. This is root.
-l is the ip address of the listening server. If there are multiple addresses, I specify the ip address of the server 202.207.177.177.
-p is the port on which memcache snooping is set. I have set 11211 here, preferably a port above 1024.
The-c option is the maximum number of concurrent connections running. The default is 1024. I set it here according to the load of your server.
-p is the pid file that is set to save memcache. Here I save it in / tmp/memcached.pid
two。 To end the memcache process, execute:
The copy code is as follows:
Kill `cat / tmp/ Memcached.pid`
Multiple daemons can also be started, but the ports cannot be duplicated.
3. Check whether memcached is started
The copy code is as follows:
Netstat-ant
Tcp 0 0202.207.177.177Viru 11211 0.0.0.0purl * list
Port 11211 has been opened, indicating that memcached has started normally.
4. Restart centos
The copy code is as follows:
Reboot
IV. Memcache environment testing
Run the following php file, and if there is an output of this is a testing, it means that the environment has been built successfully. Start your memcache journey!
The copy code is as follows:
The famous phpcms also supports memcached extensions:
The copy code is as follows:
This is the end of "how to install Memcache under CentOS 5.4". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.