HighAvailability をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
High Availability(高可用性)
クラスターを組んで片方のノードが都合により停止になっても...
&size(10){クラスターって言葉は扱いが難しい... HPCにも使う...
昔windowsServerにて[[windowsServer/wsfc]]を組んでみた. こ...
参照先[[https://linux-ha.osdn.jp/wp/>+https://linux-ha.os...
リソース追加[[HighAvailability/resource]]
(HAクラスターのサービスにNFSを追加 [[HighAvailability/res...
***構成 [#d3718428]
CentOS7で &color(magenta){pacemaker-1.1}; と &color(magen...
VMware esxiで作ってます.
|BGCOLOR(YELLOW):マシン名|BGCOLOR(YELLOW):IPアドレス|BGCO...
|ha01&br;(ha01-1-heartbeat)|192.168.0.100&br;(10.10.10.1)...
|ha02&br;(ha02-1-heartbeat)|192.168.0.101&br;(10.10.10.2)...
&size(10){スプリットブレイン対策のため死活確認の&color(or...
&color(red){*};&size(10){余談: ホスト名へのアンダーバー(_...
&color(red){*};&size(10){[[スプリットブレイン>#x66aae76]]...
***Shared disk [#h98bde18]
参照[[VMware/shared]]
***下拵え [#nab11fa2]
grouplist から「High Availability」をインストールします.
「High Availability」をインストールすると pacemaker とそ...
#code(nonumber){{
[root@ha01 ~]# yum grouplist hidden | less <---...
:
Available Environment Groups:
:
Available Groups:
:
High Availability
:
Done
[root@ha01 ~]#
[root@ha01 ~]# yum groupinfo "High Availability" <---...
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
Group: High Availability
Group-Id: ha
Description: Infrastructure for highly available service...
Mandatory Packages:
pacemaker
Default Packages:
+fence-agents-aliyun
+fence-agents-all
+fence-agents-aws
+fence-agents-azure-arm
+fence-agents-gce
+omping
+pacemaker-doc
+pcs
Optional Packages:
awscli
booth-arbitrator
booth-site
resource-agents-aliyun
sbd
[root@ha01 ~]# yum groupinstall "High Availability"
}}
次に /etc/hosts を整備する
#code(nonumber){{
[root@ha01 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.0.100 ha01 ha01.sybyl.local
192.168.0.101 ha02 ha02.sybyl.local
#---- heartbeat ----#
10.10.0.1 ha01-1-heartbeat
10.10.0.2 ha02-1-heartbeat
[root@ha01 ~]#
}}
そして既定で用意されているhigh-availability向けのfirewall...
#code(nonumber){{
[root@ha01 ~]# firewall-cmd --add-service=high-availabili...
[root@ha01 ~]# firewall-cmd --reload
}}
上記は全ノードに施します.
***pcs(Pacemaker Configuration System)でクラスターを構築 ...
rpmのDescriptionには
#code(nonumber){{
Description : pcs is a corosync and pacemaker configurati...
: users to easily view, modify and create pac...
}}
とある.
初めに「yum groupinfo "High Availability"」の実行で作ら...
#code(nonumber){{
[root@ha01 ~]# id hacluster
uid=189(hacluster) gid=189(haclient) groups=189(haclient)
[root@ha01 ~]# echo hacluster123 | passwd --stdin haclust...
}}
その後に &color(magenta){pcsd.service}; を有効にして稼働...
#code(nonumber){{
[root@ha01 ~]# systemctl enable pcsd.service
[root@ha01 ~]# systemctl start pcsd.service
}}
この操作をもう片方の ha02 にも施す
設定が終わったら片方でクラスターのノード間の認証を行う
#code(nonumber){{
[root@ha01 ~]# pcs cluster auth ha01-1-heartbeat ha02-1...
ha01-1-heartbeat: Authorized
ha02-1-heartbeat: Authorized
[root@ha01 ~]#
}}
この時「/var/lib/pcsd/{tokens,pcs_users.conf}」が作られる.
クラスターを作成する. &size(10){クラスター監視用アドレス...
#code(nonumber){{
[root@ha01 ~]# pcs cluster setup --name ha ha01-1-heartbe...
*サービスLANのIPもクラスター監視用アドレスとして使用する...
「pcs cluster setup --name ha ha01,ha01-1-heartbeat h...
[root@ha01 ~]#
[root@ha01 ~]# pcs cluster status
Error: cluster is not currently running on this node
[root@ha01 ~]# pcs cluster start --all
ha01-1-heartbeat: Starting Cluster (corosync)...
ha02-1-heartbeat: Starting Cluster (corosync)...
ha01-1-heartbeat: Starting Cluster (pacemaker)...
ha02-1-heartbeat: Starting Cluster (pacemaker)...
[root@ha01 ~]# pcs cluster status
Cluster Status:
Stack: unknown
Current DC: NONE
Last updated: Sat May 30 11:39:29 2020
Last change: Sat May 30 11:39:19 2020 by hacluster via c...
2 nodes configured
0 resources configured
PCSD Status:
ha01-1-heartbeat: Online
ha02-1-heartbeat: Online
[root@ha01 ~]#
}}
この段階では何もHighAvailabilityなリソース、サービスは登...
単にクラスターの枠組みを作っただけです.
***各種確認 [#c045bcda]
作成したクラスターの様子を確認
双方でcorosync(Corosync Cluster Engine)のノード間通信を確...
#code(nonumber){{
[root@ha01 ~]# pcs status corosync [root...
Membership information Membe...
---------------------- -----...
Nodeid Votes Name N...
1 1 ha01-1-heartbeat (local) ...
2 1 ha02-1-heartbeat ...
[root@ha01 ~]# [root...
}}
corosyncのコマンド「corosync-cfgtool」では下記のように確...
#code(nonumber){{
[root@ha01 ~]# corosync-cfgtool -s [root...
Printing ring status. Print...
Local node ID 1 Local...
RING ID 0 RING ...
id = 10.10.0.1 ...
status = ring 0 active with no faults ...
[root@ha01 ~]# [root...
}}
そして作られたクラスターでは参加したノードに「/etc/corosy...
#code(nonumber){{
[root@ha02 corosync]# cat corosync.conf
totem {
version: 2
cluster_name: ha
secauth: off
transport: udpu
}
nodelist {
node {
ring0_addr: ha01-1-heartbeat
nodeid: 1
}
node {
ring0_addr: ha02-1-heartbeat
nodeid: 2
}
}
quorum {
provider: corosync_votequorum
two_node: 1
}
logging {
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
}
}}
pacemakerのコマンド「crm_verify」でも状態を確認すると下記...
***スプリットブレイン [#x66aae76]
ノード間で死活確認がうまく動かずに双方とも「Active」にな...
その対策の1つとしてSTONITH(Shoot-The-Other-Node-In-The-H...
ipmiなポート経由で相手を眠らせるとか、
esxi の上で動くのでesxiのコマンド経由で相手を眠らせる方法...
「yum search fence-agents」で得られるのがその対策リストら...
既定で「STONITHを施す」となっているため下記のようなエラー...
#code(nonumber){{
[root@ha01 ~]# crm_verify -L -V
error: unpack_resources: Resource start-up disable...
error: unpack_resources: Either configure some or ...
error: unpack_resources: NOTE: Clusters with share...
Errors found during check: config not valid
[root@ha01 ~]#
}}
だが、今はこの要求されるSTONITHは無視/無効する.
#code(nonumber){{
[root@ha01 ~]# pcs property list --all | grep stonith
stonith-action: reboot
stonith-enabled: true
stonith-max-attempts: 10
stonith-timeout: 60s
stonith-watchdog-timeout: (null)
[root@ha01 ~]# pcs property set stonith-enabled=false
(確認)
[root@ha01 ~]# pcs property list --all | grep stonith
stonith-action: reboot
stonith-enabled: false
stonith-max-attempts: 10
stonith-timeout: 60s
stonith-watchdog-timeout: (null)
[root@ha01 ~]# crm_verify -L -V <-- エラー項目が表示さ...
[root@ha01 ~]#
}}
&color(red){*};&size(10){この部分の変更がどこに書かれてい...
このSTONITH以外にも「Quorum」を使った方法もあるが、こちら...
Quorum: 定足数. 3ノードクラスターで2ノードから「こいつは...
#code(nonumber){{
[root@ha01 ~]# pcs property list --all | grep quorum
no-quorum-policy: stop
[root@ha01 ~]# pcs property set no-quorum-policy=ignore
[root@ha01 ~]# pcs property list --all | grep quorum
no-quorum-policy: ignore
[root@ha01 ~]#
}}
***再起動 [#hb93fa63]
両ノードを再起動してみた
#code(nonumber){{
[root@ha01 ~]# systemctl list-unit-files | grep pcsd
pcsd.service enabled
[root@ha01 ~]# ps -ef |grep pcsd | grep -v grep
root 1115 1 0 22:11 ? 00:00:01 /usr/bin/...
[root@ha01 ~]#
}}
とpcsdは再起動後も動いているのだが、
#code(nonumber){{
[root@ha01 ~]# pcs cluster status
Error: cluster is not currently running on this node
[root@ha01 ~]#
}}
と動ていない.
っで
#code(nonumber){{
[root@ha01 ~]# pcs cluster start --all
ha01-1-heartbeat: Starting Cluster (corosync)...
ha02-1-heartbeat: Starting Cluster (corosync)...
ha01-1-heartbeat: Starting Cluster (pacemaker)...
ha02-1-heartbeat: Starting Cluster (pacemaker)...
[root@ha01 ~]#
}}
っで動かす.
***参考先 [#lf1afa0c]
[[https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1...
[[http://kan3aa.hatenablog.com/category/CentOS]]
[[https://gist.github.com/kogoto/92eef35b28ae632a11f7]]
終了行:
High Availability(高可用性)
クラスターを組んで片方のノードが都合により停止になっても...
&size(10){クラスターって言葉は扱いが難しい... HPCにも使う...
昔windowsServerにて[[windowsServer/wsfc]]を組んでみた. こ...
参照先[[https://linux-ha.osdn.jp/wp/>+https://linux-ha.os...
リソース追加[[HighAvailability/resource]]
(HAクラスターのサービスにNFSを追加 [[HighAvailability/res...
***構成 [#d3718428]
CentOS7で &color(magenta){pacemaker-1.1}; と &color(magen...
VMware esxiで作ってます.
|BGCOLOR(YELLOW):マシン名|BGCOLOR(YELLOW):IPアドレス|BGCO...
|ha01&br;(ha01-1-heartbeat)|192.168.0.100&br;(10.10.10.1)...
|ha02&br;(ha02-1-heartbeat)|192.168.0.101&br;(10.10.10.2)...
&size(10){スプリットブレイン対策のため死活確認の&color(or...
&color(red){*};&size(10){余談: ホスト名へのアンダーバー(_...
&color(red){*};&size(10){[[スプリットブレイン>#x66aae76]]...
***Shared disk [#h98bde18]
参照[[VMware/shared]]
***下拵え [#nab11fa2]
grouplist から「High Availability」をインストールします.
「High Availability」をインストールすると pacemaker とそ...
#code(nonumber){{
[root@ha01 ~]# yum grouplist hidden | less <---...
:
Available Environment Groups:
:
Available Groups:
:
High Availability
:
Done
[root@ha01 ~]#
[root@ha01 ~]# yum groupinfo "High Availability" <---...
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
* base: ftp.riken.jp
* extras: ftp.riken.jp
* updates: ftp.riken.jp
Group: High Availability
Group-Id: ha
Description: Infrastructure for highly available service...
Mandatory Packages:
pacemaker
Default Packages:
+fence-agents-aliyun
+fence-agents-all
+fence-agents-aws
+fence-agents-azure-arm
+fence-agents-gce
+omping
+pacemaker-doc
+pcs
Optional Packages:
awscli
booth-arbitrator
booth-site
resource-agents-aliyun
sbd
[root@ha01 ~]# yum groupinstall "High Availability"
}}
次に /etc/hosts を整備する
#code(nonumber){{
[root@ha01 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
192.168.0.100 ha01 ha01.sybyl.local
192.168.0.101 ha02 ha02.sybyl.local
#---- heartbeat ----#
10.10.0.1 ha01-1-heartbeat
10.10.0.2 ha02-1-heartbeat
[root@ha01 ~]#
}}
そして既定で用意されているhigh-availability向けのfirewall...
#code(nonumber){{
[root@ha01 ~]# firewall-cmd --add-service=high-availabili...
[root@ha01 ~]# firewall-cmd --reload
}}
上記は全ノードに施します.
***pcs(Pacemaker Configuration System)でクラスターを構築 ...
rpmのDescriptionには
#code(nonumber){{
Description : pcs is a corosync and pacemaker configurati...
: users to easily view, modify and create pac...
}}
とある.
初めに「yum groupinfo "High Availability"」の実行で作ら...
#code(nonumber){{
[root@ha01 ~]# id hacluster
uid=189(hacluster) gid=189(haclient) groups=189(haclient)
[root@ha01 ~]# echo hacluster123 | passwd --stdin haclust...
}}
その後に &color(magenta){pcsd.service}; を有効にして稼働...
#code(nonumber){{
[root@ha01 ~]# systemctl enable pcsd.service
[root@ha01 ~]# systemctl start pcsd.service
}}
この操作をもう片方の ha02 にも施す
設定が終わったら片方でクラスターのノード間の認証を行う
#code(nonumber){{
[root@ha01 ~]# pcs cluster auth ha01-1-heartbeat ha02-1...
ha01-1-heartbeat: Authorized
ha02-1-heartbeat: Authorized
[root@ha01 ~]#
}}
この時「/var/lib/pcsd/{tokens,pcs_users.conf}」が作られる.
クラスターを作成する. &size(10){クラスター監視用アドレス...
#code(nonumber){{
[root@ha01 ~]# pcs cluster setup --name ha ha01-1-heartbe...
*サービスLANのIPもクラスター監視用アドレスとして使用する...
「pcs cluster setup --name ha ha01,ha01-1-heartbeat h...
[root@ha01 ~]#
[root@ha01 ~]# pcs cluster status
Error: cluster is not currently running on this node
[root@ha01 ~]# pcs cluster start --all
ha01-1-heartbeat: Starting Cluster (corosync)...
ha02-1-heartbeat: Starting Cluster (corosync)...
ha01-1-heartbeat: Starting Cluster (pacemaker)...
ha02-1-heartbeat: Starting Cluster (pacemaker)...
[root@ha01 ~]# pcs cluster status
Cluster Status:
Stack: unknown
Current DC: NONE
Last updated: Sat May 30 11:39:29 2020
Last change: Sat May 30 11:39:19 2020 by hacluster via c...
2 nodes configured
0 resources configured
PCSD Status:
ha01-1-heartbeat: Online
ha02-1-heartbeat: Online
[root@ha01 ~]#
}}
この段階では何もHighAvailabilityなリソース、サービスは登...
単にクラスターの枠組みを作っただけです.
***各種確認 [#c045bcda]
作成したクラスターの様子を確認
双方でcorosync(Corosync Cluster Engine)のノード間通信を確...
#code(nonumber){{
[root@ha01 ~]# pcs status corosync [root...
Membership information Membe...
---------------------- -----...
Nodeid Votes Name N...
1 1 ha01-1-heartbeat (local) ...
2 1 ha02-1-heartbeat ...
[root@ha01 ~]# [root...
}}
corosyncのコマンド「corosync-cfgtool」では下記のように確...
#code(nonumber){{
[root@ha01 ~]# corosync-cfgtool -s [root...
Printing ring status. Print...
Local node ID 1 Local...
RING ID 0 RING ...
id = 10.10.0.1 ...
status = ring 0 active with no faults ...
[root@ha01 ~]# [root...
}}
そして作られたクラスターでは参加したノードに「/etc/corosy...
#code(nonumber){{
[root@ha02 corosync]# cat corosync.conf
totem {
version: 2
cluster_name: ha
secauth: off
transport: udpu
}
nodelist {
node {
ring0_addr: ha01-1-heartbeat
nodeid: 1
}
node {
ring0_addr: ha02-1-heartbeat
nodeid: 2
}
}
quorum {
provider: corosync_votequorum
two_node: 1
}
logging {
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: yes
}
}}
pacemakerのコマンド「crm_verify」でも状態を確認すると下記...
***スプリットブレイン [#x66aae76]
ノード間で死活確認がうまく動かずに双方とも「Active」にな...
その対策の1つとしてSTONITH(Shoot-The-Other-Node-In-The-H...
ipmiなポート経由で相手を眠らせるとか、
esxi の上で動くのでesxiのコマンド経由で相手を眠らせる方法...
「yum search fence-agents」で得られるのがその対策リストら...
既定で「STONITHを施す」となっているため下記のようなエラー...
#code(nonumber){{
[root@ha01 ~]# crm_verify -L -V
error: unpack_resources: Resource start-up disable...
error: unpack_resources: Either configure some or ...
error: unpack_resources: NOTE: Clusters with share...
Errors found during check: config not valid
[root@ha01 ~]#
}}
だが、今はこの要求されるSTONITHは無視/無効する.
#code(nonumber){{
[root@ha01 ~]# pcs property list --all | grep stonith
stonith-action: reboot
stonith-enabled: true
stonith-max-attempts: 10
stonith-timeout: 60s
stonith-watchdog-timeout: (null)
[root@ha01 ~]# pcs property set stonith-enabled=false
(確認)
[root@ha01 ~]# pcs property list --all | grep stonith
stonith-action: reboot
stonith-enabled: false
stonith-max-attempts: 10
stonith-timeout: 60s
stonith-watchdog-timeout: (null)
[root@ha01 ~]# crm_verify -L -V <-- エラー項目が表示さ...
[root@ha01 ~]#
}}
&color(red){*};&size(10){この部分の変更がどこに書かれてい...
このSTONITH以外にも「Quorum」を使った方法もあるが、こちら...
Quorum: 定足数. 3ノードクラスターで2ノードから「こいつは...
#code(nonumber){{
[root@ha01 ~]# pcs property list --all | grep quorum
no-quorum-policy: stop
[root@ha01 ~]# pcs property set no-quorum-policy=ignore
[root@ha01 ~]# pcs property list --all | grep quorum
no-quorum-policy: ignore
[root@ha01 ~]#
}}
***再起動 [#hb93fa63]
両ノードを再起動してみた
#code(nonumber){{
[root@ha01 ~]# systemctl list-unit-files | grep pcsd
pcsd.service enabled
[root@ha01 ~]# ps -ef |grep pcsd | grep -v grep
root 1115 1 0 22:11 ? 00:00:01 /usr/bin/...
[root@ha01 ~]#
}}
とpcsdは再起動後も動いているのだが、
#code(nonumber){{
[root@ha01 ~]# pcs cluster status
Error: cluster is not currently running on this node
[root@ha01 ~]#
}}
と動ていない.
っで
#code(nonumber){{
[root@ha01 ~]# pcs cluster start --all
ha01-1-heartbeat: Starting Cluster (corosync)...
ha02-1-heartbeat: Starting Cluster (corosync)...
ha01-1-heartbeat: Starting Cluster (pacemaker)...
ha02-1-heartbeat: Starting Cluster (pacemaker)...
[root@ha01 ~]#
}}
っで動かす.
***参考先 [#lf1afa0c]
[[https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/1...
[[http://kan3aa.hatenablog.com/category/CentOS]]
[[https://gist.github.com/kogoto/92eef35b28ae632a11f7]]
ページ名:
1