AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[corosync](server)

Martin Hope
KdgDev
Asked: 2021-11-18 03:31:13 +0800 CST

Pacemaker - 记录 ping 检查的结果?

  • 0

我阅读了此页面和下一个页面:https ://clusterlabs.org/pacemaker/doc/deprecated/en-US/Pacemaker/1.1/html/Pacemaker_Explained/_moving_resources_due_to_connectivity_changes.html

它还解释了如何设置可以链接到资源分配的 ping。

虽然这可行,但如果我有超过 1 个 URL 或超过 1 个 ping 检查,我怎么知道哪个失败了?

如果发生这种情况,似乎没有记录在任何地方。它刚刚发生,起搏器做出决定......

阅读此源代码:https ://github.com/ClusterLabs/pacemaker/blob/master/extra/resources/ping

似乎需要启用调试环境变量。我宁愿不这样做,假设我必须为它重新启动起搏器并因此搞乱分配,再加上任何数量的额外日志现在都将占用磁盘空间。

如果 ping 失败,有没有办法只记录一行,只说这一点,而不影响其他任何事情?

networking pacemaker corosync
  • 2 个回答
  • 73 Views
Martin Hope
astrowalker
Asked: 2021-04-17 03:30:54 +0800 CST

由于未知主机,pcs 创建集群失败

  • 0

我现在正在关注几个教程,它们都有这样的步骤——在 pcs 中验证给定的主机,然后创建集群。然而,在我的情况下,第一步(身份验证)有效,而第二步没有错误,说明主机未知/身份验证。

sudo pcs host auth 192.168.4.201 192.168.4.202

接着

sudo pcs cluster setup my_cluster 192.168.4.201 192.168.4.202

为此,我得到了这个特殊的错误:

警告:无法读取已知主机文件:没有这样的文件或目录:'/var/lib/pcsd/known-hosts'
错误:主机 '192.168.4.201'、'192.168.4.202' 不为 pcs 所知,请尝试使用 'pcs host auth 192.168.4.201 192.168.4.202' 命令对主机进行身份验证
错误:主机不为 pcs 所知。

推荐的步骤(在错误消息中)正是我所做的。这里真正缺少什么?

Ubuntu 20.04.2

ubuntu cluster ubuntu-20.04 pacemaker corosync
  • 1 个回答
  • 2715 Views
Martin Hope
Steve
Asked: 2020-06-16 11:48:55 +0800 CST

PCSD 简单主/从不会故障主切换

  • 2

我正在尝试编写一个简单的起搏器主/从系统。我创建了一个代理,它的元数据如下:

elm_meta_data() {
  cat <<EOF
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="elm-agent">
  <version>0.1</version>
  <longdesc lang="en">
    Resource agent for ELM high availability clusters.
  </longdesc>
  <shortdesc>
    Resource agent for ELM
  </shortdesc>
  <parameters>
    <parameter name="datadir" unique="0" required="1">
      <longdesc lang="en">
      Data directory
      </longdesc>
      <shortdesc lang="en">Data directory</shortdesc>
      <content type="string"/>
    </parameter>
  </parameters>
  <actions>
    <action name="start"        timeout="35" />
    <action name="stop"         timeout="35" />
    <action name="monitor"      timeout="35"
                                interval="10" depth="0" />
    <action name="monitor"      timeout="35"
                                interval="10" depth="0" role="Master" />
    <action name="monitor"      timeout="35"
                                interval="11" depth="0" role="Slave" />
    <action name="reload"       timeout="70" />
    <action name="meta-data"    timeout="5" />
    <action name="promote"      timeout="20" />
    <action name="demote"       timeout="20" />
    <action name="validate-all" timeout="20" />
    <action name="notify"       timeout="20" />
  </actions>
</resource-agent>
EOF
}

我的监控,提升,降级是:

elm_monitor() {
  local elm_running
  local worker_running
  local is_master

  elm_running=0
  worker_running=0
  is_master=0

  if [ -e "${OCF_RESKEY_datadir}/master.conf" ]; then
    is_master=1
  fi

  if [ "$(docker ps -q -f name=elm_web)" ]; then
    elm_running=1
  fi
  if [ "$(docker ps -q -f name=elm_worker)" ]; then
    worker_running=1
  fi
  if [ $elm_running -ne $worker_running ]; then
    if [ $is_master -eq 1 ]; then
      exit $OCF_FAILED_MASTER
    fi
    exit $OCF_ERR_GENERIC
  fi
  if [ $elm_running -eq 0 ]; then
    return $OCF_NOT_RUNNING
  fi
  ...
  if [ $is_master -eq 1 ]; then
    exit $OCF_FAILED_MASTER
  fi
  exit $OCF_ERR_GENERIC
}
elm_promote() {
  touch ${OCF_RESKEY_datadir}/master.conf
  return $OCF_SUCCESS
}

elm_demote() {
  rm ${OCF_RESKEY_datadir}/master.conf
  return $OCF_SUCCESS
}

如果我使用以下 cib 命令配置集群,它会得到三个从属服务器并且没有主服务器:

sudo pcs cluster cib cluster1.xml

sudo pcs -f cluster1.xml resource create elmd ocf:a10:elm    \
    datadir="/etc/a10/elm"                                  \
    op start timeout=90s                                     \
    op stop timeout=90s                                      \
    op promote timeout=60s                                   \
    op demote timeout=60s                                    \
    op monitor interval=15s timeout=35s role="Master"        \
    op monitor interval=16s timeout=35s role="Slave"         \
    op notify timeout=60s

sudo pcs -f cluster1.xml resource master elm-ha elmd notify=true
sudo pcs -f cluster1.xml resource create ClusterIP ocf:heartbeat:IPaddr2 ip=$vip cidr_netmask=$net_mask op monitor interval=10s

sudo pcs -f cluster1.xml constraint colocation add ClusterIP with master elm-ha INFINITY
sudo pcs -f cluster1.xml constraint order promote elm-ha then start ClusterIP symmetrical=false kind=Mandatory
sudo pcs -f cluster1.xml constraint order demote elm-ha then stop ClusterIP symmetrical=false kind=Mandatory
sudo pcs cluster cib-push cluster1.xml

ubuntu@elm1:~$ sudo pcs status
...
 elm_proxmox_fence100   (stonith:fence_pve):    Started elm1
 elm_proxmox_fence101   (stonith:fence_pve):    Started elm2
 elm_proxmox_fence103   (stonith:fence_pve):    Started elm3
 Master/Slave Set: elm-ha [elmd]
     Slaves: [ elm1 elm2 elm3 ]
 ClusterIP  (ocf::heartbeat:IPaddr2):   Stopped

而如果我将以下命令添加到 cib,我会得到一个主/从设置:

sudo pcs -f cluster1.xml constraint location elm-ha rule role=master \#uname eq $(hostname)

   Master/Slave Set: elm-ha [elmd]
       Masters: [ elm1 ]
       Slaves: [ elm2 elm3 ]
   ClusterIP    (ocf::heartbeat:IPaddr2):   Started elm1

但是在最后一个版本上,大师似乎坚持使用 elm1。当我测试失败时,通过停止主服务器上的 corosync 服务,我最终得到了 2 个从服务器,主服务器处于停止状态。我猜测设置规则是强制起搏器将主控保持在 elm1 上。

     Master/Slave Set: elm-ha [elmd]
         Slaves: [ elm2 elm3 ]
         Stopped: [ elm1 ]
     ClusterIP  (ocf::heartbeat:IPaddr2):   Stopped

如何配置它,以便当我发送我的 cib 命令时,它会选择一个主服务器并在主服务器出现故障时进行故障转移?我的代理需要一些不同的东西吗?

cluster pacemaker failovercluster corosync
  • 1 个回答
  • 320 Views
Martin Hope
PopSpe
Asked: 2020-05-18 09:22:32 +0800 CST

DRBD 单主忽略文件类型

  • 0

是否可以为文件类型(甚至可能是特定文件)提供排除列表,以便它们不会尝试与辅助节点同步?我查看了 DRBD 配置文件,但找不到任何关于它的信息。如果没有,是否还有另一个允许排除的主->从同步系统?

