Distributed memcached Server Proxy magent installation configuration (CentOS6.6)

Source: Internet
Author: User
Tags gpg keep alive

Memcache Server Installation configuration (192.168.1.247~249)
First: Configure the local Yum source, mount the CD-ROM, install the compiler

CentOS6.6 has two ISO files, installs two optical drives on a virtual machine, and connects to two ISO files

1. Modify the Yum source configuration

cd/etc/yum.repos.d/
MV Centos-base.repo Centos-base.repo.bak
VI Centos-media.repo



The changes are replaced by the following:

baseurl=file:///media/cdrom1/
file:///media/cdrom2/
Gpgcheck=0
Enabled=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6



To create a folder:


Mkdir/media/cdrom1
Mkdir/media/cdrom2



To mount the optical drive:

Mount/dev/cdrom/media/cdrom1
Mount/dev/cdrom1/media/cdrom2




Then yum install gcc gcc-c++




1. Compile and install Libevent:


wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
Tar zxvf libevent-1.4.9-stable.tar.gz
CD libevent-1.4.9-stable/
Mkdir/usr/local/libevent
./configure--prefix=/usr/local/libevent
Make && make install


2. Compile and install memcached:


wget http://danga.com/memcached/dist/memcached-1.2.6.tar.gz
Tar zxvf memcached-1.2.6.tar.gz
CD memcached-1.2.6/
Mkdir/usr/local/memcached
./configure--prefix=/usr/local/memcached--with-libevent=/usr/local/libevent
Make && make install


3. Start the memcached server:


/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


Yum Install gcc gcc-c++ libgnomeui-devel




3. Compile and install Libevent:


wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz//Download Install Libevent
Tar zxvf libevent-1.4.9-stable.tar.gz
CD libevent-1.4.9-stable/
Mkdir/usr/local/libevent
./configure
Make && make install


4, Installation Magent


Mkdir/usr/local/magent
CP./magent-0.6.tar.gz/usr/local/magent
Cd/usr/local/magent
Tar xzvf./magent-0.6.tar.gz
/sbin/ldconfig
Sed-i "s/libs =-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)

#ifndef Ssize_max
#define SSIZE_MAX 32767
#endif



Continue make


CP magent/usr/bin/





Start Memagent:


/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

Phpinfo (); See if the extension is turned on
$mem = new Memcache ();
Direct connection to a proxy server
$mem->connect (' 192.168.1.246 ', 12000) or Die (' Connect fail!<br> ');

echo "Connect success!<br>";

for ($i =0; $i <10; $i + +) {
if ($mem->set (' key '. $i, ' data '. $i, 0, 3600)) {
echo "Set ok!";
}else{
echo "Set false!";
}
}



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


Open vi/etc/sysconfig/iptables add memcache port on reboot
Solution:
When starting memcached, you cannot use –l 127.0.0.1 or-l localhost to set the current IP


/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 "/>



This article is from the "fiting" blog, make sure to keep this source http://zrwx123.blog.51cto.com/10193196/1642249

Distributed memcached Server Proxy magent installation configuration (CentOS6.6)

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.