Linux教程網
LVS的配置詳解配置
2004-04-23 15:18 pm來自:Linux文檔
現載:Www.8s8s.coM
地址:無名
Red Hat Cluster Manager
安裝操作系統,選擇組件advance server,安裝LVS部分。
兩台主機,主機名為haha和hehe
主機haha的本地ip地址為net0:192.168.2.11,net1:192.168.2.14
主機hehe的本地ip地址為net0:192.168.2.12,net1:192.168.2.16
(主機網絡連線只能用直連線進行連接,不能用交叉線連接,否則雙機不能進行監控)
修改/etc/hosts文件,封掉localhost行的內容,寫入本地主機、對方主機和虛擬主機相應的ip地址和主機名:(兩台主機配置相同)
192.168.2.11 haha
192.168.2.12 hehe
192.168.2.13 xixi
進入/etc/sysconfig/rawdevices文件,增加兩行內容:(兩台主機設置相同)
/dev/raw/raw1 /dev/sdb1
/dev/raw/raw2 /dev/sdb2
以上兩行是LVS需要的兩個裸設備作為系統監控使用,每個裸設備的空間不能小於10M。當然需要fdisk建立兩個兩個相應的設備。
然後從起主機,進入/sbin下,./cluconfig進行cluster的配置:
Red Hat Cluster Manager Configuration Utility (running on haha) --haha為本地主機名
Enter cluster name [Red Hat Cluster Manager]:xixi --xixi為虛擬主機名
Enter IP address for cluster alias [NONE]:192.168.2.13 --地址為虛擬地址
--------------------------------
Information for Cluster Member 0
--------------------------------
Enter name of cluster member [haha]: --本地成員,回車即可
Enter number of heartbeat channels (minimum = 1) [1]: 2 --兩塊網卡心跳線(也可串口心跳)
Channel type: net or serial [net]: --第一塊網卡做心跳
Enter hostname of the cluster member on heartbeat channel 0 [haha]: --心跳線成員名稱
Channel type: net or serial [net]: --第二塊網卡做心跳線
Enter hostname of the cluster member on heartbeat channel 1:hehe --另外一個成員名稱
Information about Quorum Partitions
Enter Primary Quorum Partition [/dev/raw/raw1]:
Enter Shadow Quorum Partition [/dev/raw/raw2]:
Information About the Power Switch That Power Cycles Member 'haha'
Choose one of the following power switches:
o NONE
o RPS10
o BAYTECH
o APCSERIAL
o APCMASTER
o WTI_NPS
o SW_WATCHDOG
Power switch [NONE]:
--------------------------------
Information for Cluster Member 1
--------------------------------
Enter name of cluster member:hehe --對方成員名
Enter hostname of the cluster member on heartbeat channel 0: hehe
Enter hostname of the cluster member on heartbeat channel 1: haha
Information about Quorum Partitions
Enter Primary Quorum Partition [/dev/raw/raw1]:
Enter Shadow Quorum Partition [/dev/raw/raw2]:
Information About the Power Switch That Power Cycles Member 'hehe'
Choose one of the following power switches:
o NONE
o RPS10
o BAYTECH
o APCSERIAL
o APCMASTER
o WTI_NPS
o SW_WATCHDOG
Power switch [NONE]:
Save the cluster member information? yes/no [yes]: --對配置信息進行保存
Save the cluster member information? yes/no [yes]:
Writing to configuration file...done
Configuration information has been saved to /etc/cluster.conf.
----------------------------
Setting up Quorum Partitions
----------------------------
Running cludiskutil -I to initialize the quorum partitions: done
Saving configuration information to quorum partitions: done
Do you wish to allow remote monitoring of the cluster? yes/no [yes]: --是否允許遠程主機進行cluster監視訪問
Configuration on this member is complete.
To configure the next member, invoke the following command on that system:
# /sbin/cluconfig --init=/dev/raw/raw1
Refer to the Red Hat Cluster Manager Installation and Administration Guide
for details.
本地主機配置完成
進入對方主機的/sbin目錄,執行cluconfig –init=/dev/raw/raw1顯示信息如下:
Information about Channel 0
/sbin/cluconfig: [: haha: unary operator expected
Looking for host haha (may take a few seconds)...
Information about Channel 1
/sbin/cluconfig: [: hehe: unary operator expected
Looking for host hehe (may take a few seconds)...
Information about Quorum Partitions
Information About the Power Switch That Power Cycles Member 'haha'
Note: Operating a cluster without a remote power switch does not pr
maximum data integrity guarantees.
--------------------------------
Information for Cluster Member 1
--------------------------------
/sbin/cluconfig: [: hehe: unary operator expected
Looking for host hehe (may take a few seconds)...
Information about Channel 0
/sbin/cluconfig: [: hehe: unary operator expected
Looking for host hehe (may take a few seconds)...
Information about Channel 1
/sbin/cluconfig: [: haha: unary operator expected
Looking for host haha (may take a few seconds)...
Hostname does not map to any interface. Keep your selection? [yes]:
Information about Quorum Partitions
Information About the Power Switch That Power Cycles Member 'hehe'
Note: Operating a cluster without a remote power switch does not provide
maximum data integrity guarantees.
Press <Return> to continue. --按回車繼續
Cluster name: xixi
Cluster alias IP address: 192.168.2.13
--------------------
Member 0 Information
--------------------
Name: haha
Primary quorum partition: /dev/raw/raw1
Shadow quorum partition: /dev/raw/raw2
Heartbeat channels: 2
Channel type: net, Name: haha
Channel type: net, Name: hehe
Power switch IP address or hostname: haha
Identifier on power controller for member haha: un
--------------------
Member 1 Information
--------------------
Name: hehe
Primary quorum partition: /dev/raw/raw1
Shadow quorum partition: /dev/raw/raw2
Heartbeat channels: 2
Channel type: net, Name: hehe
Channel type: net, Name: haha
Power switch IP address or hostname: hehe
Identifier on power controller for member hehe: un
--------------------------
Power Switch 0 Information
--------------------------
Power switch IP address or hostname: haha
Type: NONE
Login or port: unused
Password: unused
--------------------------
Power Switch 1 Information
--------------------------
Power switch IP address or hostname: hehe
Type: NONE
Login or port: unused
Password: unused
Save the cluster member information? yes/no [yes]: --是否進行保存
Writing to configuration file...done
Configuration information has been saved to /etc/cluster.conf.
Saving configuration information to quorum partitions: done
Do you wish to allow remote monitoring of the cluster? yes/no [yes]:
----------------------------------------------------------------
Configuration on this member is complete.
Execute "/sbin/service cluster start" to start the cluster software.
這時,雙機軟件基本配置已經完成,在兩台主機上分別運行service cluster start啟動服務
通過cluadmin進行管理,如下所示:
cluadmin> cluster status
Cluster Status Monitor (xixi) 11:16:11
Cluster alias: xixi
========================= M e m b e r S t a t u s ==========================
Member Status Node Id Power Switch
-------------- ---------- ---------- ------------
haha Up 0 Good
hehe Up 1 Good
========================= H e a r t b e a t S t a t u s ====================
Name Type Status
------------------------------ ---------- ------------
haha <--> hehe network ONLINE
========================= S e r v i c e S t a t u s ========================
Last Monitor Restart
Service Status Owner Transition Interval Count
-------------- -------- -------------- ---------------- -------- -------
cluadmin>
通過狀態可以看到雙機狀態正常,但未加入任何服務,通過help可以看到幫助:
cluadmin> help
cluster service apropos clear help version exit quit
cluadmin> service add --加入一個服務
Service name: disk --服務名稱
Preferred member [None]:haha --首選成員
User script (e.g., /usr/foo/script or None) [None]: --用戶腳本
Status check interval [0]: --狀態檢測間隔
Do you want to add an IP address to the service (yes/no/?) [no]:
Do you want to add a disk device to the service (yes/no/?) [no]: yes --加disk設備
Disk Device Information
Device special file (e.g., /dev/sdb4): /dev/sdb3 --設備名稱
Filesystem type (e.g., ext2, or ext3): ext2 --文件系統類型
Mount point (e.g., /usr/mnt/service1) [None]: /mnt --mount點
Mount options (e.g., rw,nosuid,sync):
Forced unmount support (yes/no/?) [yes]: --是否強制unmount
Would you like to allow NFS access to this filesystem (yes/no/?) [no]:
Would you like to share to Windows clients (yes/no/?) [no]:
Do you want to (a)dd, (m)odify, (d)elete or (s)how DEVICES, or are you (f)inishe
d adding DEVICES [f]:
Add disk service as shown? (yes/no/?) yes --是否加入服務
0) haha
1) hehe
c) cancel
Choose member to start service on: 0 --在首選哪台主機啟動
Added disk. --加入服務成功
Copyright ©
Linux教程網 All Rights Reserved