一、概况与原理

 SHAPE  \* MERGEFORMAT

1)所需要的配置组件有:pacemaker+corosync+HAProxy

2)主要原理:HAProxy作为负载均衡器,将对openstack api服务的请求分发到两个镜像的控制节点上,由于openstack api服务是无状态的服务,所以不存在数据同步的问题。具体为在pacemaker中配置一个VIP,HAProxy负责监听这个VIP,将对这个VIP的请求分发到两台控制节点上,同时HAProxy本身作为pacemaker的资源实现高可用性。另外,需在openstack中修改API服务的endpoint为VIP,同时对于服务的调用地址改为VIP。

3) 目前只配置了keystone部分,其他部分情况类似。

二、pacemaker+corosync+crmsh安装

一、前提条件

node1:

(1)各节点之间主机名互相解析

uname -n

>node1.test.com

vim /etc/hosts

>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

>::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

>192.168.18.201  node1.test.com  node1

>192.168.18.202  node2.test.com  node2

ping node1

ping node2

(2).各节点之间时间同步

ntpdate 210.72.145.44

(3).各节点之间ssh互信

ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ''

ssh-copy-id -i .ssh/id_rsa.pub root@node2.test.com

node2:

(1).各节点之间主机名互相解析

uname -n

>node2.test.com

vim /etc/hosts

>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

>::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

>192.168.18.201  node1.test.com  node1

>192.168.18.202  node2.test.com  node2

ping node1

ping node2

(2).各节点之间时间同步

ntpdate 210.72.145.44

(3).各节点之间ssh互信

ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P ''

ssh-copy-id -i .ssh/id_rsa.pub root@node1.test.com

配置yum源(EPEL源)

node1:

wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

rpm -ivh epel-release-5-4.noarch.rpm

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

yum list

node2:

wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

rpm -ivh epel-release-5-4.noarch.rpm

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

yum list

关闭防火墙与SELinux

node1:

service iptables stop

vim /etc/selinux/config

># This file controls the state of SELinux on the system.

># SELINUX= can take one of these three values:

>#       enforcing - SELinux security policy is enforced.

>#       permissive - SELinux prints warnings instead of enforcing.

>#       disabled - SELinux is fully disabled.

>SELINUX=disabled

># SELINUXTYPE= type of policy in use. Possible values are:

>#       targeted - Only targeted network daemons are protected.

>#       strict - Full SELinux protection.

>SELINUXTYPE=targeted

node2:

service iptables stop

vim /etc/selinux/config

>SELINUX=disabled

>SELINUXTYPE=targeted

二、安装pacemaker+corosync+crmsh

node1+node2:

安装pacemaker+corosync

yum install -y corosync*

yum install -y pacemaker*

安装crmsh

1)crmsh官方网站

https://savannah.nongnu.org/forum/forum.php?forum_id=7672

2)crmsh下载地址

http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/

3)安装crmsh【如果缺少依赖包再安装依赖包】

rpm -ivh crmsh-1.2.6-0.rc2.2.1.x86_64.rpm

4)验证配置:

crm

三、Corosync 详细配置

node1:

修改配置文件

vim  /etc/corosync/corosync.conf

>>>

totem {

version: 2

# Time (in ms) to wait for a token  1

token: 10000

# How many token retransmits before forming a new

# configuration

token_retransmits_before_loss_const: 10

# Turn off the virtual synchrony filter

vsftype: none

# Enable encryption  2

secauth: on

# How many threads to use for encryption/decryption

threads: 0

# This specifies the redundant ring protocol, which may be

# none, active, or passive.  3

rrp_mode: active

# The following is a two-ring multicast configuration.  4

interface {

ringnumber: 1

bindnetaddr: 10.0.42.0#心跳线网段

mcastaddr: 239.255.42.2

mcastport: 5405

}

}

amf {

mode: disabled

}

service {

# Load the Pacemaker Cluster Resource Manager  5

ver:       1

name:      pacemaker

}

aisexec {

user:   root

group:  root

}

logging {

fileline: off

to_stderr: yes

to_logfile: yes

to_syslog: yes

logfile: /var/log/cluster/corosync.log #日志位置

syslog_facility: daemon

debug: off

timestamp: on

logger_subsys {

subsys: AMF

debug: off

tags: enter|leave|trace1|trace2|trace3|trace4|trace6

}

}

>>>

生成密钥文件

注:corosync生成key文件会默认调用/dev/random随机数设备,一旦系统中断的IRQS的随机数不够用,将会产生大量的等待时间,因此,为了节约时间,我们在生成key之前讲random替换成urandom,以便节约时间。

mv /dev/{random,random.bak}

ln -s /dev/urandom /dev/random

corosync-keygen

查看生成的key文件

ll

>总用量 24

>-r-------- 1 root root  128 8月  13 14:16 authkey

>-rw-r--r-- 1 root root  521 8月  13 11:11 corosync.conf

>-rw-r--r-- 1 root root  445 5月  15 05:09 corosync.conf.example

>-rw-r--r-- 1 root root 1084 5月  15 05:09 corosync.conf.example.udpu

>drwxr-xr-x 2 root root 4096 5月  15 05:09 service.d

>drwxr-xr-x 2 root root 4096 5月  15 05:09 uidgid.d

将key文件authkey与配置文件corosync.conf复制到node2上

scp -p authkey corosync.conf node2:/etc/corosync/

检查配置

node1+node2:

corosync-cfgtool -s

启动corosync

node1+node2:

service corosync start

四、pacemaker详细配置

启动pacemaker

node1+node2:

service pacemaker start

node1 or node2:

配置集群基本属性

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"    

【具体资源的配置另当别论】

OpenStack API部分高可用配置(一)的更多相关文章

  1. OpenStack API部分高可用配置(二)

    一.安装与配置HAProxy 1.调整内核参数,允许绑定VIP: vim /etc/sysctl.conf [内容] net.ipv4.ip_nonlocal_bind=1 sysctl -p 2.安 ...

  2. OpenStack中MySQL高可用配置

    采用Heartbeat+DRBD+mysql高可用方案,配置两个节点的高可用集群 l  配置各节点互相解析 gb07 gb06 l  配置各节点时间同步 gb07 [root@gb07 ~]# ntp ...

  3. Spring Cloud之踩坑01 -- Eureka高可用配置

    转载:https://blog.csdn.net/dear_Alice_moon/article/details/79373955 问题描述: 在进行Eureka高可用配置时,控制台一直出现“.... ...

  4. springCloud 之 Eureka注册中心高可用配置

    springCloud的eureka高可用配置方案思路是:几个服务中心之间相互注册,比如两个注册中心,A注册到B上,B注册到A上,如果是三个注册中心则是:A注册到BC上,B注册到AC上,C注册到AB上 ...

  5. ES数据库高可用配置

    ES高可用集群部署 1.ES高可用架构图 2.创建ES用户组 1.Elasticsearch不能在 root 用户下启动,我们需要在三台机器上分创建一个普通用户# 创建elastic用户 userad ...

  6. MariaDB+Keepalived双主高可用配置MySQL-HA

    利用keepalived构建高可用MySQL-HA,保证两台MySQL数据的一致性,然后用keepalived实现虚拟VIP,通过keepalived自带的服务监控功能来实现MySQL故障时自动切换. ...

  7. ResourceManager高可用配置

    ResourceManager高可用配置 1. yarn-site.xml配置 <property> <name>yarn.resourcemanager.cluster-id ...

  8. Redis Sentinel实现高可用配置

    一般情况下yum安装redis的启动目录在:”/usr/sbin” :配置目录在”/etc/redis/”在其目录下会有默认的redis.conf和redis-sentinel.conf redis高 ...

  9. Flume 高可用配置案例+load balance负载均衡+ 案例:日志的采集及汇总

    高可用配置案例 (一).failover故障转移 在完成单点的Flume NG搭建后,下面我们搭建一个高可用的Flume NG集群,架构图如下所示: (1)节点分配 Flume的Agent和Colle ...

随机推荐

  1. xgboost学习与总结

    最近在研究xgboost,把一些xgboost的知识总结一下.这里只是把相关资源作总结,原创的东西不多. 原理 xgboost的原理首先看xgboost的作者陈天奇的ppt 英文不太好的同学可以看看这 ...

  2. 微信小程序之生命周期

    1. 整个小程序生命周期 App({}) //app.js App({ onLaunch: function (options) { // 小程序初始化完成时(全局只触发一次) // 程序销毁(过一段 ...

  3. 设计模式 笔记 观察者模式 Observer

    //---------------------------15/04/27---------------------------- //Observer 观察者模式----对象行为型模式 /* 1:意 ...

  4. 杂谈---小故事小道理,面试中的小技巧(NO.2)

    本篇是接着上一篇面试随笔的,上一次有猿友反应写的有些“扯淡”,LZ思来想去最大的原因可能是由于上一章写的全是一些大忌,既然是大忌,那么在现实当中发生的概率还是相对较小的,大部分人还是很少在面试中犯如此 ...

  5. saltstack-----master迁移篇

    打包/etc/salt/下的pki文件夹.发送到新的master,然后更改minion的hosts,重启minion,最后重启新master..搞定(salt "*" servic ...

  6. java算法面试题

    前言:线上面试题与大家分享,并记录求职道路的酸甜苦辣,特此留念. 李雷和韩梅梅坐前后排,上课想说话怕被老师发现,所以改为传小纸条.为了不被老师发现他们纸条上说的是啥,他们约定了如下方法传递信息:将26 ...

  7. 每日scrum(2)

    今天是冲刺的第二天,小组主要做了界面的美化,加入了软件的开始动画,以及学校景点的美图介绍: 主要的问题在于除了开始界面,进入软件之后还是有待改进,功能的呈现有待加强. 任务看板: 燃尽图: 会议照片:

  8. bing背单词交互流程 - Chongyang Bai

    昨天和travis,钟秋开会确认了bing背单词的手机界面交互流程.我在这里简单描述一下,设计页面暂时不能贴出来,期待大家的宝贵意见 b( ̄▽ ̄)d. 单词本浏览界面:单词本被分为两类,用户单词本和单 ...

  9. 编码用命令行执行的C语言词语统计程序

    需求介绍 程序处理用户需求的模式为: wc.exe [parameter][filename] 在[parameter]中,用户通过输入参数与程序交互,需实现的功能如下: 1.基本功能 支持 -c   ...

  10. 『编程题全队』Alpha阶段发布说明

    1. 这一版本的功能 (1)管理个人的任务事项,管理用户的提醒事项,提供一个简洁的操作界面,将其分类为全部.今天.明日.最近七天.更远.还有已完成,方便用户进行事务管理和整理. (2)提供一个便捷的备 ...