免费注册 查看新帖 |

Chinaunix

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

[学习分享] 手把手教你使用Newstart HA(二) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-06-08 10:06 |只看该作者 |倒序浏览
三、配置NewStart HA
整个配置过程分两步,集群初始化和服务初始化,必须按以上顺序进行操作。HA支持命令行(cli)及web两种管理工具进行配置,下面是cli工具的配置过程。
配置之前确认以下信息:
1.两台服务器的主机名称;
2.心跳和工作链路的网卡名对应并且相同,并配置好所有网卡的固定IP;
3.确定访问oracle/tomcat的浮动IP;
4.HA脚本位置;(/home/script/oracle.ps和tomcat.ps)
5.清楚磁阵挂载目录;(安装oracle时已建好,这里为/home/db)
6. 第三方IP列表:可选,建议配置3~5个IP,这些IP与工作网卡属于相同网段,注意不要配成两台服务器的IP,其作为是检测自身网络正常与否。
集群初始化,格式:cluster-init
命令行下运行cli指令,进入cli管理工具,然后运行cluster-init。在开始之前再啰嗦一下,接下来的整个集群配置过程中,粗体表示根据实际环境填写的值,斜粗体表示说明(其中回车表示推荐配置)。
  
cli:~>cluster-init
  
======================================
  
    Cluster  Initialization Utility   
  
======================================
  
This utility sets up the initialization information of  a 2-node cluster.
  
It prompts you for the following information:
  
        -  Hostname
  
        -  Information about the heartbeat channels
  
        - How  long between heartbeat
  
        - How  long to declare heartbeat fails
  
        -  Watchdog configuration
  
        - Lock  disk configuration
  
Please input cluster name:cluster_ora   自定义集群名称
  
Input the first   node name and IP:suse11-1  192.168.1.92
  
Input the second node name and IP:suse11-2 192.168.1.93  
  
How long between heartbeats(in seconds)[1]:直接回车
  
How long to declare heartbeat has broken(in  seconds)[60]:直接回车
  
Do you want to enable watchdog device ? (yes/no)[no]:直接回车
  
Please choose multicast heartbeat channel:
  
        0) eth0
  
        1) bond0
  
Select a multicast heartbeat channel [0, 1]:0
  
Another multicast heartbeat channel? (yes/no)[yes]:no
  
Do you want to add a serial heartbeat channel?  (yes/no)[yes]:直接回车
  
Input serial heartbeat channel[/dev/ttyS0]:直接回车
  
Another serial heartbeat channel? (yes/no)[yes]:no
  
Do you want to enable worklink_hb ? (yes/no)[yes]:直接回车
  
Do you want to add third-party ip list ? [recommended  3-5 ip]  (yes/no)[yes]:直接回车
  
Please input a third-party ip address:192.168.1.19
  
Another thirdpart ip address? (yes/no)[yes]:直接回车
  
Please input a third-party ip address:192.168.1.20
  
Another thirdpart ip address? (yes/no)[yes]:直接回车
  
Please input a third-party ip address:192.168.1.21
  
Another thirdpart ip address? (yes/no)[yes]:no
  
Do you want to add a lock disk(recommend) ?  (yes/no)[yes]:直接回车
  
Please input the partition name (/dev/sdb):/dev/sdb1仲裁盘
  
  
Warning:All data in /dev/sdb1 will be destroyed, sure  to format it? (yes/no)[no]:yes
  
Do you want to enable kernel panic ? (yes/no)[no]:直接回车
  
Please run service-init to initialize you  services.  
  
集群初始化完成,接下来进行服务初始化。
服务初始化,格式:service-init
这里配置两个服务,先配数据库oracle,然后配置tomcat。cli管理工具中运行service-init,进行服务初始化。
  
cli:~>service-init
  
======================================
  
    Service  Initialization Utility   
  
======================================
  
This utility sets up the initialization information of  the service in the HA system.
  
It prompts you for the following information:
  
        -  Service information
  
        -  Application resource information
  
        - Public  net work interface information
  
        -  Floating IP address information.
  
        - Block  Disk information
  
        - Mount  information
  
        - Raw  Disk information
  
Input service name:oracle   自定义服务名称racle
  
Is it enabled?(yes/no)[yes]:
  
Do you want to configure preferred node ?  (yes/no)[no]:yes
  
Please choose preferred node:
  
        0)  suse11-1
  
        1)  suse11-2
  
Select a node: [0, 1]:0
  
Input start time out[60]:直接回车
  
Input stop time out[120]:直接回车
  
Input check interval[30]:直接回车
  
Input check time out[60]:直接回车
  
