我正在尝试使用 corosync 和起搏器设置一个主动/被动(2 个节点)Linux-HA 集群来启动和运行 PostgreSQL 数据库。它通过 DRBD 和 service-ip 工作。如果节点 1 失败,节点 2 应该接管。如果 PG 在 node2 上运行并且失败,则相同。除了 STONITH 之外,一切正常。
节点之间是专用的 HA 连接(10.10.10.X),所以我有以下接口配置:
eth0 eth1 host
10.10.10.251 172.10.10.1 node1
10.10.10.252 172.10.10.2 node2
Run Code Online (Sandbox Code Playgroud)
Stonith 已启用,我正在使用 ssh-agent 进行测试以杀死节点。
crm configure property stonith-enabled=true
crm configure property stonith-action=poweroff
crm configure rsc_defaults resource-stickiness=100
crm configure property no-quorum-policy=ignore
crm configure primitive stonith_postgres stonith:external/ssh \
params hostlist="node1 node2"
crm configure clone fencing_postgres stonith_postgres
Run Code Online (Sandbox Code Playgroud)
crm_mon -1 显示:
============
Last updated: Mon Mar 19 15:21:11 2012
Stack: openais …Run Code Online (Sandbox Code Playgroud) 我正在使用来自 backports 的 PostgreSQL 9.1 的 debian 挤压。Puppet 版本为 2.7.14。不幸的是,init 脚本返回了错误的状态退出代码。因此我编写了一个自定义status命令来检测 postgresql 是否正在运行。
service { 'postgresql':
ensure => running,
enable => true,
hasstatus => false,
hasrestart => true,
status => "pg_lsclusters -h | awk 'BEGIN {rc=0} {if ($4 != \"online\") rc=3} END { exit rc }'",
provider => debian,
}
Run Code Online (Sandbox Code Playgroud)
我的命令像魔法一样有效,但 puppet 似乎有问题。notice: /Stage[main]/Postgresql/Service[postgresql]/ensure: ensure changed 'stopped' to 'running'尽管它已经在运行,但我总是得到。
所以尝试了以下方法:
service { 'postgresql':
ensure => running,
enable => true,
hasstatus => false,
hasrestart => true,
status …Run Code Online (Sandbox Code Playgroud) 我想检查变量的内容是否为奇数。但我需要一个整数。
$ip_array = split($ipaddress, '.')
$odd_ip = $ip_array[3] % 2
if $odd_ip == 1 {
notice("is odd")
}
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法可以将字符串转换为整数?
我正在为我的服务器的不同角色编写特定的模块。所以我有一个木偶和一个木偶仪表板-模块。该木偶模块确保木偶是正确的安装。当然,傀儡仪表板对傀儡仪表板也做同样的事情。
两个模块都需要 puppetlabs apt 源(顺便说一句。我正在使用https://github.com/puppetlabs/puppet-apt)。所以我在puppet和puppet-dashboard -module 中有以下定义的资源:
apt::source { "puppetlabs":
location => "http://apt.puppetlabs.com",
release => "squeeze",
repos => "main",
required_packages => true,
include_src => false,
key => "4BD6EC30",
key_server => "pgp.mit.edu",
}
Run Code Online (Sandbox Code Playgroud)
现在我的代理出现以下错误:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Apt::Source[puppetlabs] is already declared in file /etc/puppet/modules/puppet/manifests/base.pp at line 27; cannot redeclare at /etc/puppet/modules/puppet-dashboard/manifests/init.pp:42 on node server123
Run Code Online (Sandbox Code Playgroud)
特定模块彼此独立。因此我认为在每个模块中单独设置这个apt源的依赖是正确的。 …