Memcached集羣安裝

安裝環境

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

編譯安裝 Memcached

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

啓動 memcached

/usr/local/memcache/bin/memcached -u memcached -p 11211 -m 2048 -c 65536 &

部署repcached

wget https://sourceforge.net/projects/repcached/files/repcached/2.2.1-1.2.8/memcached-1.2.8-repcached-2.2.1.tar.gz

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

修改memcached配置文件

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

啓動 memcache

經過 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

鏈接到 memcache 驗證數據

yum install telnet -y

telnet 172.24.77.243 11211

set name 0 4

test

quit

telnet 172.24.77.241 11211

相關文章
相關標籤/搜索