设为首页 收藏本站
查看: 1405|回复: 0

[经验分享] centos7 集群 corosync+pacemaker+nfs

[复制链接]

尚未签到

发表于 2018-4-24 06:33:31 | 显示全部楼层 |阅读模式
  本文没有采用红帽自带的pcs配置集群资源,而采用crm配置集群资源,各人喜好,crm相对于pcs功能更强,更易上手。
  配置集群前的准备工作:
  同步时间、主机名解析
    两节点安装: yum --y install pcs
    两节点开启服务:systemctl start pcsd    systemctl enable pcsd               
    设置hacluster密码:echo "123456" |passwd --stdin hacluster
    认证两台主机:pcs cluster auth node1 node2 -u hacluster
    设置集群:    pcs cluster setup --name myclustername node1 node2   #此时会生成/etc/corosync/corosync.onf的配置文件,修改logging字断中的日志存放方式:
                logging {
                    to_logfile:yes
                    logfile:/var/log/cluster/corosync.log
                }
    启动集群:pcs cluster start --all   或指定集群名

    验证集群状态:corosync-cfgtool -s  或 crm_verify -L -V
    检查成员关系:corosync-cmapctl   或者 # pcs status  

  此时如果是两台可能会看到关于stonith设备的warning,但是可以通过修改集群全局属性将此warning关掉。
  # pcs property set stonith-enabled=false

  下载安装crmsh来配置与管理集群资源
        下载:crmsh-2.1.4-1.1.x86_64.rpm  pssh-2.3.1-4.2.x86_64.rpm    python-pssh-2.3.1-4.2.x86_64.rpm
        安装:yum install crmsh-2.1.4-1.1.x86_64.rpm  pssh-2.3.1-4.2.x86_64.rpm    python-pssh-2.3.1-4.2.x86_64.rpm
  显示洋集群状态:crm status
        交互式:crm(live)#  configure
                   crm(live)configure# show  查看集群状态
  

  

  

  NFS集群具体操作步骤:
    1、安装(node1 and node2)
        # yum install pcs
        # yum install crmsh-2.1.4-1.1.x86_64.rpm pssh-2.3.1-4.2.x86_64.rpm python-     pssh-2.3.1-4.2.x86_64.rpm

    2、配置用户及认证(node1 and node2)
        # echo "root123" |passwd --stdin hacluster
        # pcs cluster auth node1 node2 -u hacluster

    3、安装集群(node1 or node2)
        # pcs cluster setup --name nfscluster node1 node2
        # pcs cluster start --all

    4、配置集群(node1 or node2)
        1、修改logfile
        # /etc/corosync/corosync.onf

                logging {
                    to_logfile:yes
                    logfile:/var/log/cluster/corosync.log
                }
        2、关闭stonith警告
        # pcs property set stonith-enabled=false

    5、创建 NFS资源代理(node1 or node2)
        1、创建ip资源
            localhost# crm
            crm(live)# configure
            crm(live)configure#  primitive nfsvip ocf:heartbeat:IPaddr params nic=eth0 ip=xx.xx.xx.xx
            crm(live)configure#  verify
            crm(live)configure#  commit
            crm(live)configure#  show   
            crm(live)configure#  exit

        2、创建磁盘挂载
            localhost# crm
            crm(live)# configure
            crm(live)configure#  primitive nfsdriver ocf:heartbeat:Filesystem params device=/dev/sdb1 directory=/S1/dir1 fstype=ext4
            crm(live)configure#  verify
            crm(live)configure#  commit
            crm(live)configure#  show
            crm(live)configure#  exit

        3、创建NFS服务代理
            localhost# crm
            crm(live)# configure
            crm(live)configure#  primitive nfsserver systemd:nfs-server
            crm(live)configure#  verify
            crm(live)configure#  commit
            crm(live)configure#  show
            crm(live)configure#  exit

    6、创建资源代理组(node1 or node2)
            localhost# crm
            crm(live)# configure
            crm(live)configure#  group nfsservice nfsvip nfsdriver nfsserver
            crm(live)configure#  verify
            crm(live)configure#  commit
            crm(live)configure#  show
            crm(live)configure#  exit

    7、测试(node1 or node2)
            localhost# crm
            crm(live)# node standy   置从:资源组转移至其它节点
            crm(live)# node online   恢复
  

  

  

  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-451054-1-1.html 上篇帖子: centos 64位 hadoop 完全分布式安装 下篇帖子: 点滴学习之
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表