Distributed memcached Server Proxy magent installation configuration (CentOS6.6)
Reference: http://blog.snsgou.com/post-800.html
Four servers: 192.168.1.246~249
Magent Proxy Server: 192.168.1.246
Memcache Backup Server 1:192.168.1.249
Memcache Storage Server 1:192.168.1.247
Memcache Storage Server 2:192.168.1.248
Memcache Server Installation configuration (192.168.1.247~249)
First: Configure the local Yum source, mount the CD-ROM, install the compiler
1 |
Yum Install gcc gcc-c++ |
1. Compile and install Libevent:
123456 |
wget Http://monkey.org/~provos/libevent-1.4.9-stable.tar.gztar ZXVF LIBEVENT-1.4.9-STABLE.TAR.GZCD Libevent-1.4.9-stable/mkdir/usr/local/libevent./configure--prefix=/usr/local/libeventmake && make install |
2. Compile and install memcached:
123456 |
wget Http://danga.com/memcached/dist/memcached-1.2.6.tar.gztar zxvf MEMCACHED-1.2.6.TAR.GZCD memcached-1.2.6/mkdir /usr/local/memcached./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libeventmake && Make install |
3. Start the memcached server:
1 |
/usr/local/memcached/bin/memcached-m 100-u root-d-L 127.0.0.1-p 11211 |
memcached parameter Details:
-P TCP Port number to listen on (default:11211)
-U UDP port number to listen on (default:0, off)
-S UNIX socket path to listen on (disables network support)
-A access mask for UNIX sockets, in octal (default 0700)
-L interface to listen in, default is Indrr_any
-D Run as a daemon
-R Maximize Core file limit
-U assume identity of (only if run as root)
-M max memory to use for items in megabytes, default is ~ MB
-M return error on memory exhausted (rather than removing items)
-C Max simultaneous connections, default is 1024
-K Lock down all paged memory. Note that there is a
Limit on how much memory you may lock. Trying to
Allocate more than this would fail, so is sure you
Set the limit correctly for the user started
The daemon with (not for-u user;
Under SH This is do with ' ulimit-s-l num_kb ').
-V Verbose (print errors/warnings while in event loop)
-VV very verbose (also print client commands/reponses)
-H Print this help and exit
-I print memcached and libevent license
-B Run a managed instanced (mnemonic:buckets)
-P Save PID in, only used with-d option
-F Chunk size growth factor, default 1.25
-N minimum space allocated for key+value+flags, default 48
Memcache Proxy Server Magent installation configuration (192.168.1.246)
1, Magent is an open-source memcached proxy Server software, the project URL is: http://code.google.com/p/memagent/the latest version of the current 0.6
2, install, first configure the local source, mount the CD-ROM, install the compiler
1 |
Yum Install gcc gcc-c++ libgnomeui-devel |
3. Compile and install Libevent:
123456 |
wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz//download install Libeventtar ZXVF LIBEVENT-1.4.9-STABLE.TAR.GZCD Libevent-1.4.9-stable/mkdir/usr/local/libevent./configuremake && make Install |
4, Installation Magent
1234567 |
mkdir magent CP magent-0.6.tar.gz./magent CD magent tar xzvf./magent-0.6.tar.gz/sbin/ldconfig sed-i "S/LI BS =-levent/libs =-levent-lm/g "Makefile make |
magent.c:729: Error: ' Ssize_max ' not declared (first use within this function)
magent.c:729: Error: (even if multiple occurrences occur within a function, each undeclared identifier is in its
magent.c:729: Error: The function inside is also reported only once. )
Make: * * [MAGENT.O] Error 1
Solution:
#在ketama. h Join (filter out special characters)
123 |
#ifndef ssize_max#define Ssize_max 32767#endif |
Continue make
1 |
CP Magent/usr/bin/magent |
Start Memagent:
1 |
/usr/bin/magent-u root-n 4096-l 192.168.1.246-p 12000-s 192.168.1.247:11211-s 192.168.1.248:11211-b 192.168.1.249: 11211 |
Magent Command Detailed:
-H This message
-U UID
-G GID
-P port, default is 11211. (0 to disable TCP support)
-S Ip:port, set memcached server IP and port
-B ip:port, set backup memcached server IP and port
-l IP, local bind IP address, default is 0.0.0.0
-N number, set Max connections, default is 4096
-D do not go to background
-K Use Ketama key allocation algorithm
-f file, UNIX socket path to listen on. Default is Off
-I number, max keep alive connections for one memcached server, default is 20
-V Verbose
PHP opens the extension php_memcache. DLL note version of the issue
Error message:
Notice:memcache::set (): Server 192.168.1.246 (TCP 12000) failed with:failed reading line from stream (0)
The reason: Proxy magent is not connected to the memcached server
Solution:
When starting memcached, you cannot use –l 127.0.0.1 or-l localhost to set the current IP
1 |
/usr/local/memcached/bin/memcached-m 100-u root-d-L 192.168.1.247-p 11211 |
Use Memadmin to monitor the storage status of memcached servers:
Backup server bak_249 Requests 10 times, s1_247 five times, s2_248 five times, memadmin statistical information such as:
Backup Server 249:
650) this.width=650; "src=" http://blog.bwphp.cn/wp-content/uploads/2015/01/magent_bak.jpg "alt=" Magent_bak "class= "Alignnone size-full wp-image-470" height= "731" width= "817"/>
s1_247:
650) this.width=650; "src=" Http://blog.bwphp.cn/wp-content/uploads/2015/01/s1.jpg "alt=" S1 "class=" Alignnone Size-full wp-image-472 "height=" 728 "width=" 824 "/>
s2_248:
650) this.width=650; "src=" http://blog.bwphp.cn/wp-content/uploads/2015/01/s2.jpg "alt=" S2 "class=" Alignnone Size-full wp-image-473 "height=" 731 "width=" 825 "/>
Distributed memcached Server Proxy magent installation configuration (CentOS6.6)