多节点OpenStack Charms 部署指南0.0.1.dev223--28--Command run

56 篇文章 4 订阅
55 篇文章 1 订阅

目录:
第一节 多节点OpenStack Charms 部署指南0.0.1.dev223–1--OpenStack Charms 部署指南
第二节 多节点OpenStack Charms 部署指南0.0.1.dev223–2-安装MAAS

第三节 多节点OpenStack Charms 部署指南0.0.1.dev223–3-安装Juju

第四节 多节点OpenStack Charms 部署指南0.0.1.dev223–4-安装openstack

第五节 多节点OpenStack Charms 部署指南0.0.1.dev223–5--使bundle安装openstack

第六节 多节点OpenStack Charms 部署指南0.0.1.dev223–6--配置vault和设置数字证书生命周期

第七节 多节点OpenStack Charms 部署指南0.0.1.dev223–7--juju 离线部署bundle

第八节 多节点OpenStack Charms 部署指南0.0.1.dev223–8--配置 OpenStack

附录 t 多节点OpenStack Charms 部署指南0.0.1.dev223–附录T–OpenStack 高可用性

第九节 多节点OpenStack Charms 部署指南0.0.1.dev223–9--网络拓扑

第十节 多节点OpenStack Charms 部署指南0.0.1.dev223–10–OpenStack 高可用基础架构实际

第十一节 多节点OpenStack Charms 部署指南0.0.1.dev223–11–访问Juju仪表板

第十二节 多节点OpenStack Charms 部署指南0.0.1.dev223–12–OpenStack 配置openstack失败后处理

第十三节 多节点OpenStack Charms 部署指南0.0.1.dev223–13–OpenStack配置高可用后无法登陆openstack dashboard

第十四节 多节点OpenStack Charms 部署指南0.0.1.dev223–14–ssh端口转发解决IDC机房国际线路不良问题

第十五节 多节点OpenStack Charms 部署指南0.0.1.dev299–15–OpenStack 实例高可用

第十六节 多节点OpenStack Charms 部署指南0.0.1.dev299–16–OpenStack基础架构高可用The easyrsa resource is missing. .

第十七节 多节点OpenStack Charms 部署指南0.0.1.dev303–17–修改实例数量等quota上限

第十八节 多节点OpenStack Charms 部署指南0.0.1.dev303–18–backup备份

第十九节 多节点OpenStack Charms 部署指南0.0.1.dev303–19–juju log

第二十节 多节点OpenStack Charms 部署指南0.0.1.dev303–20–控制器高可用性

第二十一节 多节点OpenStack Charms 部署指南0.0.1.dev303–21–控制器备份和还原

第二十二节 多节点OpenStack Charms 部署指南0.0.1.dev223–22-- Resource: res_masakari_haproxy not running

第二十三节 多节点OpenStack Charms 部署指南0.0.1.dev223–23-登录openstack-dashboad,SSLError(SSLCertVerificationError

第二十四节 多节点OpenStack Charms 部署指南0.0.1.dev223–24-Resource: res_masakari_f8b6bde_vip not running

第二十五节 多节点OpenStack Charms 部署指南0.0.1.dev223–25–rsyslog 日志服务器构建实际

第二十六节 多节点OpenStack Charms 部署指南0.0.1.dev223–26–跨model 建立关系构建rsyslog 日志服务器构建实际

第二十七节 多节点OpenStack Charms 部署指南0.0.1.dev223–27–Charm Hook

第二十八节 多节点OpenStack Charms 部署指南0.0.1.dev223–28–Command run

第三十节 多节点OpenStack Charms 部署指南0.0.1.–30–参考体系结构—Dell EMC硬件上的Canonical Charmed OpenStack(Ussuri)

第三十一节 多节点OpenStack Charms 部署指南0.0.1.–31–vm hosting-1

第三十二节 多节点OpenStack Charms 部署指南0.0.1.–32–vm hosting-2-VM host networking (snap/2.9/UI)

第三十三节 多节点OpenStack Charms 部署指南0.0.1.–33–vm hosting-3-Adding a VM host (snap/2.9/UI)

第三十四节 多节点OpenStack Charms 部署指南0.0.1.–34–vm hosting-4-VM host存储池和创建和删除vm (snap/2.9/UI)

第三十五节 多节点OpenStack Charms 部署指南0.0.1.–35–Command export-bundle备份opensack并重新部署openstack

第三十六节 多节点openstack charms 部署指南0.0.1-36-graylog实际-1

第三十七节 多节点openstack charms 部署指南0.0.1-37-graylog实际-2

第三十八节 多节点openstack charms 部署指南0.0.1-38-graylog实际-3

第三十九节 多节点openstack charms 部署指南0.0.1-39-graylog-4-filebeat

第四十节 多节点openstack charms 部署指南0.0.1-40-prometheus2参考链接:

Command run
Hacluster #60

前两篇文章主要涉及到juju run命令,本节准备以charm
hacluster #60 为例,解释下juju run 命令。

juju run -h
Usage: juju run [options] <commands>

Summary:
Run the commands on the remote targets specified.

Global Options:
--debug  (= false)
    equivalent to --show-log --logging-config=<root>=DEBUG
-h, --help  (= false)
    Show help on a command or other topic.
--logging-config (= "")
    specify log levels for modules
--quiet  (= false)
    show no informational output
--show-log  (= false)
    if set, write the log file to stderr
--verbose  (= false)
    show more verbose output

Command Options:
-B, --no-browser-login  (= false)
    Do not use web browser for authentication
-a, --app, --application  (= )
    One or more application names
--all  (= false)
    Run the commands on all the machines
--format  (= default)
    Specify output format (default|json|yaml)
-m, --model (= "")
    Model to operate in. Accepts [<controller name>:]<model name>|<model UUID>
--machine  (= )
    One or more machine ids
-o, --output (= "")
    Specify an output file
--operator  (= false)
    Run the commands on the operator (k8s-only)
--timeout  (= 5m0s)
    How long to wait before the remote command is considered to have failed
-u, --unit  (= )
    One or more unit ids

Details:
Run a shell command on the specified targets. Only admin users of a model
are able to use this command.

Targets are specified using either machine ids, application names or unit
names.  At least one target specifier is needed.

Multiple values can be set for --machine, --application, and --unit by using
comma separated values.

Depending on the type of target, the user which the command runs as will be:
  unit -> "root"
  machine -> "ubuntu"
The target and user are independent of whether --all or --application are used.
For example, --all will run as "ubuntu" on machines and "root" on units.
And --application will run as "root" on all units of that application.

Some options are shortened for usabilty purpose in CLI
--application can also be specified as --app and -a
--unit can also be specified as -u

Valid unit identifiers are:
  a standard unit ID, such as mysql/0 or;
  leader syntax of the form <application>/leader, such as mysql/leader.

If the target is an application, the command is run on all units for that
application. For example, if there was an application "mysql" and that application
had two units, "mysql/0" and "mysql/1", then
  --application mysql
is equivalent to
  --unit mysql/0,mysql/1

If --operator is provided on k8s models, commands are executed on the operator
instead of the workload. On IAAS models, --operator has no effect.

Commands run for applications or units are executed in a 'hook context' for
the unit.

--all is provided as a simple way to run the command on all the machines
in the model.  If you specify --all you cannot provide additional
targets.

Since juju run creates actions, you can query for the status of commands
started with juju run by calling "juju show-action-status --name juju-run".

If you need to pass options to the command being run, you must precede the
command and its arguments with "--", to tell "juju run" to stop processing
those arguments. For example:

    juju run --all -- hostname -f

大意如下:

提要:

在指定的远程目标上运行命令。

全局选项:
–debug (= false)
等效于 --show-log --logging-config==DEBUG
-h, --help (= false)
显示有关命令或其他主题的帮助。
–logging-config (= “”)
指定模块的日志级别
–quiet (= false)
显示无信息输出
–show-log (= false)
如果已设置,则将日志文件写入stderr
–verbose (= false)
显示更多详细输出

命令选项:
-B, --no-browser-login (= false)
不要使用网络浏览器进行身份验证
-a, --app, --application (= )
在一个或多个应用程序上执行命令
–all (= false)
在所有机器上运行命令
–format (= default)
指定输出格式 (default|json|yaml)
-m, --model (= “”)
要操作的模型. Accepts [:]|
–machine (= )
一台或多台机器ID
-o, --output (= “”)
指定输出文件
–operator (= false)
在操作员上运行命令(仅适用于k8s)
–timeout (= 5m0s)
远程命令被认为要等待多长时间have failed
-u, --unit (= )
一个或多个单位ID

细节:
在指定目标上运行shell命令。只有模型的管理员用户才能使用此命令。

使用计算机ID,应用程序名称或单元名称指定目标。至少需要指定一个目标。

可以使用逗号分隔的值为–machine,-application和–unit设置多个值。

根据目标的类型,运行命令的用户将是:
unit -> “root”
machine -> “ubuntu”

目标和用户独立于使用–all还是–application。

例如,–all将在计算机上以“ ubuntu”运行,在设备上以“ root”运行。
还有,–application将在该应用程序的所有单元上以“ root”身份运行

CLI中出于便利性目的而缩短了某些选项
–application也可以指定为–app和-a
–unit也可以指定为-u

有效的单位标识符为:
标准单元ID,例如mysql / 0或;
/ leader形式的领导语法,例如mysql / leader。

如果目标是应用程序,则该命令将在该应用程序的所有单元上运行。例如,如果有一个应用程序“ mysql”,并且该应用程序有两个单元“ mysql / 0”和“ mysql / 1”,则
–application mysql
相当于
–unit mysql/0,mysql/1

如果在k8s型号上提供了–operator,则命令将在操作员上执行,而不是在workload上执行。在IAAS模型上,–operator无效。

在应用程序或单元上运行的命令在单元的“hook context”中执行。

–all是提供在模型中所有计算机上运行命令的简单方法。如果指定
–all,则无法提供其他目标。

由于juju run创建了动作,因此您可以通过调用“ juju show-action-status --name juju-run”来查询以juju run开头的命令的状态。

如果需要将选项传递给正在运行的命令,则必须在命令及其参数前面加上“-”,以告诉“ juju run”停止处理这些参数。例如:

juju run --all -- hostname -f

charm hacluster为例,简单列举下run的动作。

找到右边栏的的hook

![在这里插入图片描述](https://img-blog.csdnimg.cn/20210428112448761.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L20wXzQ5MjEyMzg4,
可以看到如下内容:
在这里插入图片描述
这些就是在hacluster程序上或者单元上执行 juju run 命令时可以操作的动作。

比如前面章节提到的:

juju run --application hacluster 'hooks/update-status'

再点开update-status:
内容为:

hooks.py

找到hooks.py,点开:

弹出窗口:

hooks.py

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值