8.memcached installation?
Memcached installation is relatively simple, many platforms support memcached, common are: Linux, FreeBSD, Solaris,
Windows.
This is illustrated in the example of centos6.4.
Software Address:
memcached:http://www.danga.com/memcached/
memcached Other: http://memcached.googlecode.com/files/memcached-1.4.15tar.gz
memcached Other: Http://coode.google.com/p/memcached/downloads/list
libevent:http://monkey.org/provs/libevent/
User installation Information: http://instance.iteye.com/blog/1691705
Installation:
First step: Install Libevent
# wget http://www.mokey.org/~provos/libevent-1.4.1.-stable.tar.gz
# tar zxf libevent-1.4.13-stable.tar.gz
# CD Libevent-1.4.13-stable
#./configure
# make
# make Install
# CD: /
The CentOS system can also be installed using the domain name Libevent
Step Two: Install memcached
# wget http://memcached.googlecode.com/files/memcached-1.4.13tar.gz
# tar zxf memcached-1.4.13tar.gz
# CD memcached-1.4.13
#./configure
# make
# make Install
# CD: /
Tip: Memcache-2.2.5.tgz is the client
Memcached-1.4.13.tar.gz is the service side (after looking at the Memcache plus d)
Step three: Start memcached
(1) Configure ld.so.conf path to prevent start memcached times wrong
# memcached--help
Memcached:error while loading shared libraries:libevent-1.4.so.2:
Cannot open shared object File:no such file or directory
Solution: Echo "/usr/local/lib" >>/etc/ld.so.conf
Ldconfig
Tip centos5.8 do not do the above configuration is also OK
(2) Start memcached
# which memcached
# memcached-m 1m-p 11212-d-C 8192
(-M for memcached allocated memory size-p Specifies external service port number-D background Start-U Specify user-C concurrent Connection number-F tuning factor)
(3) Multi-instance, directly change the port on the line
(4) Write data check results
Adding data to memcached: key-value pairs
Key1-values1
Key2-values2
memcached command syntax:
Set key 0 0 (Expiration time) 10 (bytes) \ r \ n
printf "Set key008 0 0 10\r\noldboy0987\r\n" |nc 127.0.0.1 11211
<command name> <key> <flages> <exptime> <bytes>\r\n
A. Writing via NC
Write # printf "set key008 0 0 10\r\noldboy0987\r\n" |nc 127.0.0.1 11211
Remove # printf "Get key008 0 0 10\r\noldboy0987\r\n" |nc 127.0.0.1 11211
Delete # printf "Deldet key008 0 0 10\r\noldboy0987\r\n" |NC 1
B. Writing via Telnet
# telnet 127.0.0.1
(5) Installation of the client
# wget Http://pecl.php.net/get/memcache-2.2.5.tgz
# tar ZXVF memcache-2.2.5.tgz
# CD Memcache-2.2.5.tgz
/application/php/bin/phpize
./configure--enable-memcache--with-php-config=/applicaton/php/bin/php-config--with-z
Make
Make install
There will be: Memcached.so's success Tips
(2) Modify the php.ini file
cd/application/php/lib/
Extension_dir = "./"
Modified to:
Extension_dir = "memcach.so file path"
and add a line:
Extension=memcache.so
(3) Restart Apache or Nginx service to make PHP configuration effective
Apache:
#/application/apache/bin/apachectl-t
Syntax OK
#/application/apache/bin/apachectl Graceful
If it is nginx:
#/application/nginx/sbin/nginx-t
#/application/nginx/sbin/nginx-s Reload
# Pkill PHP-FPM
#/APPLICATION/PHP/SBIN/PHP-FPM
(4) Open browser Access phpinfo page test if installation is successful
8.session sharing
Add on the Web
Session.save_handler = Memcache
Session.save_path = "tcp://10.0.0.7:1121 (IP and port)"
This article from "10656918" blog, declined reprint!
Memcached Installation and session sharing