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)


[参考] 
目录
相关文章
|
移动开发 机器学习/深度学习 安全
|
存储 Oracle 关系型数据库
几种常见的数据同步方式
【6月更文挑战第18天】几种常见的数据同步方式
2015 4
|
并行计算 安全 调度
提速360倍!助力南方电网实现“仿真自由”
近日,为满足新型电力系统建设和运行面临的海量仿真需求,南方电网电力调度控制中心率先将电力仿真软件上云。在基于与阿里云共建的南网调度云平台上,仿真计算提速360倍,有效解决了传统硬件上电力仿真软件“跑不动”的问题,进一步保障电网安全稳定运行。
691 0
提速360倍!助力南方电网实现“仿真自由”
|
人工智能 关系型数据库 MySQL
如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳?(下)
阿里云智能数据库产品事业部高级产品专家德哥为大家带来如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳的介绍。 MySQL是最流行的开源数据库,PostgreSQL(PG)是最先进的开源数据库。两者结合,可以发挥1+1大于2的超级效果,解决应用原本无法解决的问题。 本议题将为您详细介绍如何将PG与MySQL结合使用,提升应用价值,以及5大业务场景和联合应用解读。
1026 0
如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳?(下)
|
SQL 并行计算 搜索推荐
如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳?(上)
阿里云智能数据库产品事业部高级产品专家德哥为大家带来如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳的介绍。 MySQL是最流行的开源数据库,PostgreSQL(PG)是最先进的开源数据库。两者结合,可以发挥1+1大于2的超级效果,解决应用原本无法解决的问题。 本议题将为您详细介绍如何将PG与MySQL结合使用,提升应用价值,以及5大业务场景和联合应用解读。
1266 0
如何将PostgreSQL与MySQL相结合,实现1+1>2的组合拳?(上)
|
3天前
|
弹性计算 人工智能 安全
云上十五年——「弹性计算十五周年」系列客户故事(第二期)
阿里云弹性计算十五年深耕,以第九代ECS g9i实例引领算力革新。携手海尔三翼鸟、小鹏汽车、微帧科技等企业,实现性能跃升与成本优化,赋能AI、物联网、智能驾驶等前沿场景,共绘云端增长新图景。
|
9天前
|
存储 弹性计算 人工智能
【2025云栖精华内容】 打造持续领先,全球覆盖的澎湃算力底座——通用计算产品发布与行业实践专场回顾
2025年9月24日,阿里云弹性计算团队多位产品、技术专家及服务器团队技术专家共同在【2025云栖大会】现场带来了《通用计算产品发布与行业实践》的专场论坛,本论坛聚焦弹性计算多款通用算力产品发布。同时,ECS云服务器安全能力、资源售卖模式、计算AI助手等用户体验关键环节也宣布升级,让用云更简单、更智能。海尔三翼鸟云服务负责人刘建锋先生作为特邀嘉宾,莅临现场分享了关于阿里云ECS g9i推动AIoT平台的场景落地实践。
【2025云栖精华内容】 打造持续领先,全球覆盖的澎湃算力底座——通用计算产品发布与行业实践专场回顾
|
8天前
|
人工智能 自然语言处理 自动驾驶
关于举办首届全国大学生“启真问智”人工智能模型&智能体大赛决赛的通知
关于举办首届全国大学生“启真问智”人工智能模型&智能体大赛决赛的通知
|
7天前
|
云安全 人工智能 自然语言处理
阿里云x硅基流动:AI安全护栏助力构建可信模型生态
阿里云AI安全护栏:大模型的“智能过滤系统”。