Input max error count[1]:直接回车
  
Restart after check result is failed?(yes/no)[no]:直接回车
  
Start service anyway when float IP exist?(yes/no)[no]:直接回车
  
Do you want to add a application? (yes/no)[yes]:直接回车
  
====== Application ======
  
Input name of application[oracle_app_0]:直接回车
  
Input script of application
  
[/etc/ha.d/resource.d/oracle]:/home/script/oracle.ps  管控oracle脚本
  
Is resource critical?[yes]:直接回车
  
Is resource enable?[yes]:直接回车
  
Add another application? (yes/no)[no]:直接回车
  
Do you want to add a pubnic? (yes/no)[yes]:直接回车
  
====== PubNIC ======
  
Input PubNIC name[oracle_net_card_0]:直接回车
  
Is resource critical?[yes]:直接回车
  
Please choose network device:
  
        0) eth0
  
        1) bond0
  
Select a network device [0, 1]:1
  
Add another pubnic? (yes/no)[no]:直接回车
  
  
====== IP ======
  
Input IP name[oracle_ip_0]:直接回车
  
Input IP address:192.168.1.96    浮点/业务IP
  
Input netmask[255.255.255.0]:
  
PubNIC of service:
  
     0)  oracle_net_card_0     suse11-1:bond0    suse11-2:bond0
  
Select a PubNIC: [0, 0]:0
  
Is resource critical?[yes]:直接回车
  
Add another IP? (yes/no)[no]:直接回车
  
Do you want to add a raw disk? (yes/no)[no]:   直接回车
  
Do you want to add a diskmount? (yes/no)[no]:yes
  
====== diskmount ======
  
Input diskmount name[oracle_diskmount_1]:直接回车
  
Is resource critical?[yes]:直接回车
  
Is resource enable?[yes]:直接回车
  
        0) disk   普通的块设备
  
        1)  nfs    nfs设备
  
        2)  lvm    逻辑卷设备
  
        3)  cancel
  
please choose a disk type? [0, 3]:0
  
Input block disk device[/dev/hda1]:/dev/sdb2   共享数据所在设备
  
Input mountpoint:/home/db   挂载目录
  
Input type of file system[ext3]:直接回车
  
Input user[root]:oracle    挂载目录的操作用户
  
Input group[root]:oinstall   操作用户的群组
  
Input mode[755]:直接回车
  
Input options[rw]:直接回车
  
Input the quota of the device[90]:直接回车
  
do you want to stop service when the disk is  readonly?[yes]:直接回车
  
Add another diskmount? (yes/no)[no]:直接回车
  
Add another service? (yes/no)[no]:yes
  
Input service name:tomcat   自定义服务名称:tomcat
  
Is it enabled?(yes/no)[yes]:
  
Do you want to configure preferred node ?  (yes/no)[no]:yes
  
Please choose preferred node:
  
        0)  suse11-1
  
        1)  suse11-2
  
Select a node: [0, 1]:1
  
Input start time out[60]:直接回车
  
Input stop time out[120]:直接回车
  
Input check interval[30]:直接回车
  
Input check time out[60]:直接回车
  
Input max error count[1]:直接回车
  
Restart after check result is failed?(yes/no)[no]:直接回车
  
Start service anyway when float IP exist?(yes/no)[no]:直接回车
  
Do you want to add a application? (yes/no)[yes]:直接回车
  
====== Application ======
  
Input name of application[tomcat_app_0]:直接回车
  
Input script of application
  
[/etc/ha.d/resource.d/tomcat]:/home/script/tomcat.ps  管控tomcat脚本
  
Is resource critical?[yes]:直接回车
  
Is resource enable?[yes]:直接回车
  
Add another application? (yes/no)[no]:直接回车
  
Do you want to add a pubnic? (yes/no)[yes]:直接回车
  
  
====== PubNIC ======
  
Input PubNIC name[tomcat_net_card_0]:直接回车
  
Is resource critical?[yes]:直接回车
  
Please choose network device:
  
        0) eth0
  
        1) bond0
  
Select a network device [0, 1]:1
  
Add another pubnic? (yes/no)[no]:直接回车
  
====== IP ======
  
Input IP name[oracle_ip_0]:直接回车
  
Input IP address:192.168.1.97    浮点/业务IP
  
Input netmask[255.255.255.0]:
  
PubNIC of service:
  
     0)  tomcat_net_card_0    suse11-1:bond0    suse11-2:bond0
  
Select a PubNIC: [0, 0]:0
  
Is resource critical?[yes]:直接回车
  
Add another IP? (yes/no)[no]:直接回车
  
