1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

分散シェル(pdsh)を使ってサーバ管理を楽したい

Last updated at Posted at 2024-03-01

本記事ではHPC(俗に言うスパコン)等の多ノードのサーバ管理を楽したいという方向けに作成しています。
今回は以下の手順で進めていきます。

  • epelリポジトリの追加
  • pdshのインストール
  • ssh公開鍵の設定
  • テスト

すべてログインノードでroot作業します。

環境情報

ノード名 ホスト名 IPアドレス OS
ログインノード smm2-ln 192.168.122.10 Rocky Linux 8.9
計算ノード smm2-cn00 192.168.122.20 Rocky Linux 8.9
計算ノード smm2-cn01 192.168.122.21 Rocky Linux 8.9

構築準備

ログインノードにepelリポジトリを追加

pdsh関連のパッケージをインストールするためにはepelリポジトリを下記コマンドで追加してください。

# yum install -y epel-release

ログインノードにpdshをインストール

# yum install -y pdsh pdsh-mod-dshgroup pdsh-rcmd-ssh.x86_64

ログインノードでssh公開鍵を作成

# ssh-keygen -t ed25519

計算ノードに作成した公開鍵を送りつける

# ssh-copy-id -i /root/.ssh/id_ed25519.pub root@192.168.122.20
# ssh-copy-id -i /root/.ssh/id_ed25519.pub root@192.168.122.21

パスワードレスでログインノードから計算ノードにrootログインできるか確認。

# ssh 192.168.122.20
# ssh 192.168.122.21

ログインノードの/etc/hostsに計算ノードのホスト名とIPアドレスを記載

# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.122.20  smm2-cn00
192.168.122.21  smm2-cn01

ホスト名でログインノードから計算ノードにrootログインしてみる

# ssh smm2-cn00
# ssh smm2-cn01

pdsh設定

グループ定義作成

ログインノードに以下のディレクトリを作成し、作成したディレクトリ配下にグループを定義します。
今回はcnというグループ名で定義していきます。

# mkdir -p /etc/dsh/group/
# vim /etc/dsh/group/cn
smm2-cn00
smm2-cn01

pdshテスト

下記のようにコマンド結果が返ってくればpdshの導入は完了です。

# pdsh -g cn "cat /etc/redhat-release" | dshbak
----------------
smm2-cn00
----------------
Rocky Linux release 8.9 (Green Obsidian)
----------------
smm2-cn01
----------------
Rocky Linux release 8.9 (Green Obsidian)`
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?