说在前面:
这个编辑器也太霸道了,,两个浏览器,,一个不能粘贴,一个不能上图,只能保存草稿之后切换, ![t_0004.gif]()
造孽啊! 写博不易,且看且珍惜 [蜡烛]
ntp服务器配置
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
.
restrict 210.72.145.44
restrict 202.120.2.101
restrict 1.cn.pool.ntp.org
restrict 172.16.43.0 mask 255.255.255.0 nomodify
.
server 210.72.145.44
server 202.120.2.101
server 1.cn.pool.ntp.org
|
高可用概念:
采用架构冗余(2台以上机器)
底层节点信息传递(下图 Messaging/Infrashructrue 层)
计算机资源管理与协调(下图 Resource Allocation 层)与一身架构设计
高可用架构一览
![ha_cluster_components_arch.png wKioL1NSOHniJ9ZxAAH4UkK1c5M291.jpg]()
来自https://www.suse.com/Document
高可用方案
ML messaging/infrashructrue
CRM cluster resource manager
RA resource agent(resorce provider)
i) Corosync/OpenAIS [ML] + (Pacemaker,crm) [CRM]
ii) heartbeat v1 [ML] + haresource [CRM]
iii)heartbeat v2 [ML] + (crm,crmsh/hb_gui) [CRM]
iv) Cman+Corosync [ML] + Pacemaker [CRM]
# 以上方案在功能特点上没有区别,在于易用性
v) PCS + Conga + Pacemaker + Corosync
vi) PCS + Pcsd + Pacemaker + Corosync
# 以上均为全生命周期集群配置
vii) Cman + RHCS
# 重量级解决方案
实验配置
172.16.43.200 master.king.com <- 主控节点,负责配置集群,但不参与
172.16.43.1 slave1.king.com <- 集群节点1
172.16.43.2 slave2.king.com <- 集群节点2
实验过程
i) 主控节点配置
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
yum -y
install
ansible-1.5.4-1.el6.noarch.rpm
ssh
-keygen -t rsa
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave1.king.com
或
scp
~/.
ssh
/id_rsa
.pub root@172.16.43.1:
/root/
.
ssh
/authorized_keys
yum -y
install
corosync pacemaker
yum -y
install
pssh-2.3.1-2.el6.x86_64.rpm
yum -y
install
crmsh-1.2.6-4.el6.x86_64.rpm
cd
/etc/corosync
cp
corosync.conf.example corosync.conf
vim corosync.conf
totem {
version: 2
secauth: on
threads: 0
interface {
ringnumber: 0
bindnetaddr: 172.16.43.0
mcastaddr: 226.94.43.1
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile:
yes
to_syslog:
yes
logfile:
/var/log/cluster/corosync
.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}
service {
ver: 0
name: pacemaker
}
aisexec {
user: root
group: root
}
corosync-keygen
|
ii): 集群节点安装corosync + pacemaker + crmsh + pssh 及配置
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
ssh
-keygen -t rsa
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave2.king.com
ssh
-keygen -t rsa
ssh
-copy-
id
-i ~/.
ssh
/id_rsa
.pub root@slave1.king.com
.
[server]
slave1.king.com
slave2.king.com
.
ansible all -m yum -a
'name=corosync state=present'
ansible all -m yum -a
'name=pacemaker state=present'
ansible all -m copy -a
'src=./crmsh-1.2.6-4.el6.x86_64.rpm dest=/root'
ansible all -m copy -a
'src=./pssh-2.3.1-2.el6.x86_64.rpm dest=/root'
ansible all -m
command
-a
'yum -y install /root/pssh-2.3.1-2.el6.x86_64.rpm'
ansible all -m
command
-a
'yum -y install /root/crmsh-1.2.6-4.el6.x86_64.rpm'
ansible all -m copy -a
'src=/etc/corosync/authkey dest=/etc/corosync'
ansible all -m
file
-a
'path=/etc/corosync/authkey mode=400'
ansible all -m copy -a
'src=/etc/corosync/corosync.conf dest=/etc/corosync'
ansible all -m service -a
'name=corosync state=started'
ansible-doc modualname
|
iii): 配置集群资源
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
crm
crm > status
. 图1
crm(live)configure > property stonith-enabled=
false
crm(live)configure > property no-quorum-policy=ignore
. 图2
crm > help
crm(live)configure > primitive webip ocf:heartbeat:IPaddr params ip=172.16.43.88
op
monitor interval=30s timeout=20s onfail restart
crm(live)configure > primitive webfile ocf:heartbeat:Filesystem params device=
'172.16.43.200:/htdocs'
directory=
'/var/www/html'
fstype=
'nfs'
op
monitor intetval=30s timeout=20s onfail restart
crm(live)configure > primitive webhttp ocf:heartbeat:httpd
crm > status
. 图3
crm(live)configure > group webserivce webip
crm(live)configure > group webserivce webfile
crm(live)configure > group webserivce webhttp
order order_webip_webfile_webhttp mandatory: webip webfile webhttp
. 图4
|
![屏幕快照 2014-04-19 下午6.08.15.png wKioL1NSWBOxNLEDAAK0PpsT7DQ752.jpg]()
图1
![屏幕快照 2014-04-19 下午6.08.55.png wKiom1NSWD-QirOvAAJWdSp4YSw741.jpg]()
图2
![屏幕快照 2014-04-19 下午6.56.35.png wKioL1NSWBnxY0xaAAOEhI58KSI220.jpg]()
图3
![屏幕快照 2014-04-19 下午7.02.12.png wKioL1NSWBzxno6JAAOZQNgeRaY365.jpg]()
图4
iv): 测试
.图
![屏幕快照 2014-04-19 下午7.09.26.png wKioL1NSWZ-gqQiGAAVZG9yVXVk685.jpg]()
先发出来, 标记 .图 的地方正在编辑上传中....
本文转自My_King1 51CTO博客,原文链接:http://blog.51cto.com/apprentice/1398628,如需转载请自行联系原作者