Cluster Shellとは

Introduction — clustershell 1.9.3 documentation
clustershell.readthedocs.io

概要

Cluster Shellは、クラスタ管理用の軽量かつ統一されたPythonフレームワークです。大規模なクラスタを効率的に管理するために設計されており、以下の特徴を持ちます。

ClusterShellはフランスのCEAのHPC開発チームによって開発され、スーパーコンピュータ管理で利用されています。

仕組み

コマンド実行エンジン


導入方法 - RHEL9

Installation — clustershell 1.9.3 documentation
clustershell.readthedocs.io

EPELからのインストール方法

EPELを有効にする (していない場合):

dnf --enablerepo=extras install epel-release

ClusterShellをインストール:

dnf install clustershell

Configuration

基本的な設定ファイルは以下の場所にあります。

groups.confでグループ定義の参照先を設定し、cluster.yamlが実際のグループ定義ファイルとなります。clush.confclushコマンドの挙動を調整する設定ファイルです。

clush の設定

/etc/clustershell/clush.confを設定します。以下は公式ドキュメントからの引用です。

KeyValue
fanoutSize of the sliding window of connectors (eg. max number of ssh allowed to run at the same time).
connect_timeoutTimeout in seconds to allow a connection to establish.
command_timeoutTimeout in seconds to allow a command to complete since the connection has been established.
colorWhether to use ANSI colors. Valid arguments: never, always, auto.
fd_maxMaximum number of open file descriptors permitted per clush process.
history_sizeMaximum number of history entries saved.
node_countShould clush display additional node count information? (yes/no)
maxrcShould clush return the largest of command return codes? (yes/no)
ssh_userSet the ssh user to use for remote connection.
ssh_pathSet the ssh binary path.
ssh_optionsSet additional options to pass to the ssh command.
scp_pathSet the scp binary path.
scp_optionsSet additional options to pass to the scp command.

groups.conf

YAMLファイルを参照させるためにgroups.confを編集します。

cat /etc/clustershell/groups.conf
# ClusterShell node groups main configuration file
[Main]
default: roles
confdir: /etc/clustershell/groups.conf.d $CFGDIR/groups.conf.d
autodir: /etc/clustershell/groups.d $CFGDIR/groups.d
# ... (rest of the file)
[local]
map: [ -f $CFGDIR/groups ] && f=$CFGDIR/groups || f=$CFGDIR/groups.d/local.cfg; sed -n 's/^$GROUP:\(.*\)/\1/p' $f
all: [ -f $CFGDIR/groups ] && f=$CFGDIR/groups || f=$CFGDIR/groups.d/local.cfg; sed -n 's/^all:\(.*\)/\1/p' $f
list: [ -f $CFGDIR/groups ] && f=$CFGDIR/groups || f=$CFGDIR/groups.d/local.cfg; sed -n 's/^\([0-9A-Za-z_-]*\):.*/\1/p' $f

cluster.yaml

cat /etc/clustershell/groups.d/cluster.yaml
roles:
  group1: 'node01'
  group2: 'wn[01-99]'   
  gather:
    - 'node01'
    - 'wn[01-99]'

  all: '@group1,@group2'

使用例

定義したグループの確認:

nodeset -LL

コマンドが作動するか確認:

clush -w @all df -h

任意のグループに対してコマンドを実行:

clush -w @worker_node condor_status

任意のグループへ設定ファイルを配布:

# First, create the file on the admin server
vi myfile.conf

# Then, copy it to the destination on all nodes in the group
clush -w @group -c myfile.conf --dest=/etc/myfile.conf

特定のノードを指定してコマンドを実行:

clush -w wn[02,03] "ip addr"