Docker fence

简介:
docker的fence是通过docker服务端的api来关闭container的.
目前fence docker还没有加到epel库中, 所以在centos或rhel中使用, 需要从src编译.


wget https://kojipkgs.fedoraproject.org//packages/fence-agents/4.0.11/1.fc20/src/fence-agents-4.0.11-1.fc20.src.rpm
rpm -ivh fence-agents-4.0.11-1.fc20.src.rpm
[root@150 soft_bak]# cd ~/rpmbuild/SOURCES/
[root@150 SOURCES]# ll
total 2904
-rw-rw-r--. 1 root root  605312 Aug 27 22:04 fence-agents-4.0.11.tar.xz
[root@150 SOURCES]# tar -xvf fence-agents-4.0.11.tar.xz
[root@150 SOURCES]# cd fence-agents-4.0.11
# yum install -y libtool
# ./configure ; make ; make install

[root@150 fence-agents-4.0.11]# cd fence/agents/docker/
[root@150 docker]# ll
total 68
-r-x------ 1 root root  4608 Sep 29 15:12 fence_docker
-rw-r--r-- 1 root root  4774 Sep 29 15:12 fence_docker.8
-rw-rw-r-- 1 1000 1000  4517 Aug  6 15:35 fence_docker.py
-rw-r--r-- 1 root root 19126 Sep 29 15:12 Makefile
-rw-rw-r-- 1 1000 1000   354 Aug  6 15:35 Makefile.am
-rw-r--r-- 1 root root 18002 Sep 29 15:12 Makefile.in


还依赖fence common, 所以暂时不能使用. 可以了解一下先 : 
[root@150 docker]# ./fence_docker --help
Usage:
        fence_docker [options]
Options:
   -a, --ip=[ip]                  IP address or hostname of fencing device
   -n, --plug=[id]                Physical plug number on device, UUID or
                                        identification of machine
   -m, --method=[method]          Method to fence (onoff|cycle) (Default: onoff)
   -z, --ssl                      Use ssl connection
   -u, --ipport=[port]            TCP/UDP port to use
                                        (default 80, 443 if --ssl option is used)
   -4, --inet4-only               Forces agent to use IPv4 addresses only
   -6, --inet6-only               Forces agent to use IPv6 addresses only
   -o, --action=[action]          Action: status, reboot (default), off or on
   --tlscert                      Path to client certificate for TLS authentication
   --tlskey                       Path to client key for TLS authentication
   --tlscacert                    Path to CA certificate for TLS authentication
   -v, --verbose                  Verbose mode
   -D, --debug-file=[debugfile]   Debugging to output file
   -V, --version                  Output version information and exit
   -h, --help                     Display this help and exit
   -C, --separator=[char]         Separator for CSV created by 'list' operation
   --power-timeout=[seconds]      Test X seconds for status change after ON/OFF
   --shell-timeout=[seconds]      Wait X seconds for cmd prompt after issuing command
   --login-timeout=[seconds]      Wait X seconds for cmd prompt after login
   --power-wait=[seconds]         Wait X seconds after issuing ON/OFF
   --delay=[seconds]              Wait X seconds before fencing is started
   --retry-on=[attempts]          Count of attempts to retry power on

帮助文档 : 
[root@150 docker]# man ./fence_docker.8
FENCE_AGENT(8)                                                  FENCE_AGENT(8)

NAME
       fence_docker - Fence agent for Docker

