memcache

在单台服务器下开启多个memcached服务
32bit下 memcached只支持最大4G内存

Because a 32-bit process can only address 4GB of virtual memory (usually significantly less, depending on your operating system), if you have a 32-bit server with 4-64GB of memory using PAE you can just run multiple processes on the machine, each using 2 or 3GB of memory.

所以如果服务器的内存是4G以上只开一个服务那就显得浪费了,可以在服务器上开启多个服务。

LINUX下

首先安装memcached需要libevent支持

http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz

wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
cd libevent-1.4.12-stable.tar.gz
./configure --prefix=/usr/local
make
make install


ln -s /usr/local/libevent/lib/libevent-1.4..so.2 /usr/lib

安装后下载memcached

http://memcached.googlecode.com/files/memcached-1.4.2.tar.gz

wget http://memcached.googlecode.com/files/memcached-1.4.2.tar.gz
cd memcached-1.4.2.tar.gz
./configure --prefix=/usr/local -with-libevent=/usr/
make
make install


启动多个memcached服务

/usr/local/lib/memcached -d -m 2048 -u root -c 1024 -p 11211 -P /tmp/memcached1.pid
/usr/local/lib/memcached -d -m 2048 -u root -c 1024 -p 11211 -P /tmp/memcached2.pid



WIN下
sc create memcached1 binpath= "c:\memcached\memcached.exe -d runservice -m 64 -c 2048 -p 11211" start= auto displayname= "memcached1"
建立服务器2:
sc create memcached2 binpath= "c:\memcached\memcached.exe -d runservice -m 64 -c 2048 -p 11212" start= auto displayname= "memcached2"
建立服务器3:
sc create memcached3 binpath= "c:\memcached\memcached.exe -d runservice -m 64 -c 2048 -p 11213" start= auto displayname= "memcached3"

你可能感兴趣的:(memcached)