corosync+pacemaker+crm+nfs
實驗環(huán)境
node1:ip:172.16.11.5 centos6.5+httpd+corosync+pacemaker+crm
node2:ip:172.16.11.6 centos6.5+httpd+corosync+pacemaker+crm
node3:ip:172.16.11.7 nfs
1、時間同步
時間同步機制??
ssh node2.www.org.com "date -s '20140914 23:12:30'";date -s '20140914 23:12:30'???
2、基于密鑰認證??
3、修改hosts??
ping測試??
ssh node1.www.org.com 'date';date
4、vim /etc/sysconfig/network
使主機名與root@xxxxx#一致????
5、軟件安裝????
yum install pacemaker -y?????
yum install pssh-2.3.1-2.el6.x86_64.rpm crmsh-1.2.6-4.el6.x86_64.rpm
server corosync restart
注意這里第一次安裝的會有熵池的東西,需要你敲鍵盤,不要意外。
6、提供配置文件???
cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf????
vim /etc/corosync/corosync.conf
# Please read the corosync.conf.5 manual page???
compatibility: whitetank
totem {???
??????? version: 2????
??????? secauth: on????
??????? threads: 0????
??????? interface {????
??????????????? ringnumber: 0????
??????????????? bindnetaddr: 172.16.0.0?? #重點就是這個是網(wǎng)段地址,不同網(wǎng)段配置不同網(wǎng)絡(luò)地址????
??????????????? mcastaddr: 226.194.21.156 #組播地址保持????
??????????????? mcastport: 5405????
??????????????? ttl: 1????
??????? }????
}
logging {???
??????? fileline: off????
??????? to_stderr: no????
??????? to_logfile: yes????
??????? to_syslog: no????
??????? 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????
}
scp /etc/corosync/corosync.cnf 172.16.11.6:/etc/corosync/
7、crm的配置使服務(wù)能夠提供httpd的高可用
crm configure
stonith-enabled=false????
no-quorum-policy=ignore
primitive webip ocf:IPaddr params ip=172.16.11.148 op monitor timeout=20s interval=60s
primitive webserver lsb:httpd op monitor timeout=20s interval=30s
primitive webserver lsb:httpd op monitor timeout=20s interval=30s
group webservice webip webserver
8、命令的基本練習(xí)???
clearstate node2
primitive webip ocf:IPaddr params ip=172.16.11.148 op monitor timeout=20s interval=60s
resource???
cleanup webserver
delect? webserver
delect webserver_with_webip
colocation webip_with_webserver inf: webip webserver
order webip_before_webserver mandatory: webip webserver
location webip_on_node2 webip inf: node2.www.org.com??????????????????????????????????????
location webip_on_node2 webip rule inf: #uname eq node2.www.org.com???
location webserver_on_node2 webserver rule -inf: #uname eq node2.www.org.com
colocation 排序? 資源在一起 建議用group來定義
order?? 順序? 先啟動那個,先關(guān)閉那個
location 位置 節(jié)點掛了,重新上線,更加傾向于那個節(jié)點,主要用在服務(wù)器性能不一致的場景中,
如果資源本身出問題啦,我們必須修改監(jiān)控時間,不然主頁是不能訪問,,它不會自動起來,節(jié)點資源httpd本身掛啦,HA節(jié)點都在好著,不定義時間監(jiān)控服務(wù)室起不來的
9、資源
資源:主資源,組資源,克隆資源,主從資源
10、節(jié)點3提供nfs???
vim/etc/exports????
/www/html?? 172.16.1.0/16(no_root_squash,root)????
service nfs restart
11、各節(jié)點測試掛載???
showmount -e 節(jié)點3的ip????
mount -t nfs 172.16.11.7:/www/html /post????
umount
12、擴展nfs共享安裝網(wǎng)頁
crm? configuer???
primitive webstore ocf:Filesystem params device="172.16.11.7:/www/html" directory="/var/www/html" fstype="nfs" op monitor interval=60 timeout=30????
group webservice webip webstore webserver?????
order webip_before_webstore_before_webservice inf: webip webstore webservice?????
show xml 查看先后順序????
網(wǎng)頁測試
crm node online #強制資源上線???
crm node standby #強制資源下線
13、全部配置
node node1.www.org.com \???
??? attributes standby="off"????
node node2.www.org.com????
primitive webip ocf:heartbeat:IPaddr \????
??? params ip="192.168.1.10" \????
??? op monitor timeout="20s" interval="60s"????
primitive webserver lsb:httpd \????
??? op monitor timeout="20s" interval="30s"????
primitive webstore ocf:heartbeat:Filesystem \????
??? params device="192.168.1.7:/www/html" directory="/var/www/html" fstype="nfs" \????
??? op monitor interval="60s" timeout="40s" \????
??? op start timeout="60s" interval="0" \????
??? op stop timeout="60s" interval="0"????
group webservice webip webstore webserver????
order webip_before_webstore_before_webservice inf: webip webstore webservice????
property $id="cib-bootstrap-options" \????
??? dc-version="1.1.10-14.el6-368c726" \????
??? cluster-infrastructure="classic openais (with plugin)" \????
??? expected-quorum-votes="2" \????
??? stonith-enabled="false" \????
??? no-quorum-policy="ignore"
轉(zhuǎn)載于:https://blog.51cto.com/1983939925/1557312
總結(jié)
以上是生活随笔為你收集整理的corosync+pacemaker+crm+nfs的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 通过Intent调用系统功能大全
- 下一篇: Nginx+tomcat配置集群