为什么我要问:
尝试从单个服务器迁移到负载平衡器基础架构后面的集群。我想使服务器的操作/配置文件保持同步。有一些日志文件与相应的操作/配置文件写入相同的目录中。

最优目标:
当主服务器(主)有相关文件更新时,从(从)服务器文件同步。

我知道我可以重构代码,但我真的很想避免这种情况。

可能相关信息:
AWS ec2 服务器 AWS 负载均衡器 AWS NFS (EFS) 已尝试,但性能损失太大。也无法让詹金斯完成目标。考虑为主服务器设置一个 Git 存储库,在从服务器上克隆存储库,然后在提交时添加触发器。没有更好的解决方案吗?还没有完全看过 Puppet 可以选择吗?也许是 Corosync?如果您也可以向我指出良好的使用文档,那就太好了。

synchronization puppet drbd corosync
  • 1 个回答
  • 62 Views
Martin Hope
Karias Bolster
Asked: 2020-05-06 09:18:37 +0800 CST

起搏器 Corosync OCF 资源生命周期

  • 0

我目前被要求设置 Pacemaker Corosync,这对我来说是全新的。我目前有一个 2 节点集群。如果活动节点发生故障,我想要做的是重新分配 IP 给另一个节点。

所以看起来这样做的方法是创建一个资源代理。我已经阅读了一些关于创建 OCF 资源的教程。我已经阅读过 OCF 资源,似乎这些东西称为动作。我对动作不了解的是何时以及谁调用这些动作?

如果资源在主节点上运行,然后当主节点宕机时,资源会发生什么?它会自动在另一个节点上运行吗?

此外,由于我需要执行一些步骤以防调用某个操作,我如何检查我的脚本中调用了哪个操作,是否有变量?

pacemaker corosync
  • 2 个回答
  • 232 Views
Martin Hope
Mezja
Asked: 2020-05-01 02:21:11 +0800 CST

节点切换后 Pacemaker 不启动服务

  • 1

我正在使用两台虚拟 Ubuntu 服务器(最新的长期服务器)并且两者都具有相同的配置,并且正在运行 Squid 服务和 pcs pacemaker corosync。我有两个节点Squid01和Squid02一个虚拟 IP。

问题:当我启动两台服务器时,Squid02通常是通过启动 Squid 代理服务来完成所有工作,但Squid01代理服务会自动禁用自身并变为非活动状态,因此我关闭Squid02服务器并在服务器节点之间切换,但Squid02代理服务仍然处于非活动状态并且你必须手动启动它。

它没有看到停止的服务

我需要实现这一点,当切换发生时,非活动服务变为活动状态,或者两个服务一直在工作。

我已使用此示例创建集群

但只有一个区别是我没有 Squid from apt-get,但我是使用 config 手动创建的

[Unit]
Description=Squid Web Proxy.
[Service]
Type=simple
PIDFile=/usr/local/squid/var/run/squid.pid
ExecStart=/usr/local/squid/sbin/squid
[Install]
WantedBy=multi-user.target

我跳过了防火墙部分。

ubuntu cluster pacemaker corosync
  • 1 个回答
  • 178 Views
Martin Hope
Mezja
Asked: 2020-04-29 05:07:38 +0800 CST

Squid Proxy .pid 文件在启动几秒钟后消失

  • 0

我有两个相同的虚拟 Ubuntu 服务器,并且都有 Squid Proxy。问题是 Squid 在服务器启动时会创建 .pid 文件,但 10-20 秒后它会消失,我必须手动输入:

/usr/local/squid/sbin/squid

然后它会正常工作,并且 .pid 文件不会消失。我希望我的 Squid 在服务器启动时启动,并且 .pid 文件不会消失。我尝试创建 init.d 文件 /etc/init.d/run_squid

#! /bin/sh
/usr/local/squid/sbin/squid
exit0

然后

update-rc.d run_squid defaults
update-rc.d run_squid enable 

我得到:

error: run_squid Default-Start contains no runlevels, aborting

我也试过

crontab -e
@reboot /scripts/squid.sh

即使我授予权限,当我运行它时也没有任何反应。

我需要 .pid 才能正常运行,这样我的集群才能正常工作(我的集群由 corosync 和起搏器组成),因为现在的问题是当一个节点 .pid 消失时,该节点只会继续工作(它根本不代理,但它认为它有效),但它不会切换到健康的。

总结:我希望我的 squid 正常启动,它不会丢失它的 pid,并且如果其中一个丢失 .pid 文件,节点会切换。

ubuntu squid pacemaker corosync
  • 1 个回答
  • 1328 Views
Martin Hope
drkmkzs
Asked: 2020-02-05 02:50:34 +0800 CST

corosync/pacemaker/fencing - 具有 2 个节点的被动/主动集群

  • 4

我正在使用起搏器/corosync 配置集群 2 节点,对此我有一些疑问(也许是最佳实践:我远非专家)

**OS:** redhat 7.6

I configurated the cluster with those properties

 - **stonith-enabled:** true

 - **symmetric-cluster:** true (even if is default value i think)


and added in corosync.conf

 - **wait_for_all:** 0 (i want a Node be able to start/work even if his twin is KO)

 - **two_nodes:** 1


Considering the fencing:

- Using ILO of blade HP (ILO1 for Node1, ILO2 for Node2)

I read that it was sometimes a good practice to prevent a node suicide, so added constraints 

- ILO1-fence can't locate in node1 

- ILO2-fence can't locate on node2

我遇到的问题如下,在 Node1 关闭时启动 Node2 时发生:

  • 起搏器/corosync 无法在 Node1 上启动 ILO2-fence(当然是因为 Node 1 已关闭),因此不要启动其他资源,因此我的集群都无法正常工作 >:[

我想知道我是否错过了配置中的某些内容,或者我不太了解这样的集群应该如何工作。

因为我希望 Node2 启动,所以集群看到 Node1 是 KO 并且只是启动资源以使 Node2 自己工作。

但这是真的,因为 ILO2-fence 只能位于 Node1 上(因为避免自杀的约束),所以这个资源总是会失败......(在没有那些“反自杀”约束的情况下尝试时,如果 Node2 有一些服务失败,然后它在启动后直接关闭,我不想要)

我会欣赏一些回报和启示:)

谢谢 :)

pacemaker corosync fencing
  • 1 个回答
  • 793 Views
Martin Hope
nwarriorch
Asked: 2016-10-12 16:02:05 +0800 CST

corosync 1.4 是否支持公共 IP?

  • 1

我正在创建一个基于云的集群,所以现在我使用单播连接到其他起搏器/corosync 节点。我能够使用私有 IP 创建一个集群。要创建跨区域集群,我想使用公共 IP。我尝试使用通用配置,为 memberaddr 提供公共 IP,为 bindnetaddr 提供节点的公共 IP。像这样的东西

  interface {

           member {
             memberaddr: <public ip 1>
           }
           member {
              memberaddr: <public ip 2>
           }
           member {
              memberaddr: <public ip 3>
           }
           ringnumber: 0
           bindnetaddr: <current nodes public Ip>
           mcastport: 5405
           ttl: 1
  }
  transport: udpu

这是行不通的。难道我做错了什么 ?我能找到的所有参考资料都是 corosync 2.x

谢谢

high-availability amazon-web-services pacemaker corosync linux-ha
  • 2 个回答
  • 247 Views
Martin Hope
nwarriorch
Asked: 2016-10-04 10:39:24 +0800 CST

生产中的 corosync + 起搏器 + percona 代理

  • 0

我们计划在带有 GTID 的 mysql 5.7.1 上使用起搏器 Corosync 和 Percona 代理实现 HA。我用谷歌搜索了一会儿,发现没有足够的信息。我想知道是否有人对 HA 使用类似的堆栈,或者是否有人可以对常见用例错误和关于整个事情的建议提出任何建议。

如果您能说明在生产中使用起搏器,例如常见问题、生产问题、您可以自动化多少等,那就太好了。

mysql database-administration high-availability pacemaker corosync
  • 1 个回答
  • 430 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve