免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 20621 | 回复: 17
打印 上一主题 下一主题

LVS的配置详解配置 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-03-19 15:06 |只看该作者 |倒序浏览
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]ixi                                --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.        --加入服务成功

论坛徽章:
0
2 [报告]
发表于 2003-03-19 15:36 |只看该作者

LVS的配置详解配置

很好!不过早用过!
还是ding!

论坛徽章:
1
荣誉会员
日期:2011-11-23 16:44:17
3 [报告]
发表于 2003-03-19 15:37 |只看该作者

LVS的配置详解配置

好!
加入精华!

论坛徽章:
0
4 [报告]
发表于 2003-03-19 21:02 |只看该作者

LVS的配置详解配置

太好了,支持.

论坛徽章:
0
5 [报告]
发表于 2003-03-20 13:44 |只看该作者

LVS的配置详解配置

没想到linux这么强大了,好!

论坛徽章:
0
6 [报告]
发表于 2003-03-21 09:18 |只看该作者

LVS的配置详解配置

用普通版的也能做吧?听说要编译内核什么的,我就不清楚了,不过这样的文档多来几篇就好了。

论坛徽章:
0
7 [报告]
发表于 2003-03-21 09:40 |只看该作者

LVS的配置详解配置

最好介绍一下oracle、web等服务的具体应用,谢谢!

论坛徽章:
0
8 [报告]
发表于 2003-03-21 15:56 |只看该作者

LVS的配置详解配置

虽然是自己的双机软件,但比起其他第三方软件,类似ROSE、VCS等无论从监控还是配置上都没有它们成熟,例如没有ORACLE服务一级的监控能力,除非用户自己写

回答楼上的问题:下面是ORACLE的配置方法:


到目录:/usr/share/cluster/doc/services/examples/oracle,将目录下的文件copy到根下任意目录,如/zn,里面有文件oracle 、startdb、startdbi、stopdb、stopdbi文件,其中oracle为系统总配置文件,由oracle文件对其他文件进行调用,oracle文件内的内容:
cd /home/oracle
case $1 in
'start')
    su - oracle -c ./startdbi
    su - oracle -c ./startdb
    ;;
'stop')
    su - oracle -c ./stopdb
    su - oracle -c ./stopdbi                                        加上:umount /u02
    ;;
esac
可在stop最后加入umount /共享目录,由于LVS不能对已经mount的目录自动进行umount,因此需要手动加入,否则容易在应用中造成数据不一致。
首先调用的文件startdbi内记载的是oracle用户的环境变量,如果用户已经设定好可以取消该文件。
而startdb文件内记录了oracle启动的环境变量和启动脚本,如果有必要就需要对文件进行相应的修改。如oracle的安装路径。
相应的需要修改stop相关的文件,不在冗述。
然后回到cluadmin的管理界面下,键入新的服务:
cluadmin>; service add
Service name: oracle                                                                        --服务名称
Preferred member [None]: haha                                                        --首选成员
Relocate when the preferred member joins the cluster (yes/no/?) [no]:                --重新定位当新成员加入时
User script (e.g., /usr/foo/script or None) [None]: /zn/oracle                --加入oracle调用脚本
Status check interval [0]:                                                                --状态检测时间
Do you want to add an IP address to the service (yes/no/?) [no]: yes                --加入ip地址到服务
IP address: 192.168.2.13                                                                        --虚拟oracle的ip地址(此处ip地址与初始LVS时配置的地址有所不同,此地址会跟随服务进行切换,而初始的地址为固定绑定在网卡上的地址,不能随主机进行切换。)
Netmask (e.g. 255.255.255.0 or None) [None]: 255.255.255.0        --掩码
Broadcast (e.g. X.Y.Z.255 or None) [None]:                                        --广播地址
Do you want to (a)dd, (m)odify, (d)elete or (s)how an IP address, or are you (f)
inished adding IP addresses [f]:                                  --可以再加入跟随服务切换的虚拟ip地址
Do you want to add a disk device to the service (yes/no/?) [no]:yes                --加入磁盘分区设备
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]: /u02                                        --mount路径
Mount options (e.g., rw,nosuid,sync):                                                                --自动同步
Forced unmount support (yes/no/?) [yes]:                                                        是否支持强制umount
Would you like to allow NFS access to this filesystem (yes/no/?)  [no]:
Would you like to share to Windows clients (yes/no/?)  [no]:                --是否需要加入samba服务
Do you want to (a)dd, (m)odify, (d)elete or (s)how DEVICES, or are you (f)inishe
d adding DEVICES [f]:                                                                                --是否加入其他分区设备
Add oracle service as shown? (yes/no/?):yes                                                --加入oracle服务
  0) haha
  1) hehe
  c) cancel
Choose member to start service on: 0                                                        --在haha主机启动
Added oracle                                                                                                --加入成功
cluadmin>;
oracle服务双机环境配置成功,通过cluster status命令进行查看,服务已切换到hehe上:
cluadmin>; cluster status
Cluster Status Monitor (xixi)                                           14:41:37
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
  -------------- -------- -------------- ---------------- -------- -------
  oracle         started  hehe           14:39:55 Mar 19  0        0

论坛徽章:
0
9 [报告]
发表于 2003-03-21 16:46 |只看该作者

LVS的配置详解配置

谢谢楼主的关照!!!!

论坛徽章:
0
10 [报告]
发表于 2003-03-21 17:55 |只看该作者

LVS的配置详解配置

好!多谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP