歡迎您光臨本站 註冊首頁

RHCS中腳本運行,有問題,請指導!

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

RHCS中腳本運行,有問題,請指導!

# more /etc/cluster/cluster.conf
<?xml version="1.0" ?>
<cluster config_version="5" name="lvsdr">
        <fence_daemon post_fail_delay="0" post_join_delay="3"/>
        <clusternodes>
                <clusternode name="vm001" votes="1">
                        <fence>
                                <method name="1">
                                        <device name="manual" nodename="vm001"/>
                                </method>
                        </fence>
                </clusternode>
                <clusternode name="vm002" votes="1">
                        <fence>
                                <method name="1">
                                        <device name="manual" nodename="vm002"/>
                                </method>
                        </fence>
                </clusternode>
        </clusternodes>
        <cman expected_votes="1" two_node="1"/>
        <fencedevices>
                <fencedevice agent="fence_manual" name="manual"/>
        </fencedevices>
        <rm>
                <failoverdomains>
                        <failoverdomain name="lvs" ordered="1" restricted="1"/>
                </failoverdomains>
                <resources>
                        <script file="/etc/rc.d/init.d/lvsDR " name="lvsDR"/>
                </resources>
                <service autostart="1" domain="lvs" name="lvsdr">
                        <script ref="lvsDR"/>
                </service>
        </rm>
</cluster>




# more /etc/rc.d/init.d/lvsDR
te in 20060812 by ghb
# description: start LVS   of  Directorserver
VIP=192.168.28.10
vm001=192.168.28.1
vm002=192.168.28.2
GW=192.168.28.254

. /etc/rc.d/init.d/functions

case "$1" in
    start)
        echo " start LVS  of DirectorServer"
       # set the Virtual  IP Address
       /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
       /sbin/route add -host $VIP dev eth0:0
       #Clear IPVS table
       /sbin/ipvsadm -C
      #set LVS
      /sbin/ipvsadm -A -t $VIP:80 -s rr  
      /sbin/ipvsadm -a -t $VIP:80 -r $vm001:80 -g
      /sbin/ipvsadm -a -t $VIP:80 -r $vm002:80 -g
      #Run LVS
      /sbin/ipvsadm
      #end

         ;;
    stop)
        echo "close LVS Directorserver"
        /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 down
        /sbin/ipvsadm -C
         ;;

     restart)
          echo "close LVS Directorserver"
        /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 down
        /sbin/ipvsadm -C
        
                echo " start LVS  of DirectorServer"
       # set the Virtual  IP Address
       /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
       /sbin/route add -host $VIP dev eth0:0
       #Clear IPVS table
       /sbin/ipvsadm -C
      #set LVS
      /sbin/ipvsadm -A -t $VIP:80 -s rr  
      /sbin/ipvsadm -a -t $VIP:80 -r $vm001:80 -g
      /sbin/ipvsadm -a -t $VIP:80 -r $vm002:80 -g
      #Run LVS
      /sbin/ipvsadm
              ;;


    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac
幫我看看這個腳本,問題出在什麼地方?


