Memcached編譯安裝環境
L:Linux(centos 7.6)
R: Memcached(1.5.12)http://www.memcached.org/files/memcached-1.5.12.tar.gzvim
主機信息:
部署規劃:
172.24.77.241(sr1.dj.com):運行Memcachedcentos
172.24.77.242(sr2.dj.com):運行Memcachedide
cd /usr/local/src/memcached
wget http://www.memcached.org/files/memcached-1.5.12.tar.gzui
yum install libevent libevent-devel –y.net
tar xvf memcached-1.5.12.tar.gzserver
cd memcached-1.5.12部署
./configure --prefix=/usr/local/memcacheget
make && make install同步
添加啓動用戶
groupadd -g 1001 memcached && useradd -u 1001 -g 1000 memcached -s /sbin/nologin
/usr/local/memcache/bin/memcached -u memcached -p 11211 -m 2048 -c 65536 &
tar xvf memcached-1.2.8-repcached-2.2.1.tar.gz
cd memcached-1.2.8-repcached-2.2.1
./configure --prefix=/usr/local/repcached --enable-replication
cp memcached.c memcached.c.bak
vim memcached.c +56
/ FreeBSD 4.x doesn't have IOV_MAX exposed. /
ifndef IOV_MAX
define IOV_MAX 1024
endif
make
make install
/usr/local/repcached/bin/memcached -h
經過 repcached 安裝的 memcached 命令啓動 memcache 服務並實現 memcache 主備結構,其中-x 爲對方即主 memcache 的 IP, -X 爲本地啓動的用數據同步的端口:
server 1 相關操做:
/usr/local/repcached/bin/memcached -d -m 2048 -p 11211 -u root -c 2048 -x 172.24.77.243 -X 16000
server 2 相關操做:
/usr/local/repcached/bin/memcached -d -m 2048 -p 11211 -u root -c 2048 -x 172.24.77.241 -X 16000
yum install telnet -y
telnet 172.24.77.243 11211
set name 0 4
test
quit
telnet 172.24.77.241 11211