DESCRIPTION
       fence_docker  is I/O fencing agent which can be used with the Docker Engine containers. You can use this fence-
       agent without any authentication, or you can use TLS authentication (use --ssl  option,  more  info  about  TLS
       authentication in docker: http://docs.docker.com/examples/https/).

       fence_docker  accepts  options on the command line as well as from stdin. Fenced sends parameters through stdin
       when it execs the agent. fence_docker can be run by itself with command line options.  This is useful for test-
       ing and for turning outlets on or off from scripts.

       Vendor URL: www.docker.io

PARAMETERS

       -u, --ipport=[port]
              TCP/UDP port to use for connection with device (Default Value: 80)

       -n, --plug=[id]
              Physical plug number, name of virtual machine or UUID This parameter is always required.

       -6, --inet6-only
              Forces agent to use IPv6 addresses only

       -a, --ip=[ip]
              IP Address or Hostname This parameter is always required.

       -4, --inet4-only
              Forces agent to use IPv4 addresses only

       -m, --method=[method]
              Method to fence (onoff|cycle) (Default Value: onoff)

       -z, --ssl
              SSL connection

       -o, --action=[action]
              Fencing Action (Default Value: reboot)

       --tlskey
              Path to client key (PEM format) for TLS authentication. Required if --ssl option is used.

       --tlscacert
              Path to CA certificate (PEM format) for TLS authentication. Required if --ssl option is used.

       --tlscert
              Path to client certificate (PEM format) for TLS authentication. Required if --ssl option is used.

       -v, --verbose
              Verbose mode

       -D, --debug-file=[debugfile]
              Write debug information to given file

       -V, --version
              Display version information and exit

       -h, --help
              Display help and exit

       -C, --separator=[char]
              Separator for CSV created by operation list (Default Value: ,)

       --power-wait=[seconds]
              Wait X seconds after issuing ON/OFF (Default Value: 0)

       --power-timeout=[seconds]
              Test X seconds for status change after ON/OFF (Default Value: 20)

       --delay=[seconds]
              Wait X seconds before fencing is started (Default Value: 0)
       --login-timeout=[seconds]
              Wait X seconds for cmd prompt after login (Default Value: 5)

       --shell-timeout=[seconds]
              Wait X seconds for cmd prompt after issuing command (Default Value: 3)

       --retry-on=[attempts]
              Count of attempts to retry power on (Default Value: 1)

ACTIONS

       on     Power on machine.

       off    Power off machine.

       reboot Reboot machine.

       status This returns the status of the plug/virtual machine.

       list   List available plugs with aliases/virtual machines if there is support for more then one device. Returns
              N/A otherwise.

       monitor
              Check the health of fence device

       metadata
              Display the XML metadata describing this resource.

STDIN PARAMETERS

       ipport TCP/UDP port to use for connection with device (Default Value: 80)

       port   Physical plug number, name of virtual machine or UUID This parameter is always required.

       inet6_only
              Forces agent to use IPv6 addresses only

       ipaddr IP Address or Hostname This parameter is always required.
       inet4_only
              Forces agent to use IPv4 addresses only

       method Method to fence (onoff|cycle) (Default Value: onoff)

       ssl    SSL connection

       action Fencing Action (Default Value: reboot)

       tlskey Path to client key (PEM format) for TLS authentication. Required if --ssl option is used.

       tlscacert
              Path to CA certificate (PEM format) for TLS authentication. Required if --ssl option is used.

       tlscert
              Path to client certificate (PEM format) for TLS authentication. Required if --ssl option is used.

       verbose
              Verbose mode

       debug  Write debug information to given file

       version
              Display version information and exit

       help   Display help and exit

       separator
              Separator for CSV created by operation list (Default Value: ,)

       power_wait
              Wait X seconds after issuing ON/OFF (Default Value: 0)

       power_timeout
              Test X seconds for status change after ON/OFF (Default Value: 20)

       delay  Wait X seconds before fencing is started (Default Value: 0)
       login_timeout
              Wait X seconds for cmd prompt after login (Default Value: 5)

       shell_timeout
              Wait X seconds for cmd prompt after issuing command (Default Value: 3)

       retry_on
              Count of attempts to retry power on (Default Value: 1)

fence_docker (Fence Agent)        2009-10-20                    FENCE_AGENT(8)


[参考] 
目录
相关文章
|
JavaScript 前端开发 C++
JavaScript中的function使用方法
JavaScript入门易,可深究起来,竟搞得我如此混乱,这恐怕就是弱类型语言的特点吧?写惯了C++,还真是不适应。近日在google上搜来搜去,学习了半天function、this和prototype,这就总结一下,但愿能把它们理清楚。
2357 0
|
8天前
|
缓存 人工智能 自然语言处理
我对比了8个Claude API中转站,踩了不少坑,总结给你
本文是个人开发者耗时1周实测的8大Claude中转平台横向评测,聚焦Claude Code真实体验:以加权均价(¥/M token)、内部汇率、缓存支持、模型真实性及稳定性为核心指标。
3523 20
|
20天前
|
人工智能 自然语言处理 安全
Claude Code 全攻略:命令大全 + 实战工作流(建议收藏)
本文介绍了Claude Code终端AI助手的使用指南,主要内容包括:1)常用命令如版本查看、项目启动和更新;2)三种工作模式切换及界面说明;3)核心功能指令速查表,包含初始化、压缩对话、清除历史等操作;4)详细解析了/init、/help、/clear、/compact、/memory等关键命令的使用场景和语法。文章通过丰富的界面截图和场景示例,帮助开发者快速掌握如何通过命令行和交互界面高效使用Claude Code进行项目开发,特别强调了CLAUDE.md文件作为项目知识库的核心作用。
18115 60
Claude Code 全攻略:命令大全 + 实战工作流(建议收藏)
|
1天前
|
SQL 人工智能 弹性计算
阿里云发布 Agentic NDR,威胁检测与响应进入智能体时代
欢迎前往阿里云云防火墙控制台体验!
1158 2
|
4天前
|
人工智能 JSON BI
DeepSeek V4 来了!超越 Claude Sonnet 4.5,赶紧对接 Claude Code 体验一把
JeecgBoot AI专题研究 把 Claude Code 接入 DeepSeek V4Pro 的真实体验与避坑记录 本文记录我将 Claude Code 对接 DeepSeek 最新模型(V4Pro)后的真实体验,测试了 Skills 自动化查询和积木报表 AI 建表两个场景——有惊喜,也踩
1952 8
|
16天前
|
人工智能 JavaScript Ubuntu
低成本搭建AIP自动化写作系统:Hermes保姆级使用教程,长文和逐步实操贴图
我带着怀疑的态度,深度使用了几天,聚焦微信公众号AIP自动化写作场景,写出来的几篇文章,几乎没有什么修改,至少合乎我本人的意愿,而且排版风格,也越来越完善,同样是起码过得了我自己这一关。 这个其实OpenClaw早可以实现了,但是目前我觉得最大的区别是,Hermes会自主总结提炼,并更新你的写作技能。 相信就冲这一点,就值得一试。 这篇帖子主要就Hermes部署使用,作一个非常详细的介绍,几乎一步一贴图。 关于Hermes,无论你赞成哪种声音,我希望都是你自己动手行动过,发自内心的选择!
3183 29
|
3天前
|
人工智能 缓存 BI
Claude Code + DeepSeek V4-Pro 真实评测:除了贵,没别的毛病
JeecgBoot AI专题研究 把 Claude Code 接入 DeepSeek V4Pro,跑完 Skills —— OA 审批、大屏、报表、部署 5 大实战场景后的真实体验 ![](https://oscimg.oschina.net/oscnet/up608d34aeb6bafc47f
1572 3
Claude Code + DeepSeek V4-Pro 真实评测:除了贵,没别的毛病
|
4天前
|
机器学习/深度学习 缓存 测试技术
DeepSeek-V4开源:百万上下文,Agent能力比肩顶级闭源模型
DeepSeek-V4正式开源!含V4-Pro(1.6T参数)与V4-Flash(284B参数)双版本,均支持百万token上下文。首创混合注意力架构,Agent能力、世界知识与推理性能全面领先开源模型,数学/代码评测比肩顶级闭源模型。
1757 6

热门文章

最新文章