AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 627006
Accepted
C-Otto
C-Otto
Asked: 2014-09-09 05:48:22 +0800 CST2014-09-09 05:48:22 +0800 CST 2014-09-09 05:48:22 +0800 CST

Centos 7 中的简单围栏/STONITH 脚本

  • 772

我正在使用 Centos 7 安装一个简单的 Corosync/pacemaker/drbd 高可用性集群,并希望使用自定义硬件(使用 USB 连接的电源开关)提供防护/STONITH。因此,我需要将这些设备作为 STONITH 资源添加到我的集群中。我可以从一个简单的虚拟脚本开始吗?我在 中找到了几个文件/usr/sbin/fence_*,但这些文件似乎是通过某种网络连接的,并且只接受预配置的选项。

centos
  • 1 1 个回答
  • 3304 Views

1 个回答

  • Voted
  1. Best Answer
    C-Otto
    2014-09-09T07:51:11+08:002014-09-09T07:51:11+08:00

    这是一个基于fence_cisco_ucs. 我不知道为什么密码字段是强制性的,我也不知道get_list应该做什么。

    例如,./script.py -o status -p x -s y给出“状态:开启”。如果get_power_status和中的功能进行了set_power_status相应的修改,则此脚本实际上可能很有用。

    #!/usr/bin/python
    
    import sys, re
    sys.path.append("/usr/share/fence")
    from fencing import *
    
    def get_power_status(conn, options):
        someoption = options["--someoption"]
    
        #status = send_command(someoption)
        status = "on"
    
        return status
    
    def set_power_status(conn, options):
        action = options["--action"]
        if action == "on":
            onoff = "1"
        else:
            onoff = "0"
    
        #send_command(onoff)
    
        return
    
    def get_list(conn, options):
        outlets = { }
    
        return outlets
    
    def define_new_opts():
        all_opt["someoption"] = {
            "getopt" : "s:",
            "longopt" : "someoption",
            "help" : "--someoption=[string]       Some option.",
            "required" : "1",
            "shortdesc" : "Some option.",
            "order" : 1 }
    
    def main():
        device_opt = [ "passwd", "someoption" ]
    
        atexit.register(atexit_handler)
    
        define_new_opts()
    
        options = check_input(device_opt, process_input(device_opt))
    
        docs = { }
        docs["shortdesc"] = "Short Description"
        docs["longdesc"] = "Longer Description"
        docs["vendorurl"] = "http://somewhere"
        show_docs(options, docs)
    
        ## Do the delay of the fence device before logging in
        ## Delay is important for two-node clusters fencing but we do not need to delay 'status' operations
        if options["--action"] in ["off", "reboot"]:
            time.sleep(int(options["--delay"]))
    
        result = fence_action(None, options, set_power_status, get_power_status, get_list)
    
        sys.exit(result)
    
    if __name__ == "__main__":
        main()
    
    • 1

相关问题

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 使用 crontab 和 /etc/cron.hourly,daily,weekly 的区别

  • 持续监控许多服务器运行状况的简单方法?

  • Hudson 无法在 tomcat5 中启动

  • CentOS 的依赖挑战

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve