※※ vSAN 6.7U3 以降の場合は VMware KB 70650をご確認ください ※※ VxRail 4.7.520/7.0.130 以降の場合は Dell Technologies の SolveOnlineの手順書を参照ください VxRailでは、VxRail Manager GUIにてクラスタのシャットダウンボタンを提供しており、簡単にクラスタシャットダウンを実施できます...
See more...
※※ vSAN 6.7U3 以降の場合は VMware KB 70650をご確認ください ※※ VxRail 4.7.520/7.0.130 以降の場合は Dell Technologies の SolveOnlineの手順書を参照ください VxRailでは、VxRail Manager GUIにてクラスタのシャットダウンボタンを提供しており、簡単にクラスタシャットダウンを実施できますが、 VMware KB#60424(https:/kb.vmware.com/s/article/60424)で紹介されている通り、VSAN環境では、通常のシャットダウン手順では、データの不整合を引き起こす恐れがあり、 KBに従ったStepによってシャットダウンを実施することを推奨しております。 ※本記事を公開するにあたり 十分検証確認を行っておりますが、データ保全に関して当アカウントは責任を負いかねますのであらかじめご了承下さい。 本記事は、VxRail 4.7.300未満のすべてのVersionで適用されます。 VxRail 4.7.300以降のVersionをご使用の場合は、VMware KB#70650の手順を参照してクラスタのシャットダウン・起動を実施してください。 下記EMCのKBに従ったVxRailのシャットダウン手順を詳細にご説明します。 VxRail: vSAN cluster shutdown and restart may lead to data unavailability after a single failure (Related VMware KB# 60424) https://support.emc.com/kb/528792 VMTN コミュニティでは起動と停止の手順を以下の通り公開しています。 ① VMware KB#60424に基づいたVxRailにおけるクラスタシャットダウン手順 <--- 本記事です ② VMware KB#60424に基づいたVxRailにおけるクラスタ起動手順 まず、大まかな流れとしては、下記のようになります。 ■事前準備編 1.健全性の確認 2.各ESXiホストのNTP時刻同期の確認 3.スクリプトの配置 4.スクリプトの編集 ■VSAN切り離し・シャットダウン編 5.VCSA/PSC以外のすべての仮想マシンをシャットダウンする 6.データ移行有無の確認 7.VCSA/PSCのシャットダウン 8.crontabの編集 9.Nodeのシャットダウン 事前準備編に関しては、クラスタシャットダウンを実施する当日以前に実施することが可能です。 ■事前準備編 1.下記を参照して、クラスタの健全性を確認します。 VxRail: Health Check 方法 特に「データ」-「VSANオブジェクトの健全性」の項目にて、「健全」以外の項目がすべて0であることを確認します。 また、念の為、下記のログを取得しておくことを推奨します。 vCenter vSAN health status script 取得手順 2.すべてのESXiホストがNTPで時刻同期されていることを確認します。 https://kb.vmware.com/s/article/57147 3.VMware KB#60424(https:/kb.vmware.com/s/article/60424) に添付されている2つのスクリプト「pre_reboot.sh」「post_reboot.sh」をPCのデスクトップなどにダウンロードし、 すべてのESXiホストのサービスデータストア(VSAN以外のデータストア)に配置します。 ※KB添付のscriptは予告なく名称並びに構文が修正されることがあります。都度KBをご確認頂き、最新のものをご使用下さい。 ダウンロードしたスクリプトをホストに配置する方法としては、下記のような手順があります。 どちらを利用いただいても問題ありません。 A. scp(WinSCPやFileZillaなどのファイル転送ソフトウェア)を用いる A-1. 各ESXiホストのsshを有効にする。 ESXi、vCenter、PSCのSSH有効化 A-2. ファイル転送ソフトでESXiホストに接続する。 A-3. /vmfs/volumes配下のxxxxxxxxxxxxx-01-01-service-datastore1という名前のフォルダに移動し、ここに2つのスクリプトをアップロードします。 B. 各ESXiホストのHost Clientにアクセスし、データストアブラウザを利用する。 4.各ESXiホストにsshでログインし、配置した2つのスクリプトを編集します。 ESXi、vCenter、PSCのSSH有効化 4-1. 2つのスクリプトに実行権限を付与します。 ・ls コマンドでファイルを転送したservice-datastore1のディレクトリに2つのスクリプト「pre_reboot.sh」「post_reboot.sh」があることを確認。 ※cd でディレクトリ移動するとディレクトリ名が変わりますが、問題ございません [root@esxi01:~] cd /vmfs/volumes/DE700xxxxxxx16-01-01-service-datastore1/ [root@esxi01:/vmfs/volumes/5d330ce3-a0099b84-7fbe-XXXXXXXXXXXX] ls idrac post_reboot.sh ptagent vmkdump images pre_reboot.sh reset order pservice vibs [root@esxi01:/vmfs/volumes/5d330ce3-a0099b84-7fbe-XXXXXXXXXXXX] ls -l total 1024 drwxr-xr-x 1 root root 73728 Jul 22 09:00 idrac drwxr-xr-x 1 root root 73728 Jul 20 15:37 images drwxr-xr-x 1 root root 73728 Jul 20 12:55 order -rw-r--r-- 1 root root 498 Jul 24 12:43 post_reboot.sh -rw-r--r-- 1 root root 346 Jul 24 12:43 pre_reboot.sh drwxr-xr-x 1 root root 69632 Jul 20 13:00 pservice drwxr-xr-x 1 root root 73728 Jul 22 09:00 ptagent drwxr-xr-x 1 root root 73728 Jul 20 13:02 reset drwxr-xr-x 1 root root 73728 Jul 20 12:55 vibs d-w-r-xr-T 1 root root 73728 Jul 20 13:36 vmkdump ・chmodコマンドで実行権限を付与(chmod +x <ファイル名>) [root@esxi01:/vmfs/volumes/5d330ce3-a0099b84-7fbe-XXXXXXXXXXXX] chmod +x post_reboot.sh [root@esxi01:/vmfs/volumes/5d330ce3-a0099b84-7fbe-XXXXXXXXXXXX] chmod +x pre_reboot.sh ・実行権限が付与されていることを確認(-rwxr-xr-x のような出力結果になります) [root@esxi01:/vmfs/volumes/5d330ce3-a0099b84-7fbe-XXXXXXXXXXXX] ls -l total 1024 drwxr-xr-x 1 root root 73728 Jul 22 09:00 idrac drwxr-xr-x 1 root root 73728 Jul 20 15:37 images drwxr-xr-x 1 root root 73728 Jul 20 12:55 order -rwxr-xr-x 1 root root 498 Jul 24 12:43 post_reboot.sh -rwxr-xr-x 1 root root 346 Jul 24 12:43 pre_reboot.sh drwxr-xr-x 1 root root 69632 Jul 20 13:00 pservice drwxr-xr-x 1 root root 73728 Jul 22 09:00 ptagent drwxr-xr-x 1 root root 73728 Jul 20 13:02 reset drwxr-xr-x 1 root root 73728 Jul 20 12:55 vibs d-w-r-xr-T 1 root root 73728 Jul 20 13:36 vmkdump 4-2. VSANネットワークの情報をバックアップし、現在の設定値を確認します。 [root@esxi01:~] esxcli vsan network list > /tmp/vsan_network_list_backup.txt ・"VmkNic Name"のvmkを確認(下記の場合はvmk3となります) [root@esxi01:~] esxcli vsan network list Interface VmkNic Name: vmk3 IP Protocol: IP Interface UUID: 1334335d-8295-a311-5c11-e4434b18d3b4 Agent Group Multicast Address: 224.2.3.4 Agent Group IPv6 Multicast Address: ff19::2:3:4 Agent Group Multicast Port: 23451 Master Group Multicast Address: 224.1.2.3 Master Group IPv6 Multicast Address: ff19::1:2:3 Master Group Multicast Port: 12345 Host Unicast Channel Bound Port: 12321 Multicast TTL: 5 Traffic Type: vsan 4-3. 4-2で確認した内容を基に、2つのスクリプトファイルを編集します。 ・pre_reboot.shには「esxcli vsan network ip remove -i <VMkNic Name>」の一文を追加 ※上記出力例の場合は、<VMkNic Name> に vmk3を当てはめます [root@esxi01:~] vi /vmfs/volumes/DE700xxxxxxx16-01-01-service-datastore1/pre_reboot.sh #!/bin/sh # Using the output of the command 'esxcli van network list', find # the names of the vmknics and their associated traffic types. # # For each of those vmknics add one command to disable vsan traffic # using the following command. # # esxcli vsan network ip remove -i <VMkNic Name> # # Ex: # esxcli vsan network ip remove -i vmk98 esxcli vsan network ip remove -i vmk3 ・post_reboot.shには「esxcli vsan network ip add -i <VMkNic Name> -T=<Traffic Type>」の一文を追加 ※上記出力例の場合は、<VMkNic Name> に vmk3を当てはめ、<Traffic Type>はvsanをあてはめます [root@esxi01:~] vi /vmfs/volumes/DE700xxxxxxx16-01-01-service-datastore1/post_reboot.sh #!/bin/sh # Make sure to do this before running pre_reboot.sh on hosts. # # Using the output of the command 'esxcli van network list', find # the names of the vmknics and their associated traffic types. # # For each of those vmknics add one command to enable vsan traffic # using the following command. # # # esxcli vsan network ip add -i <VMkNic Name> -T=<Traffic Type> # # Ex 1: # esxcli vsan network ip add -i vmk98 -T=vsan # Ex 2: # esxcli vsan network ip add -i vmk99 -T=witness esxcli vsan network ip add -i vmk3 -T=vsan ■VSAN切り離し・シャットダウン編 【注意】 外部vCenterにてvSAN Clusterを管理している場合、ESXiホストをメンテナンスモードに移行時に不要な仮想マシンの移動を防ぐため、 Shutdownする予定のvSAN Clusterの設定で、vSphere HAは”OFF(オフ)”、DRSは"Manual(手動)"への変更を推奨させていただきます。 5.vCenter Server ApplianceとPlatform Service Controllerを除くすべての仮想マシンをシャットダウンします。 6.データの移行(resync)が動作していないことを確認します。 A. vCSAへsshでログインし、RVCで確認 EMC Community Network - DECN: VxRail: RVC(Ruby vSphere Console) ベーシック Connected to service * List APIs: "help api list" * List Plugins: "help pi list" * Launch BASH: "shell" Command> shell Shell access is granted to root root@tsevxrail-vcsa [ ~ ]# rvc Install the "ffi" gem for better tab completion. Host to connect to (user@host): administrator@vsphere.local@localhost password: 0 / 1 localhost/ > cd 1 /localhost> ls 0 VxRail-Datacenter (datacenter) /localhost> cd 0 /localhost/VxRail-Datacenter> ls 0 storage/ 1 computers [host]/ 2 networks [network]/ 3 datastores [datastore]/ 4 vms [vm]/ /localhost/VxRail-Datacenter> cd 1 /localhost/VxRail-Datacenter/computers> ls 0 VxRail-Virtual-SAN-Cluster-5805c8ee-d3cd-4af5-9988-XXXXXXXXXXXX (cluster): cpu 290 GHz, memory 905 GB /localhost/VxRail-Datacenter/computers> vsan.resync_dashboard 0 2019-07-28 00:43:25 +0000: Querying all VMs on vSAN ... 2019-07-28 00:43:25 +0000: Querying all objects in the system from tsevxrail-esxi02.cpsd.local ... 2019-07-28 00:43:25 +0000: Got all the info, computing table ... +-----------+-----------------+---------------+ | VM/Object | Syncing objects | Bytes to sync | +-----------+-----------------+---------------+ +-----------+-----------------+---------------+ | Total | 0 | 0.00 GB | +-----------+-----------------+---------------+ B. vSphere 6.5(VxRail4.5)以降の場合、ESXiホストにsshでログインして確認 [root@esxi01:~] esxcli vsan debug resync summary get Total Number Of Resyncing Objects: 0 Total Bytes Left To Resync: 0 Total GB Left To Resync: 0.00 7.データの移行が無いことを確認したら、PSC -> VCSAの順にシャットダウンします。 起動時に困らないように、PSCおよびVCSAが稼働しているESXiホストをメモします。 シャットダウンの手順は様々ありますが、下記は例としてVAMI(アプライアンス管理インターフェース)からのシャットダウン手順をご案内します。 VAMI(アプライアンス管理インターフェース)へアクセスするには、それぞれ、VCSA/PSCのIP address宛にhttpsで5480ポートを指定してアクセスできます。 https://VCSA-ip-address:5480/ https://PSC-ip-address:5480/ 8.すべてのESXiホストにて、crontabを編集していきます。 ※すべてのESXiホストで同時に実行する必要があるため、8-3で設定する時刻はNode数と作業の手際を考慮した時刻で設定してください 8-1. rootのcrontabのバックアップをとっておく [root@esxi01:~] cp /var/spool/cron/crontabs/root /vmfs/volumes/DE700xxxxxxx16-01-01-service-datastore1/root_crontab.BKP 8-2. システムの現在時刻を確認する(VxRailではUTC <JST-9> のTimezoneとなります) [root@esxi01:~] date Sun Jul 28 03:38:56 UTC 2019 8-3. viコマンドでcrontabを編集し、下記のようなpre_reboot.shスクリプトを実行する1文を記載します [root@esxi01:~] vi /var/spool/cron/crontabs/root #min hour day mon dow command 1 1 * * * /sbin/tmpwatch.py 1 * * * * /sbin/auto-backup.sh 0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py */5 * * * * /bin/hostd-probe.sh ++group=host/vim/vmvisor/hostd-probe/stats/sh 00 1 * * * localcli storage core device purge */2 * * * * /usr/lib/vmware/vsan/bin/vsanObserver.sh ++group=host/vim/vmvisor/vsanobserver */5 * * * * /usr/lib/emc/secure_process.sh "timeout -t 90 /usr/bin/env python /bin/marvin-endpoint-post" 0 * * * * /bin/sh /opt/dell/DellPTAgent/scripts/clearTmpFile.sh */5 * * * * python /opt/dell/DellPTAgent/scripts/PTAgent_Monitor_35.pyc */15 * * * * /usr/lib/emc/collector.sh >> /var/log/emc/logs/mystic-collector.log 2>&1 */1 * * * * /usr/lib/emc/secure_process.sh "/usr/lib/emc/shutdown_ESX.py" 30 4 28 7 * /vmfs/volumes/DE700xxxxxxx16-01-01-service-datastore1/pre_reboot.sh ※数字は左から分 時 日 月となりますので、上記例の場合、7/28 4:30(UTC<JST-9>)にpre_reboot.shを実行するように指定してあります。 ※post_reboot.shは起動時に使用するスクリプトのため、シャットダウン時には設定しないでください ※すべてのHostで同様の内容にしてください 8-4. 下記コマンドを実行してcrondを再起動し、編集したcrontabの内容を適用させます。 [root@esxi01:~] kill -HUP $(cat /var/run/crond.pid) [root@esxi01:~] /usr/lib/vmware/busybox/bin/busybox crond 8-5. 指定した時刻が過ぎてから、下記コマンドをすべてのESXiホストで実行し、cron jobの内容が問題なく実行されたことを確認します [root@esxi01:~] esxcli vsan cluster get | grep "Local Node State" Local Node State: MASTER ※スクリプト実行前などでは、BACKUPやAGENTといったStateのNodeが存在します。すべてのESXiホストでMASTERステータスであれば、 問題なくcron jobでコマンドが実行されたことを確認できます なお、出力結果として”Local Node State: DISCOVER”と表示される場合があります。 その際、localcliコマンドで MASTERステータスであれば、問題なくcron jobが実行された と判断して構いません。 [root@esxi01:~] localcli vsan cluster get | grep "Local Node State" Local Node State: MASTER 9.各ESXiホストをメンテナンスモード(esxcli system maintenanceMode set -e true -m noAction)に入れた後、Nodeのシャットダウンを実施します。 ※シャットダウンはHost clientまたはDCUI経由にて実施し、iDRACの電源管理などから実施しないようにしてください その他参考:VxRail:nodeの停止/起動(メンテナンスモードの終了) 手順 9-1. esxcliコマンドを使用して、ESXiをメンテナンスモードに移行 "esxcli system maintenanceMode get"にて、メンテナンスモードかどうかの確認(Enableの場合、メンテナンスモード状態) "esxcli system maintenanceMode set -e true -m noAction"にて、No Actionのオプションでメンテナンスモードへ移行実施 [root@esxi01:~] esxcli system maintenanceMode get Disabled [root@esxi01:~] esxcli system maintenanceMode set -e true -m noAction [root@esxi01:~] esxcli system maintenanceMode get Enabled 9-2. vSphere Host Client または、DCUIよりESXiのShutdownを実施 下記はDCUIでの操作を例にします ESXi shellの画面にいる場合、[Alt] + [F2]を押してESXiの画面に移動してから、[F12] を押しESXiのroot userでLoginを実施 ※password入力時は、"Login name"の部分で正しくキーボード入力されるか確認してから実施すると良いです 仮想コンソールのキーボード設定によって"@"などの位置が違う場合がございます "Shutdown/Restart"のMenuが表示されるので、[F2] Shut Downを選択してESXiのShutdownを実施してください VxRail のvSAN Clusterの全てのESXiにて実施してください。