亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

Chinaunix

標(biāo)題: 分享:heartbeat 2.x style的配置(使用cib.xml) [打印本頁]

作者: BLZer    時(shí)間: 2007-12-07 14:20
標(biāo)題: 分享:heartbeat 2.x style的配置(使用cib.xml)
一) 前言:

網(wǎng)上關(guān)于heartbeat的文章很多,但大部分是基于1.x style的,

我把我配置的2.x style的heartbeat 過程發(fā)出來,

希望對(duì)大家能有一點(diǎn)用,

2.x和1.x最主要的區(qū)別在于,

1) 2.x支持CRM管理,資源文件由原來的haresources變?yōu)閏ib.xml,

2) 支持OCF格式的resource agent,

3) 可以對(duì)多資源組進(jìn)行獨(dú)立監(jiān)控(這點(diǎn)我不確定在1.x里是否可以,沒試過)

4)支持多節(jié)點(diǎn)

二) 配置

本文假設(shè)原有的heartbeat 已經(jīng)配置好且能正常工作,
如和配置heartbeat不屬于本文討論范圍.

我這里以兩節(jié)點(diǎn)為例:
node1 和node2,
有兩個(gè)資源作HA,apache和jboss,
其中apache使用vip :192.168.1.205,
jboss無vip,

1)在ha.cf里面增加
        crm yes
        apiauth cibmon   uid=hacluster
        respawn hacluster /usr/local/lib/heartbeat/cibmon -d

2)將haresources資源文件轉(zhuǎn)換成cib.xml,2.x里編譯好后自帶有轉(zhuǎn)換腳本,很方便.
        假設(shè)haresources文件如下,
        node1 192.168.1.205 runhttpd.sh
        node2 runjboss.sh
        每一行表示一個(gè)資源組,
        node1,node2表示prefered node,即該資源組優(yōu)先在該node上運(yùn)行,
        192.168.1.205與runhttpd.sh一起屬于第一個(gè)資源組,為提供http服務(wù)的vip,
        啟動(dòng)的時(shí)候從左到右依次運(yùn)行腳本,關(guān)閉的時(shí)候從右到左依次關(guān)閉.
        a):轉(zhuǎn)換命令
        /usr/local/lib/heartbeat/haresources2cib.py --stout -c /usr/local/etc/ha.d/ha.cf /usr/local/etc/ha.d/haresources
        b):這一步可選
        清空/usr/local/etc/ha.d/haresources
        echo "" > /usr/local/etc/ha.d/haresources


3)
        修改heartbeat目錄權(quán)限,可以用以下命令:
        find / -type d -name "heartbeat" -exec chown -R hacluster {} \;
        find / -type d -name "heartbeat" -exec chgrp -R haclient {} \;


4)LSB格式的resource agent script中必須支持status功能
                    所謂的resource agent就是服務(wù)的啟動(dòng)腳本,這我這里叫runhttpd.sh,runjboss等,
                    必須能接收start,stop,status,三個(gè)參數(shù),如果是OCF格式agent,則必須支持
                    start,stop,monitor三個(gè)參數(shù).其中status和monitor參數(shù)是用來監(jiān)控資源的,非常重要.
        例如LSB風(fēng)格的腳本,運(yùn)行./runhttpd.sh status時(shí)候,
        返回值包含OK或則running則表示資源正常
        返回值包含stopped或者No則表示資源不正常。

        假如是OCF風(fēng)格的腳本,運(yùn)行./runhttpd.sh monitor時(shí)候,
        返回0表示資源是正常的,
        返回7表示資源出現(xiàn)問題.

三) 與1.x相比的區(qū)別

與1.x風(fēng)格相比,功能變化:

1)保留原有所有功能
        如,網(wǎng)絡(luò),heartbeat ,機(jī)器down了時(shí)候均可以切換資源。

2)自動(dòng)監(jiān)控資源
        每2分鐘檢測(cè)資源運(yùn)行情況,如果發(fā)現(xiàn)資源不在,則嘗試啟動(dòng)資源,
        如果60s后還未啟動(dòng)成功,則資源切換向另節(jié)點(diǎn)。時(shí)間可以修改。
         <primitive class="heartbeat" id="runhttpd.sh_2" provider="heartbeat" type="runhttpd.sh">
           <operations>
             <op id="runhttpd.sh_2_mon" interval="120s" name="monitor" timeout="60s"/>
           </operations>
         </primitive>
        對(duì)VIP的監(jiān)控,每5S監(jiān)控一次,若vip失效,則嘗試重啟vip,timeout時(shí)間為5s,若5s后啟動(dòng)不成功,則切換向另節(jié)點(diǎn)。
         <primitive class="ocf" id="IPaddr_192_168_1_205" provider="heartbeat" type="IPaddr">
           <operations>
             <op id="IPaddr_192_168_1_205_mon" interval="5s" name="monitor" timeout="5s"/>
           </operations>
           <instance_attributes id="IPaddr_192_168_1_205_inst_attr">
             <attributes>
               <nvpair id="IPaddr_192_168_1_205_attr_0" name="ip" value="192.168.1.205"/>
             </attributes>
           </instance_attributes>
         </primitive>

3)可以對(duì)各資源組實(shí)現(xiàn)獨(dú)立監(jiān)控.
        比如jboss運(yùn)行在node1上,apache運(yùn)行在node2上,

4)同時(shí)監(jiān)控系統(tǒng)負(fù)載
        可以自動(dòng)將資源切換到負(fù)載低的node上


四) CRM管理程序crm_resource功能示例:

Examples
1)查看所有資源

  crm_resource -L

2)查看資源跑在哪個(gè)節(jié)點(diǎn)上

  crm_resource -W -r runhttpd.sh_2

  resource runhttpd.sh_2 is running on: server1

  crm_resource -W -r runhttpd.sh_2

  resource runhttpd.sh_2 is NOT running

4)啟動(dòng)/停止資源

  crm_resource -r runhttpd.sh_2 -p target_role -v started
  crm_resource -r runhttpd.sh_2 -p target_role -v stopped

5)查看資源在cib.xml中的定義

  crm_resource -x -r runhttpd.sh_2

6)將資源從當(dāng)前節(jié)點(diǎn)移動(dòng)向另個(gè)節(jié)點(diǎn)

  crm_resource -M -r runhttpd.sh_2

7)將資源移向指定節(jié)點(diǎn)

  crm_resource -M -r runhttpd.sh_2 -H c001n02

允許資源回到正常的節(jié)點(diǎn)

  crm_resource -U -r runhttpd.sh_2

NOTE: the values of resource_stickiness and default_resource_stickiness may mean that it doesnt move back. In such cases, you should use -M to move it back and then run this command.

9)將資源從CRM中刪除

  crm_resource -D -r runhttpd.sh_2 -t primitive

10)將資源組從CRM中刪除

  crm_resource -D -r my_first_group -t group

11)將資源從CRM中禁用

  crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v off

12)將資源從新從CRM中啟用

  crm_resource -p is_managed -r runhttpd.sh_2 -t primitive -v on

13)Resetting a failed resource after having been manually cleaned up

  crm_resource -C -H c001n02 -r runhttpd.sh_2

14)檢查所有節(jié)點(diǎn)上未在CRM中的資源

  crm_resource -P

15)檢查指定節(jié)點(diǎn)上未在CRM中的資源

  crm_resource -P -H c001n02

Querying a parameter of a resource. Say the resource is the following:
<primitive id="example_mail" class="ocf" type="MailTo" provider="heartbeat">
  <instance_attributes id="example_mail_inst">
    <attributes>
      <nvpair id="example_mail_inst_attr0" name="email" value="root"/>
      <nvpair id="example_mail_inst_attr1" name="subject" value="Example Failover"/>
    </attributes>
  </instance_attributes>
</primitive>

You could query the email address using the following:
  crm_resource -r example_mail -g email

16)設(shè)置資源的某個(gè)屬性

crm_resource -r example_mail -p email -v "myemailaddress@somedomain.com"


寫的比較匆忙,有錯(cuò)誤的地方請(qǐng)指正.

歡迎轉(zhuǎn)載,修改,不需要標(biāo)明作者,不過最好請(qǐng)標(biāo)明來自CU.

參考文檔:www.linux-ha.org
作者: ljhb    時(shí)間: 2007-12-09 11:36
good ,不過有 hagui這樣的圖形界面配置工具,大家可以用這個(gè)圖形工具去配置。

另外,newstar ha是基于heartbeat,如果能放出他們的配置工具就更好了。(如果他們?cè)敢庾袷豨pl協(xié)議的話)
作者: ioiioi    時(shí)間: 2007-12-11 11:48
有沒有試過將IPaddr + drbd + Filesystem + service(apache, ftp etc.)的全部使用ocf RA的例子?我正在研究這玩意,有很多問題。最好還能用上pingd作為連接的監(jiān)控進(jìn)程。
作者: okzb    時(shí)間: 2007-12-11 12:33
好東西 謝謝分享
2樓圖形配置?
有幾臺(tái)服務(wù)器裝了圖形界面?
作者: crackpot    時(shí)間: 2007-12-20 13:34
2.x的圖形配置工具很復(fù)雜,折騰了很久
作者: mdjhaitao    時(shí)間: 2007-12-21 13:37
好東西。一定要定。目前還沒有詳細(xì)說2.X的新資源配置文件的文檔呢。
作者: johnyo    時(shí)間: 2007-12-22 22:55
對(duì)hb不熟悉,贊一個(gè)
作者: luoriddr    時(shí)間: 2008-01-14 11:17
樓主對(duì)2.0的基本配置說的不是很詳細(xì)。剛弄完了1.0的功能,正在搗騰CRM。資料不多,碰到了這篇文章真是慶幸,感謝一下。
作者: luoriddr    時(shí)間: 2008-01-23 16:43
這幾天主要在看HEARTBEAT,對(duì)樓主的文章提個(gè)疑問吧:

2)將haresources資源文件轉(zhuǎn)換成cib.xml,2.x里編譯好后自帶有轉(zhuǎn)換腳本,很方便.
        假設(shè)haresources文件如下,
        node1 192.168.1.205 runhttpd.sh
        node2 runjboss.sh
        每一行表示一個(gè)資源組,

在這一段中runhttpd.sh這個(gè)腳本,原因我不是很理解,如果針對(duì)VIP的話,其實(shí)沒必要,直接寫個(gè)node1 192.168.1.205 apache(apache的默認(rèn)啟動(dòng)腳本)即可,HEARTBEAT可以自動(dòng)增加個(gè)接口并賦予IP192.168.1.205;蛟S樓主的意思runhttpd.sh就是代表的默認(rèn)的apache的啟動(dòng)腳本,那就是我誤解了。如果不是的話還請(qǐng)樓主把這個(gè)腳本的程序內(nèi)容貼出來讓大家學(xué)習(xí)一下
作者: spren    時(shí)間: 2008-07-15 11:37
我發(fā)現(xiàn)heartbeat v2.1.3的haresource2cib.py轉(zhuǎn)換ipaddr有問題,會(huì)把nic和netmask顛倒,需要手動(dòng)修改回來
作者: zhujinzz    時(shí)間: 2008-11-07 16:29
圖形界面的可對(duì)照/usr/lib/ocf/resource.d/heartbeat/XXX meta-data來做相關(guān)配置,但是通過編輯cib.xml這個(gè)文件來配置crm_config,resources,constraints,我還是搞不明白,請(qǐng)高手指點(diǎn)




歡迎光臨 Chinaunix (http://www.72891.cn/) Powered by Discuz! X3.2