Do you want to add a raw disk? (yes/no)[no]:   直接回车
  
Do you want to add a diskmount? (yes/no)[no]:   直接回车
  
Add another service? (yes/no)[no]:   直接回车
  
Please run cluster-start to start the HA system,  
  
or run cluster-restart to restart the HA system.
  
服务初始化完成,此时集群不要启动,保持原状态,具体原因接下来说到。
HA脚本检测
前面已编写完oracle及tomcat脚本,但实际环境中仍需验证现有脚本能否完全管控应用,为此,HA提供了check-script工具作为快捷验证方法。注意操作前确认集群是停止状态,查看方式:cluster-stat。
  
cli:~>cluster-stat
  
The HA system is not running now.
  
cli:~>check-script  
  
Current service:
  
        0) name:  oracle
  
        1) name:  tomcat
  
        2)  cancel
  
Select a(n) service [0, 2]:0
  
Current Application:
  
        0)  script: /home/script/oracle.ps
  
        1)  cancel
  
Select a(n) Application [0, 1]:0
  
Begin to test resource script......
  
Start resource oracle.ps:                                       pass
  
Check resource oracle.ps when running:                          pass
  
Start resource oracle.ps when running:                          pass
  
Check resource oracle.ps when running:                          pass
  
Stop resource oracle.ps when running:                           pass
  
Check resource oracle.ps when stopped:                          pass
  
Stop resource oracle.ps when stopped:                           pass
  
Check resource oracle.ps when stopped:                          pass
  
Start resource oracle.ps:                                       pass
  
Forcedstop resource oracle.ps when running:                     pass
  
Check resource oracle.ps when stopped:                          pass
  
Forcedstop resource oracle.ps when stopped:                     pass
  
Check resource oracle.ps when stopped:                          pass
  
End to test resource
  
Oracle脚本检测通过,全pass,没问题
  
cli:~>check-script
  
Current service:
  
        0) name:  oracle
  
        1) name:  tomcat
  
        2)  cancel
  
Select a(n) service [0, 2]:1
  
Current Application:
  
        0)  script: /home/script/tomcat.ps
  
        1)  cancel
  
Select a(n) Application [0, 1]:0
  
  
Begin to test resource script......
  
Start resource tomcat.ps:                                      pass
  
Check resource tomcat.ps when running:                         pass
  
Start resource tomcat.ps when running:                         pass
  
Check resource tomcat.ps when running:                         pass
  
Stop resource tomcat.ps when running:                          pass
  
Check resource tomcat.ps when stopped:                         pass
  
Stop resource tomcat.ps when stopped:                          pass
  
Check resource tomcat.ps when stopped:                         pass
  
Start resource tomcat.ps:                                      pass
  
Forcedstop resource tomcat.ps when running:                    pass
  
Check resource tomcat.ps when stopped:                         pass
  
Forcedstop resource tomcat.ps when stopped:                    pass
  
Check resource tomcat.ps when stopped:                         pass
  
  
End to test resource
  
tomcat脚本检测通过,全pass,没问题
四、集群启动及状态查询
1、启动集群:进入cli,启动集群,指令:cluster-start
  
cli:~>cluster-start
  
[suse11-1]Starting High-Availability services:
  
Configuration file checked ok.
  
..done
  
  
Configuration file checked ok.
  
[suse11-2]Starting High-Availability services:
  
..done
  
2、集群状态查询:集群状态包括节点、心跳链路,工作链路和服务状态。进入cli,输入指令:cluster-stat(动态周期性刷新)查看。
  
cli:~>cluster-stat
  
                 Press Ctrl-C or 'Q' to exit
  
                 Date: Fri Apr 26 09:45:13 2013
  
Member                  status
  
suse11-1                 UP
  
suse11-2                 UP
  
  
WorkLink                suse11-1            suse11-2            
  
bond0                   ONLINE               ONLINE  
  
  
HeartbeatLink         suse11-1            suse11-2          status  
  
network               eth0                eth0              ONLINE
  
serial               /dev/ttyS0           /dev/ttyS0        ONLINE
  
LockDisk             /dev/sdb1            /dev/sdb1         ONLINE  
  
  
ServiceName          suse11-1            suse11-2           Enable  
  
*oracle                running             stopped            YES
  
tomcat               stoped              running            YES
  
  
状态图说明:节点(Member)状态都是”UP”(正常),工作链路(WorkLink)bond0都是”ONLINE”(正常),心跳链路(HeartbeatLink)都是”ONLINE(正常),服务oracle现运行(running)在suse11-1上, 服务tomcat现运行(running)在suse11- 2节点。

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP