OpenStack的高可用系统构建(2)

 

1.1.1  共同包的安装 

ntp服务器安装  

yum install ntp

vi /etc/ntp.conf

# Hosts on local network are less restricted.

#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap ←指定访问范围

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

#server 0.centos.pool.ntp.org iburst ←Internet服务器,不需要进行注释 

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

server 127.127.1.0  #local clock hacontroller1指定为自己 

fudge 127.127.1.0 stratum 10

 

service ntpd start

chkconfig ntpd on

 

安装前先停止firewall 

service iptables stop

chkconfig iptabls off

 

 

1.1.2 安装 pacemarker+corosync


1.1.2.1 安装 pacemakerとcorosync


yum install pacemaker corosync cluster-glue resource-agents

 

1.1.2.2 corosync.conf文件设定

设置/etc/corosync/corosync.conf为下面方式 

totem {

    version: 2

    secauth: off

    threads: 0

    rrp_mode: active

    clear_node_high_bit: yes

    token: 4000

    consensus: 10000

    rrp_problem_count_timeout: 3000

    interface {              ←心跳用的NIC,可以设置为多个

        ringnumber: 0

        bindnetaddr: 192.168.3.0          ← 并非内网NIC的IP,而是网络地址

        mcastaddr: 226.94.1.1

        mcastport: 5405                    ← 多个pacemaker网卡使用同样LAN,可以变更端口号。 

    }          

}

logging {

    fileline: on

    to_syslog: yes

    syslog_facility: local1

    syslog_priority: info

    debug: off

    timestamp: on

}

 

1.1.2.3 启动服务

启动Corosyncs,Pacemaker服务

service corosync start

chkconfig corosync on

service corosync start

chkconfig corosync on

 

1.1.2.4 检查通信状态

(1)corosync-cfgtool命令获得通信健康状态。

[root@hacontroller1 ~]# corosync-cfgtool -s

Printing ring status.

Local node ID 33794240

RING ID 0

        id      = 192.168.3.2

        status  = ring 0 active with no faults

[root@hacontroller2 ~]# corosync-cfgtool -s

Printing ring status.

Local node ID 50571456

RING ID 0

        id      = 192.168.3.2

        status  = ring 0 active with no faults

 

 

(2)corosync-objctl参加HA的成员一览

 [root@hacontroller1 ~]# corosync-objctl runtime.totem.pg.mrp.srp.members

runtime.totem.pg.mrp.srp.33794240.ip=r(0) ip(192.168.3.2)

runtime.totem.pg.mrp.srp.33794240.join_count=1

runtime.totem.pg.mrp.srp.33794240.status=joined

runtime.totem.pg.mrp.srp.50571456.ip=r(0) ip(192.168.3.3)

runtime.totem.pg.mrp.srp.50571456.join_count=1

runtime.totem.pg.mrp.srp.50571456.status=joined

 

到大部分不会发生大的错误。

 

1.1.2.5 pacemaker plugin

使用下面的命令来添加pacemaker plugin到corosync服务。

cat <>/etc/corosync/service.d/pcmk

service {

        # Load the Pacemaker Cluster Resource Manager

        name: pacemaker

        ver:  1

}

END

※上面的操作手册没有记载,当时如果直接启动pacemaker,就会失败,必须进行上面的设定。

1.1.2.6 启动pacemaker

(1)重新启动corosync服务,加载pacemaker服务 

[root@hacontroller2 ~]# service corosync restart

Signaling Corosync Cluster Engine (corosync) to terminate: [  OK  ]

Waiting for corosync services to unload:.                  [  OK  ]

Starting Corosync Cluster Engine (corosync):               [  OK  ]

 

(2)启动packmaker服务 

[root@hacontroller1 ~]# service pacemaker start

Starting Pacemaker Cluster Manager                         [  OK  ]

 

(3)crm_mon命令来查看pacemaker服务的状态。

Last updated: Mon Mar 11 11:08:38 2013

Last change: Mon Mar 11 11:07:16 2013 via crmd on hacontroller1

Stack: classic openais (with plugin)

Current DC: hacontroller1 - partition with quorum

Version: 1.1.10-14.el6_5.2-368c726

2 Nodes configured, 2 expected votes

0 Resources configured

 

 

Online: [ hacontroller1 hacontroller2 ]

 

1.1.2.7 pacemaker/corosync自动启动


[root@hacontroller1 ~]# chkconfig corosync on

[root@hacontroller1 ~]# chkconfig pacemaker on

 

1.1.2.8 设置集群的属性

(1)安装crmsh

pacemaker集群属性必须使用crm命令行,从pacemaker 1.1.8开始crm作为独立的项目crmsh,从下面的网址下载,安装。

wget -P /etc/yum.repos.d/ http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/RedHat_RHEL-6/network:ha-clustering:Stable.repo

yum -y install crmsh

※在手册没有相关的说明。   

 

设置pacemaker集群属性。crm configure命令,设置下面的属性。

property no-quorum-policy=ignore           \

                              pe-warn-series-max="1000"         \

                              pe-input-series-max="1000"        \

                              pe-error-series-max="1000"        \

                              cluster-recheck-interval="5min"  

※no-quorum-policy=ignore当只有两个节点时需要设置。两节点以上时不要进行设置。
※pe-warn-series-max, pe-input-series-max and pe-errorseries-max设定为1000,可以保存更多的历史纪录。
※将集群的检查期间设置为5分钟。

 

[root@hacontroller1 ~]# crm configure

crm(live)configure# property no-quorum-policy=ignore           \

>                               pe-warn-series-max="1000"         \

>                               pe-input-series-max="1000"        \

>                               pe-error-series-max="1000"        \

>                               cluster-recheck-interval="5min"

crm(live)configure#

 

到此,控制节点和网络节点所使用的pacemaker/corosysnc的安装完毕。  

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/18455/viewspace-1126155/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/18455/viewspace-1126155/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值