在日誌裡面有相關的錯誤信息,是不是lvsDR腳本有問題:
# tail -100 messages
Aug  2 16:00:10 vm001 network: Bringing up interface eth1:  succeeded
Aug  2 16:00:14 vm001 ccsd: Starting ccsd 1.0.10:
Aug  2 16:00:14 vm001 ccsd:  Built: Mar 19 2007 17:44:26
Aug  2 16:00:14 vm001 ccsd:  Copyright (C) Red Hat, Inc.  2004  All rights reserved.
Aug  2 16:00:14 vm001 ccsd:  succeeded
Aug  2 16:00:14 vm001 kernel: CMAN 2.6.9-50.2 (built Apr 24 2007 12:03:14) installed
Aug  2 16:00:14 vm001 kernel: NET: Registered protocol family 30
Aug  2 16:00:15 vm001 kernel: DLM 2.6.9-46.16 (built Apr 24 2007 12:27:20) installed
Aug  2 16:00:15 vm001 ccsd: cluster.conf (cluster name = lvsdr, version = 5) found.
Aug  2 16:00:26 vm001 kernel: CMAN: Waiting to join or form a Linux-cluster
Aug  2 16:00:26 vm001 ccsd: Connected to cluster infrastruture via: CMAN/SM Plugin v1.1.7.4
Aug  2 16:00:26 vm001 ccsd: Initial status:: Inquorate
Aug  2 16:00:44 vm001 kernel: CMAN: sending membership request
Aug  2 16:00:44 vm001 kernel: CMAN: sending membership request
Aug  2 16:00:44 vm001 kernel: CMAN: got node vm002
Aug  2 16:00:44 vm001 kernel: CMAN: quorum regained, resuming activity
Aug  2 16:00:44 vm001 ccsd: Cluster is quorate.  Allowing connections.
Aug  2 16:00:44 vm001 cman: startup succeeded
Aug  2 16:00:45 vm001 lock_gulmd: no <gulm> section detected in /etc/cluster/cluster.conf succeeded
Aug  2 16:00:46 vm001 fenced: startup succeeded
Aug  2 16:00:46 vm001 netfs: Mounting other filesystems:  succeeded
Aug  2 16:00:47 vm001 kernel: i2c /dev entries driver
Aug  2 16:00:47 vm001 rc: Starting lm_sensors:  succeeded
Aug  2 16:00:47 vm001 autofs: automount startup succeeded
Aug  2 16:00:48 vm001 acpid: acpid startup succeeded
Aug  2 16:00:50 vm001 kernel: parport0: PC-style at 0x378
Aug  2 16:00:51 vm001 kernel: lp0: using parport0 (polling).
Aug  2 16:00:51 vm001 kernel: lp0: console ready
Aug  2 16:00:51 vm001 cups: cupsd startup succeeded
Aug  2 16:00:52 vm001 sshd:  succeeded
Aug  2 16:00:52 vm001 xinetd: xinetd startup succeeded
Aug  2 16:00:52 vm001 gpm: *** info :
Aug  2 16:00:52 vm001 gpm: Started gpm successfully. Entered daemon mode.
Aug  2 16:00:52 vm001 gpm: *** info :
Aug  2 16:00:52 vm001 gpm: imps2: Auto-detected intellimouse PS/2
Aug  2 16:00:52 vm001 xinetd: xinetd Version 2.3.13 started with libwrap loadavg options compiled in.
Aug  2 16:00:52 vm001 xinetd: Started working: 0 available services
Aug  2 16:00:53 vm001 gpm: gpm startup succeeded
Aug  2 16:00:53 vm001 iiim: htt startup succeeded
Aug  2 16:00:54 vm001 crond: crond startup succeeded
Aug  2 16:00:55 vm001 htt_server: started.
Aug  2 16:00:56 vm001 xfs: xfs startup succeeded
Aug  2 16:00:56 vm001 anacron: anacron startup succeeded
Aug  2 16:00:56 vm001 atd: atd startup succeeded
Aug  2 16:00:57 vm001 readahead: Starting background readahead:
Aug  2 16:00:57 vm001 rc: Starting readahead:  succeeded
Aug  2 16:00:59 vm001 messagebus: messagebus startup succeeded
Aug  2 16:00:59 vm001 cups-config-daemon: cups-config-daemon startup succeeded
Aug  2 16:01:00 vm001 haldaemon: haldaemon startup succeeded
Aug  2 16:01:01 vm001 modclusterd: Setting verbosity level to LogBasic
Aug  2 16:01:01 vm001 modclusterd: modclusterd startup succeeded
Aug  2 16:01:01 vm001 modclusterd: startup succeeded
Aug  2 16:01:02 vm001 clurgmgrd: <notice> Resource Group Manager Starting
Aug  2 16:01:02 vm001 clurgmgrd: <info> Loading Service Data
Aug  2 16:01:03 vm001 fstab-sync: removed all generated mount points
Aug  2 16:01:08 vm001 fstab-sync: added mount point /media/cdrom for /dev/hdc
Aug  2 16:01:09 vm001 clurgmgrd: <info> Initializing Services
Aug  2 16:01:10 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)
Aug  2 16:01:10 vm001 clurgmgrd: <info> Services Initialized
Aug  2 16:01:10 vm001 clurgmgrd: <info> Logged in SG "usrm::manager"
Aug  2 16:01:10 vm001 clurgmgrd: <info> Magma Event: Membership Change
Aug  2 16:01:10 vm001 clurgmgrd: <info> State change: Local UP
Aug  2 16:01:10 vm001 rgmanager: clurgmgrd startup succeeded
Aug  2 16:01:10 vm001 fstab-sync: added mount point /media/floppy for /dev/fd0
Aug  2 16:01:11 vm001 oddjobd: oddjobd startup succeeded
Aug  2 16:01:11 vm001 oddjobd: oddjobd startup succeeded
Aug  2 16:01:12 vm001 saslauthd: saslauthd startup succeeded
Aug  2 16:01:12 vm001 saslauthd: detach_tty      : master pid is: 3418
Aug  2 16:01:12 vm001 saslauthd: ipc_init        : listening on socket: /var/run/saslauthd/mux
Aug  2 16:01:13 vm001 ricci: ricci startup succeeded
Aug  2 16:01:13 vm001 ricci: startup succeeded
Aug  2 16:01:20 vm001 clurgmgrd: <info> Magma Event: Membership Change
Aug  2 16:01:20 vm001 clurgmgrd: <info> State change: vm002 UP
Aug  2 16:01:34 vm001 kernel: mtrr: your processor doesn't support write-combining
Aug  2 16:11:14 vm001 sshd(pam_unix): session opened for user root by root(uid=0)
Aug  2 16:11:53 vm001 gconfd (root-5287): starting (version 2.8.1), pid 5287 user 'root'
Aug  2 16:11:54 vm001 gconfd (root-5287): Resolved address "xml:readonly:/etc/gconf/gconf.xml.mandatory" to a read-only configuration source at position 0
Aug  2 16:11:54 vm001 gconfd (root-5287): Resolved address "xml:readwrite:/root/.gconf" to a writable configuration source at position 1
Aug  2 16:11:54 vm001 gconfd (root-5287): Resolved address "xml:readonly:/etc/gconf/gconf.xml.defaults" to a read-only configuration source at position 2
Aug  2 16:12:47 vm001 clurgmgrd: <notice> Starting stopped service lvsdr
Aug  2 16:12:48 vm001 clurgmgrd: <notice> start on script:lvsDR returned 5 (program not installed)
Aug  2 16:12:48 vm001 clurgmgrd: <warning> #68: Failed to start lvsdr; return value: 1
Aug  2 16:12:48 vm001 clurgmgrd: <notice> Stopping service lvsdr
Aug  2 16:12:48 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)
Aug  2 16:12:48 vm001 clurgmgrd: <notice> Service lvsdr is recovering
Aug  2 16:12:49 vm001 clurgmgrd: <warning> #71: Relocating failed service lvsdr
Aug  2 16:12:49 vm001 clurgmgrd: <warning> #70: Attempting to restart service lvsdr locally.
Aug  2 16:12:49 vm001 clurgmgrd: <notice> Recovering failed service lvsdr
Aug  2 16:12:49 vm001 clurgmgrd: <notice> start on script:lvsDR returned 5 (program not installed)
Aug  2 16:12:49 vm001 clurgmgrd: <warning> #68: Failed to start lvsdr; return value: 1
Aug  2 16:12:49 vm001 clurgmgrd: <notice> Stopping service lvsdr
Aug  2 16:12:49 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)
Aug  2 16:12:49 vm001 clurgmgrd: <notice> Service lvsdr is stopped
Aug  2 16:13:52 vm001 clurgmgrd: <notice> Stopping service lvsdr
Aug  2 16:13:53 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)
Aug  2 16:13:53 vm001 clurgmgrd: <notice> Service lvsdr is disabled
Aug  2 16:16:48 vm001 clurgmgrd: <notice> Disabling disabled service lvsdr
Aug  2 16:16:48 vm001 clurgmgrd: <notice> Stopping service lvsdr
Aug  2 16:16:48 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)
Aug  2 16:16:48 vm001 clurgmgrd: <notice> Service lvsdr is disabled
腳本
《解決方案》

