是否可以使用配置文件配置起搏器?

moo*_*ima 3 pacemaker corosync

我正在尝试使用配置文件配置起搏器(我可以自动生成然后要求起搏器“重新加载”)。但是我看到的所有示例都是针对命令行命令或交互式编辑器的。(我正在运行 Ubuntu)。

命令行方法是这样的

crm configure primitive VIP ocf:IPaddr2 params ip=10.0.2.200 nic=eth0 op monitor interval=10s
Run Code Online (Sandbox Code Playgroud)

虽然交互模式是这样的

sudo crm configure
And then we add the res_ip resource:

crm(live)configure# primitive res_ip ocf:heartbeat:IPaddr2 params ip="102.169.122.254" cidr_netmask="24" nic="eth0"
crm(live)configure# commit
crm(live)configure# exit
Run Code Online (Sandbox Code Playgroud)

但我想要一个可以更新和重新加载的静态配置文件。类似于/etc/ha.d/haresources心跳使用的文件。有这种可能吗?

Mat*_*man 6

确实。使用您在示例命令中使用的相同语法创建一个配置文件(在我们的示例中名为“cib.txt”):

primitive VIP ocf:heartbeat:IPaddr2 params ip=10.0.2.200 nic=eth0 \
    op monitor interval=10s timeout=20s \
    op start interval=0 timeout=20s \
    op stop interval=0 timeout=20s
Run Code Online (Sandbox Code Playgroud)

然后您可以使用以下 CRM shell 命令加载该文件:

# crm configure load update cib.txt
Run Code Online (Sandbox Code Playgroud)

或者完全替换配置:

# crm configure load replace cib.txt
Run Code Online (Sandbox Code Playgroud)

注意:您可以使用以下命令从集群中导出配置,用于新集群或备份目的:

# crm configure show > cib.txt
Run Code Online (Sandbox Code Playgroud)

警告:如果您打算将原始集群加载到其他地方(节点 ID、dc-version、last-lrm-refresh 等),请务必删除任何特定于原始集群的内容。