keepalived+lvs+magent+memcached集群高可用方案



root  25277     1  0 11:01 ?        Ssl    0:00 /opt/root/memcached-1.4.13/memcached -m 512m -p 11211 -d

root      1273     1  0 15:41 ?        Ssl    0:00 /opt/root/memcached-1.4.13/memcached -m 512m -p 11212 -d -u root

root      1290     1  0 15:41 ?        Ssl    0:00 /opt/root/memcached-1.4.13/memcached -m 512m -p 11213 -d -u root

root      1309     1  0 15:42 ?        Ss     0:00 /opt/root/magent_offline/magent -p 11311 -s 127.0.0.1:11211 -s 127.0.0.1:11212 -b 127.0.0.1:11213

root      1405     1  0 15:45 ?        Ss     0:00 /opt/root/magent_offline/magent -p 11411 -s 127.0.0.1:11211 -s 127.0.0.1:11212 -b 127.0.0.1:11213

[root@192_168_1_81 ~]# telnet 127.0.0.1 11311

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

stats

memcached agent v0.6

matrix 1 -> 127.0.0.1:11211, pool size 1

matrix 2 -> 127.0.0.1:11212, pool size 1

END

set bk1 0 0 4

1111

STORED

set bk2 0 0 4

2222

STORED

set bk3 0 0 4

3333

STORED

qu^H^H^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11411

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

stats

memcached agent v0.6

matrix 1 -> 127.0.0.1:11211, pool size 0

matrix 2 -> 127.0.0.1:11212, pool size 0

END

set bk4 0 0 4

4444

STORED

set bk5 0 0 4

5555

STORED

set bk6 0 0 4

6666

STORED

^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11311

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

get bk4

VALUE bk4 0 4

4444

END

get bk5

VALUE bk5 0 4

5555

END

get bk6

VALUE bk6 0 4

6666

END

get bk1

VALUE bk1 0 4

1111

END

get bk2

VALUE bk2 0 4

2222

END

get bk3

VALUE bk3 0 4

3333

END

=^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11411

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

get bk1

VALUE bk1 0 4

1111

END

get bk2

VALUE bk2 0 4

2222

END

get bk3

VALUE bk3 0 4

3333

END

get bk4

VALUE bk4 0 4

4444

END

get bk5

VALUE bk5 0 4

5555

END

get bk6

VALUE bk6 0 4

6666

END

^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11211

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

get bk1

END

get bk2

VALUE bk2 0 4

2222

END

get bk3

END

get bk4

VALUE bk4 0 4

4444

END

get bk5

END

get bk6

VALUE bk6 0 4

6666

END

^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11212

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

get bk1

VALUE bk1 0 4

1111

END

get bk2

END

get bk3

VALUE bk3 0 4

3333

END

get bk4

END

get bk5

VALUE bk5 0 4

5555

END

get bk6

END

^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# telnet 127.0.0.1 11213

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape character is '^]'.

get bk1

VALUE bk1 0 4

1111

END

get bk2

VALUE bk2 0 4

2222

END

get bk3

VALUE bk3 0 4

3333

END

get bk4

VALUE bk4 0 4

4444

END

get bk5

VALUE bk5 0 4

5555

END

get bk6

VALUE bk6 0 4

6666

END

^]

telnet> quit

Connection closed.

[root@192_168_1_81 ~]# 



日志上看bk1存储在192.168.1.80:11211上

PROCESSING COMMAND: get bk1

R KEY "bk1" -> 192.168.1.80:11211

CONNECTED FD 8 <-> 192.168.1.80:11211

关闭192.168.1.80上的11211 memcached.

PROCESSING COMMAND: get bk1

R KEY "bk1" -> 192.168.1.80:11211

TRYING BACKUP SERVER 192.168.1.81:11211

R KEY "bk1" -> 192.168.1.81:11211

CONNECTED FD 8 <-> 192.168.1.81:11211

可以看到bk1在主memcached上找不到时到备memcached上读取.

恢复192.168.1.80:11211后,magent还是去80上找,由于内存已经清空,找不取内容.

<30 get bk1

> NOT FOUND bk1

>30 END


本文出自 “倔强人生” 博客,转载请与作者联系!

你可能感兴趣的:(keepalived,LVS,memcached,magent)