|
1. Compile and install libevent
cd / root / soft_hhf /
wget http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix = / usr
make && make install
cd ../
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 -C / usr / local
cd / usr / local
mv memcached-1.2.6 memcached
cd memcached
./configure --with-libevent = / usr / local
make
make install
exportPKG_CONFIG_PATH = $ PKG_CONFIG_PATH: / usr / local / lib / pkgconfig
3. Compile and install Magent
wget http://memagent.googlecode.com/files/magent-0.5.tar.gz
cd / usr / local
mkdir magent
tar -zxf magent-0.5.tar.gz -C / usr / local / magent
cd / usr / local / magent
/ Sbin / ldconfig
sed -i "s # LIBS = -levent # LIBS = -levent-lm # g" Makefile
vi magetn.c
Add to:
#ifndef SSIZE_MAX
# Define SSIZE_MAX 32767
#endif
make
cp magent / usr / bin / magent
. /etc/init.d/iptables Stop
The installation is complete, which is memched cache server, giving libevent perform IO operations need to install libevent, Magent a proxy server, the client connected to the Magnet it implements load balancing and server backup server that can be enabled when the backup server machine appears when done server, addressing and routing data through a hash algorithm set to the server.
4. Up test.
Here are three memcached server to store data, two memcached server to back up data.
First enable this five memcached server, port, namely: s1: 3333, s2: 4444, s3: 5555, b1: 6666, b6: 7777
Start command: memcached -m 1 -u root -d -l127.0.0.1 -p 3333
Described as the successful launch to start the remaining four servers
Start Magent proxy server
magent -u root -n 51200 -l 127.0.0.1 -p 2222 -s 127.0.0.1:3333 -s127.0.0.1: 4444 -s127.0.0.1: 5555 -b 127.0.0.1:6666 -b 127.0.0.1 : 7777
So far successfully built a cluster server
5. carry out testing
By telent connection magent
telnet 127.0.0.1 2222
stats View Status |
|
|
|