虚拟机双机安装指南 联系客服

发布时间 : 星期三 文章虚拟机双机安装指南更新完毕开始阅读615d8d6c443610661ed9ad51f01dc281e53a5690

将NewStartHA的安装CD放入服务器的CDROM中, 如系统没有自动挂载CD,手动挂载CDROM # mount /dev/cdrom /mnt # cd /mnt 2. 开始安装:

# ./install

3. 输入SN。根据提示,输入光盘上的SN号。如果成功,将继续安装;否则,终止安装。 4. 选择是否安装web模块. 如果选择安装, 系统每次启动会自动加载tomcat等服务进程。

(二) 申请License

(1)将文件/etc/ha.d/lic/newstartha.key通过email发给New Start公司的产品支持。(主、备机上各有一个.key文件都要发给New Start公司) (2)New Start公司的支持人员将返回newstartha.lic文件。 (3)将收到的newstartha.lic文件放在目录/etc/ha.d/lic/中。

(4)在集群运行过程中,请不要损坏newstartha.key和newstartha.lic文件,否则集群无法正常 运行。

(5)若任何一个文件损坏,或更换硬件,请重新申请license,在确保系统日期正确后,执行下面命令重新生成key文件:

# /usr/lib/newstartha/makekey

(三) NewStartHA的配置

配置过程只需要在主节点的操作,以root用户登录主节点 1 cli(命令行界面)

NewStartHA的配置工具cli,是命令行界面,使用cli可以进行配置和应用的操作。 以下是使用cli的一些提示:

(1)输入一个属性值时,如果该属性己有旧值或默认值,直接按回车键可以选择保持旧值不变或者使用默认值。

(2)利用Tab键可以像bash shell一样自动补全命令行输入。

(3)cli对输入的属性值都进行合法性校验(本地节点或者远程节点),如果校验错误,则输出错误信息,提示重新输入。

(4)按向上箭头按钮出现上次使用过的命令。 (5)查询某个命令的作用使用 help <集群命令>。

(6)在运行cluster-stat命令时按Ctrl+C退回到cli,其它时候按Ctrl+C都会退出cli。 (7)双击Tab键或者运行help显示集群所有命令。

1.1 初始化配置

执行命令cli,初次使用,屏幕出现命令提示符如下: #cli

NewStartHA High Available System. Version 2.x, release xxxx. Copyright 2006 Guangdong NewStart Technology Service Ltd. Can not find cluster configuration file.

Please run cluster-init to initialize cluster configuration. Can not fine services configuration file.

Please run service-init to initialize services configuration.

命令摘要: 命令 cluster-init service-init 功能描述 集群的初始化配置。格式:cluster-init。 服务的初始化配置。格式:service-init。

1) cluster-init

一般情况下,该命令只用于集群的初始化配置中,一旦初始化配置完成,用户不应该去执行该命令,否则原有的配置将丢失;但是有一个例外,如果遇到节点间配置文件不一致(可能是因为人为修改配置文件所致)的情况,cli会提示用户执行该命令。该指令运行示例如下,分别有如下配置项及注释:(直接回车为选择默认选项,即选择[ ]里的内容。该配置文件在Linux上即/etc/ha.d/ha.cf。) cli:~>cluster-init

====================================== Cluster Initialization Utility

======================================

Version: 2.1 Built: Mon Dec 11 21:45:37 2006

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

WARNING: cluster-init will break the origin configuration file of the cluster.

Input node name(only need to input remote host name):SERVER2 #这里输入备节点的hostname

#下面斜体部分在第一次执行时会出现,如不出现,直接跳过继续往下配置

The authenticity of host 'SERVER2 (192.168.8.51)' can't be established. RSA key fingerprint is 64:e4:02:e0:08:5d:95:01:63:b1:b3:c4:42:20:41:40. Are you sure you want to continue connecting (yes/no)? yes #回答yes

Warning: Permanently added ' SERVER2, 192.168.8.5' (RSA) to the list of known hosts.

Password: *** #此处输入对方节点root的密码

ssh test host JS-MMSC-BILL1 ok. #如果密码正确就会得到ok的提示。

Cluster member set to: SERVER2 Input log file[/var/log/ha-log]:

How long between heartbeats(in seconds)[1]:

How long to declare heartbeat fails(in seconds)[30]:

Do you want to enable watchdog device ? (yes/no)[no]:yes

WARNING: This option will reboot your machine in special condition, ARE YOU SURE ? (yes/no)[no]:yes

Do you want to enable fork_test for watchdog ?(yes/no) (yes/no)[no]: Do you want to enable loadavg_test for watchdog ? (yes/no)[no]:yes Please input maxload value [30]: Input multicast heartbeat channel[eth0 225.0.247.152]:eth2 225.0.247.152 #这里配置的是心跳网卡

Another multicast heartbeat channel? (yes/no)[yes]: #配置另一块心跳网卡(必须要两块心跳网卡)

Input multicast heartbeat channel[eth0 225.0.174.150]:eth3 225.0.174.150 #这里配置的是心跳网卡

Another multicast heartbeat channel? (yes/no)[yes]:no #是否需要另外的串口心跳链路(虚拟机不支持串口心跳链路)

Please run service-init to initialize you services. And run cluster-start to start the HA system. cli:~>

2) service-init

准备工作:将自己写好的双机脚本“SYBASE”分别放到主、备节点的/etc/ha.d/resource.d目录下。并执行如下命令:

chmod +x /etc/ha.d/resource.d/SYBASE service-init指令运行示例如下:(该配置文件在Linux上即/etc/ha.d/haservices.xml) cli:~>service-init

====================================== Service Initialization Utility

======================================

This utility sets up the initialization information of the service in the HA sys tem.

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:SYBASE #双机需要管理的服务名称 Is it enabled?(yes/no)[yes]: Input preferred node:

Input start time out[60]: Input stop time out[60]: Input check interval[30]: Input check time out[60]: Input max error count[2]:

Restart after check result is failed?(yes/no)[no]:

Start service anyway when float IP exist?(yes/no)[no]:

====== Application ======

Input name of application[SYBASE_app]:

Input script of application[/etc/ha.d/resource.d/SYBASE]: Add another application? (yes/no)[no]:

====== PubNIC ======

Input PubNIC name[SYBASE_net_card]:

====== member ====== Node of the cluster: 0) SERVER1 1) SERVER2

Select a node: [0, 1]:0

Input network device[eth0]:bond0 #前面配置的主节点浮动IP网卡名 Add another member? (yes/no)[yes]: Node of the cluster: 0) SERVER1 1) SERVER2

Select a node: [0, 1]:1

Input network device[eth0]: bond0 #前面配置的备节点浮动IP网卡名 Add another member? (yes/no)[yes]:no Add another pubnic? (yes/no)[no]:

====== IP ======

Input IP name[SYBASE_ip]:

Input IP address:192.168.8.61 #双机工作时对外的IP(双机系统的两台机器对外部设备来就是一台机器,只通过一个IP就能访问。)

Input netmask[255.255.255.0]:255.255.255.0 #子网掩码 PubNIC of service:

0) SYBASE_net_card Select a PubNIC: [0, 0]:0

Add another IP? (yes/no)[no]:

Do you want to add a block disk? (yes/no)[no]:yes

====== BlockDisk ======

Input block disk name[SYBASE_disk]: