3. 开始搭建corosync

3.1 Create Corosync authkey创建双方的认证

root@filer01~# corosync-keygen   执行之后等待他的输出,一直到结束!
( Press the real keyboard instead of pressing keys in an ssh terminal. )
Copy the authkey file to the other node and change the fileaccess:
root@filer01~# scp /etc/corosync/authkey root@filer02:/etc/corosync/authkey
root@filer02~# chmod 400 /etc/corosync/authkey

3.2 创建 pcmk /etc/corosync/service.d/pcmk

root@filer01~# vi /etc/corosync/service.d/pcmk
service {# Load the Pacemaker Cluster Resource Managername: pacemakerver:  0}

3.2.1 拷贝到filer02上面

root@filer01~# scp /etc/corosync/service.d/pcmk root@filer02:/etc/corosync/service.d/pcmk

3.3 Create the corosync.conf file and change it to present your lan net ( bindnetaddr )

[root@filer01 ~]# cat /etc/corosync/corosync.conf
# Please read the corosync.conf.5 manual page
compatibility: whitetank
totem {
version: 2
secauth: off
threads: 0
interface {
ringnumber: 0
bindnetaddr: 192.168.11.0  (心跳线的广播域)
mcastaddr: 226.94.8.8   (组播地址 选取这个段的)
mcastport: 5405
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
to_syslog: yes
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
amf {
mode: disabled
}

3.3.1 拷贝一份到filer02

root@filer01~# scp /etc/corosync/corosync.conf root@filer02:/etc/corosync/corosync.conf

4.准备corosync配置

首先,我们准备重启机器,然后把以下的服务停掉随机启动,因为我们需要用corosync来控制他们
root@filer01~# chkconfig --level 2345 openfiler off
root@filer01~# chkconfig --level 2345 nfslock off
root@filer01~# chkconfig --level 2345 corosync on
俩个节点都要执行  :
root@filer02~# chkconfig --level 2345 openfiler off
root@filer02~# chkconfig --level 2345 nfslock off
root@filer02~# chkconfig --level 2345 corosync on
然后重启机器,等待....

4.1 Check if corosync started properly查看corosync是否启动正常

root@filer01~# ps auxf
root@filer01~# ps auxf
root      3480  0.0  0.8 534456  4112 ?        Ssl  19:15   0:00 corosync
root      3486  0.0  0.5  68172  2776 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/stonith
106       3487  0.0  1.0  67684  4956 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/cib
root      3488  0.0  0.4  70828  2196 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/lrmd
106       3489  0.0  0.6  68536  3096 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/attrd
106       3490  0.0  0.6  69064  3420 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/pengine
106       3491  0.0  0.7  76764  3488 ?        S    19:15   0:00  \_ /usr/lib64/heartbeat/crmd
root@filer02~# crm_mon --one-shot -V
crm_mon[3602]: 2011/03/24_19:32:07 ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined
crm_mon[3602]: 2011/03/24_19:32:07 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option
crm_mon[3602]: 2011/03/24_19:32:07 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity
============
Last updated: Thu Mar 24 19:32:07 2011
Stack: openais
Current DC: filer01 - partition with quorum
Version: 1.1.2-c6b59218ee949eebff30e837ff6f3824ed0ab86b
2 Nodes configured, 2 expected votes
0 Resources configured.
============

Online: [ filer01 filer02 ]

4.2 Configure Corosync as following配置corosync

Now before do monitor the status of starting the cluster on filer02:
root@filer02~# crm_mon

4.2.1 Howto configure corosync step by step

root@filer01~# crm configure
crm(live)configure# property stonith-enabled="false"
crm(live)configure# property no-quorum-policy="ignore"
crm(live)configure# rsc_defaults $id="rsc-options" resource-stickiness="100" 
crm(live)configure# primitive ClusterIP ocf:heartbeat:IPaddr2 params ip="192.168.10.248" (虚拟IP地址)cidr_netmask="24" op monitor interval="30s"
crm(live)configure# primitive MetaFS ocf:heartbeat:Filesystem  params device="/dev/drbd0" directory="/meta" fstype="ext3"
#crm(live)configure# primitive lvmdata ocf:heartbeat:LVM  params volgrpname="data"
crm(live)configure# primitive drbd_meta ocf:linbit:drbd params drbd_resource="meta"  op monitor interval="15s"
crm(live)configure# primitive drbd_data ocf:linbit:drbd  params drbd_resource="data"  op monitor interval="15s"
crm(live)configure# primitive openfiler lsb:openfiler
crm(live)configure# primitive iscsi lsb:iscsi-target
#crm(live)configure# primitive samba lsb:smb
#crm(live)configure# primitive nfs lsb:nfs
#crm(live)configure# primitive nfslock lsb:nfslock
crm(live)configure# group g_drbd drbd_meta drbd_data
crm(live)configure# group g_services MetaFS lvmdata openfiler ClusterIP iscsi samba nfs nfs-lock
crm(live)configure# ms ms_g_drbd g_drbd  meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
crm(live)configure# colocation c_g_services_on_g_drbd inf: g_services ms_g_drbd:Master
crm(live)configure# order o_g_servicesafter_g_drbd inf: ms_g_drbd:promote g_services:start
crm(live)configure# commit
Watch now on the monitor process how the resources all start hopefully.
root@filer01 ~# crm_mon
以上会有warn提示,但是不是报错,没有关系 

4.2.2 Troubleshooting

If you get any errors because you done commit before the end of the config, then you need to do a cleanup, as in this example:
root@filer01~# crm
crm(live)resource cleanup MetaFS

4.2.3 Verify the config

验证你的配置信息,通过输入
[root@filer01 ~]# crm configure show
node filer01
node filer02
primitive ClusterIP ocf:heartbeat:IPaddr2 \
params ip="192.168.10.248" cidr_netmask="24" \
op monitor interval="30s"
primitive MetaFS ocf:heartbeat:Filesystem \
params device="/dev/drbd0" directory="/meta" fstype="ext3"
primitive drbd_data ocf:linbit:drbd \
params drbd_resource="data" \
op monitor interval="15s"
primitive drbd_meta ocf:linbit:drbd \
params drbd_resource="meta" \
op monitor interval="15s"
primitive iscsi lsb:iscsi-target
primitive lvmdata ocf:heartbeat:LVM \
params volgrpname="data"
primitive nfs lsb:nfs
primitive nfslock lsb:nfslock
primitive openfiler lsb:openfiler
primitive samba lsb:smb
group g_drbd drbd_meta drbd_data
group g_services MetaFS lvmdata openfiler ClusterIP iscsi samba nfs nfslock
ms ms_g_drbd g_drbd \
meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"
colocation c_g_services_on_g_drbd inf: g_services ms_g_drbd:Master
order o_g_servicesafter_g_drbd inf: ms_g_drbd:promote g_services:start
property $id="cib-bootstrap-options" \
dc-version="1.1.2-c6b59218ee949eebff30e837ff6f3824ed0ab86b" \
cluster-infrastructure="openais" \
expected-quorum-votes="2" \
stonith-enabled="false" \
no-quorum-policy="ignore"
rsc_defaults $id="rsc-options" \
resource-stickiness="100"

然后你可以通过输入

crm_mon来查看状态。服务是不是正常启动
Last updated: Mon Dec 17 10:40:54 2012
Stack: openais
Current DC: filer01 - partition with quorum
Version: 1.1.2-c6b59218ee949eebff30e837ff6f3824ed0ab86b
4 Nodes configured, 2 expected votes
2 Resources configured.
============
Online: [ filer01 filer02 ]
Resource Group: g_services
MetaFS     (ocf::heartbeat:Filesystem):    Started filer01
lvmdata    (ocf::heartbeat:LVM):              Started filer01
openfiler  (lsb:openfiler):                          Started filer01
ClusterIP  (ocf::heartbeat:IPaddr2):         Started filer01
iscsi      (lsb:iscsi-target):                           Started filer01
samba      (lsb:smb):                                   Started filer01
nfs        (lsb:nfs):                                          Started filer01
nfslock    (lsb:nfslock):                                Started filer01
Master/Slave Set: ms_g_drbd
Masters: [ filer01 ]
Slaves: [ filer02 ]

转载于:https://blog.51cto.com/ygongzi/1095424

从头搭建drbd+openfiler+corosync (二)相关推荐

  1. 图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网络生成手写体数字数据(tensorflow)

    图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网络生成手写体数字数据(tensorflow) 文章目录 图像对抗生成网络 GAN学习01:从头搭建最简单的GAN网络,利用神经网 ...

  2. 从零开始用 Flask 搭建一个网站(二)

    从零开始用 Flask 搭建一个网站(一) 介绍了如何搭建 Python 环境,以及 Flask 应用基本项目结构.我们要搭建的网站是管理第三方集成的控制台,类似于 Slack. 本篇主要讲解数据如何 ...

  3. Windows server 2012 搭建×××图文教程(二)配置路由和远程访问服务

    Windows server 2012 搭建×××图文教程(一)安装×××相关服务 Windows server 2012 搭建×××图文教程(二)配置路由和远程访问服务 Windows server ...

  4. 从头搭建一个深度学习框架

    从头搭建一个深度学习框架 转自:Build a Deep Learning Framework From Scratch 代码:https://github.com/borgwang/tinynn 当 ...

  5. 手把手教从零开始在GitHub上使用Hexo搭建博客教程(二)-Hexo参数设置

    前言 前文手把手教从零开始在GitHub上使用Hexo搭建博客教程(一)-附GitHub注册及配置介绍了github注册.git相关设置以及hexo基本操作. 本文主要介绍一下hexo的常用参数设置. ...

  6. 纯手工搭建k8s集群-(二)核心模块部署

    1. 部署ETCD(主节点) 1.1 简介 kubernetes需要存储很多东西,像它本身的节点信息,组件信息,还有通过kubernetes运行的pod,deployment,service等等.都需 ...

  7. 从头搭建rpc框架_#LearnByDIY-如何从头开始创建JavaScript单元测试框架

    从头搭建rpc框架 by Alcides Queiroz 通过Alcides Queiroz #LearnByDIY-如何从头开始创建JavaScript单元测试框架 (#LearnByDIY - H ...

  8. 华为云Centos7搭建hadoop集群二:yum源替换,ssh免密处理,hadoop用户sudo

    华为云Centos7搭建hadoop集群二:yum源替换,ssh免密处理,hadoop用户sudo 新建hadoop用户并设置密码,密码不要设置为简单的123456等,我这里已经创建过了hadoop用 ...

  9. 简易个人网站的搭建--页面布局(二)

    简易个人网站的搭建–基础准备工作(一) 简易个人网站的搭建–页面布局(二) 目录 前言 一.宝塔面板创建网站 二.页面布局 html代码 CSS代码 总结 前言 在搭建网站之前,我们需要考虑几个问题. ...

最新文章

  1. Matlab与线性代数 -- 矩阵的秩
  2. java字典序列化_Java对象序列化,Serialize Java Data Object,音标,读音,翻译,英文例句,英语词典...
  3. 微信和支付宝支付模式详解及实现(.Net标准库)- OSS开源系列
  4. Linux Tensorflow2.0安装
  5. 微信小程序 文字居中
  6. Docker镜像管理
  7. Knative Serving 进阶: Knative Serving SDK
  8. 使用proc文件系统
  9. 微信小程序登录 更新中
  10. 删除oracle 连接进程,如何查看和清除oracle无用的连接进程
  11. golang 最小堆排序实现
  12. web前端项目实例网站_web前端网站性能优化方案
  13. java算术表达式求值-中缀表达式转后缀表达式
  14. vertica中sql正则表达式
  15. Mac OS 如何批量转换图片格式
  16. 移动电商平台弹性架构案例
  17. 大数据Hadoop快速入门教程
  18. Python黑科技神奇去除马赛克
  19. Spring单例模式的一次失败经历和总结
  20. 浅谈微信活码架构及其简易实现

热门文章

  1. 开源的 Snort 入侵检测系统中存在高危漏洞
  2. 惠普OMEN游戏本驱动曝内核级漏洞,影响数百万Windows 计算机
  3. 苹果紧急修复远程漏洞,影响数十亿设备
  4. 谷歌研究员发现新的 iOS 安全系统
  5. 聊聊网络安全行业这十年(2010-2019)
  6. Save as XPS in Office “12”
  7. 基于Java Bean Validation对Request参数进行校验的设计思路
  8. 爱立信携Batelco完成巴林首次5G测试
  9. Win7中的clr_optimization服务
  10. C/C++位域知识小结