明天幫你看一下,我也不敢肯定能找到原因.
《解決方案》

我測試一下用http服務。
# more /etc/cluster/cluster.conf
<?xml version="1.0" ?>
<cluster alias="lvsclu" config_version="3" name="new_cluster">
        <fence_daemon post_fail_delay="0" post_join_delay="3"/>
        <clusternodes>
                <clusternode name="vm001" votes="1">
                        <fence>
                                <method name="1">
                                        <device name="fencemanual" nodename="vm001"/>
                                </method>
                        </fence>
                </clusternode>
                <clusternode name="vm002" votes="1">
                        <fence>
                                <method name="1">
                                        <device name="fencemanual" nodename="vm002"/>
                                </method>
                        </fence>
                </clusternode>
        </clusternodes>
        <cman expected_votes="1" two_node="1"/>
        <fencedevices>
                <fencedevice agent="fence_manual" name="fencemanual"/>
        </fencedevices>
        <rm>
                <failoverdomains>
                        <failoverdomain name="lvsdomain" ordered="1" restricted="1">
                                <failoverdomainnode name="vm001" priority="1"/>
                                <failoverdomainnode name="vm002" priority="2"/>
                        </failoverdomain>
                </failoverdomains>
                <resources>
                        <ip address="192.168.28.3" monitor_link="1"/>
                        <script file="/etc/rc.d/init.d/httpd" name="httpdscript"/>
                </resources>
                <service autostart="1" domain="lvsdomain" name="httpdservices">
                        <ip ref="192.168.28.3">
                                <script ref="httpdscript"/>
                        </ip>
                </service>
        </rm>
</cluster>

發現http服務,可以做成HA,現在可以初步判斷是lvsDR腳本的問題!
《解決方案》

看不出什麼問題來。..
《解決方案》


Aug  2 16:01:09 vm001 clurgmgrd: <info> Initializing Services
Aug  2 16:01:10 vm001 clurgmgrd: <notice> stop on script:lvsDR returned 5 (program not installed)


Aug  2 16:12:47 vm001 clurgmgrd: <notice> Starting stopped service lvsdr
Aug  2 16:12:48 vm001 clurgmgrd: <notice> start on script:lvsDR returned 5 (program not installed)

肯定是你的一些軟體包沒裝(用於 LVS 的)。

類試的情況,比如,配置了 HTTPD 服務的 HA,但是 httpd 沒有裝。。。
《解決方案》

呵呵,包都已經裝好了,我在兩台機器,可以起httpd服務的HA。
是想用LVS腳本進行HA。
《解決方案》

猜測:
  由於啟動腳本中無status選項,HA軟體無法獲得當前應用的狀態
《解決方案》

stop最後一定要加上一行 exit 0

[火星人 ] RHCS中腳本運行,有問題,請指導!已經有965次圍觀

http://coctec.com/docs/service/show-post-8103.html