0
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?

Slurm:galera cluster(mariadb)を使った冗長構成①

Last updated at Posted at 2025-03-12

#概要

最初slurmのactive/standbyを検証してみようかと考えていたのですが、DBの切替めんどいなぁっ、スクリプト書いて切り替えるぐらいなら、active/activeにトライしてみようと思い立ち挑戦することにしました。ただ厳密に言えば、slurm自身にactive/activeの機能はありません。

slurmctld,slurmdbd共にactive/standby機能があるので、ちゃんとフェイルオーバーするのかも検証していきたいと思います。

今回の記事はいつもお世話になっている Server Worldの記事を参考にmariadbとgalera clusterのインストールと設定をしていきます。

ざっくり構成としてはこんな感じです

スクリーンショット 2025-03-12 20.53.29.png

galera clusterとmariadbのインストール

のっけから、書いてある情報と違うインストールですがslurmをソースからコンパイルしている関係上
開発パッケージもインストールしています。

bash(プライマリ,セカンダリ共通)
apt install -y mariadb-server mariadb-devel
apt install -y mariadb-client libmariadb-dev libmariadb-dev-compat
apt install -y galera-4 

slurm_acct_db24の作成

ここもoracleの情報を使って設定します。

セカンダリ側は設定しません。

プライマリ側(slurm2411m)
$mysql

MariaDB [(none)]> create database slurm_acct_db24;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create user 'slurm'@'localhost' identified by 'slurm';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> set password for slurm@localhost = password('slurm');
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> grant all on slurm_acct_db24.* TO 'slurm'@'localhost';
Query OK, 0 rows affected (0.000 sec)

GRANT ALL PRIVILEGES ON slurm_acct_db24.* TO 'slurm'@'slurm2411m' IDENTIFIED BY 'slurm';
Query OK, 0 rows affected (0.000 sec)

GRANT ALL PRIVILEGES ON slurm_acct_db24.* TO 'slurm'@'slurm2411m2' IDENTIFIED BY 'slurm';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)

galera clusterの設定(プライマリ側)

systemctl stop mariadb で停止した上で設定ファイルを修正

slurm2411m:/etc/mysql/mariadb.conf.d/50-server.cnf

# 27行目をコメントアウト
#bind-address            = 127.0.0.1

#最後に追加
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# クラスタ名は、プライマリ・セカンダリ共通
wsrep_cluster_name="mysql_cluster"
# 自ホストのIPアドレス
wsrep_node_address="10.100.100.71"
# プライマリ、セカンダリの順で記述。
wsrep_cluster_address="gcomm://10.100.100.71,10.100.100.69"

galera clusterの設定(セカンダリ側)

systemctl stop mariadb で停止した上で設定ファイルを修正

slurm2411m2:/etc/mysql/mariadb.conf.d/50-server.cnf

# 27行目をコメントアウト
#bind-address            = 127.0.0.1

#最後に追加
[galera]
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# プライマリ側と同じ記述
wsrep_cluster_address="gcomm://10.100.100.71,10.100.100.69"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# プライマリと同じクラスタ名を記述
wsrep_cluster_name="mysql_cluster"
#自ホストのIPを記述
wsrep_node_address="10.100.100.69"

クラスターの起動

プライマリ側のmariadbを起動してから、クラスタの起動を行います。
ここら辺は非常に簡単でエラーがなければサクッと進んで下さい

slurm2411m(プライマリ)側
systemctl start mariadb
galera_new_cluster
slurm2411m2側(セカンダリ)側
systemctl start mariadb

クラスターの確認

クラスターが正常起動しているか確認します。この段階では詳細にactive-activeの確認は行いません。

bash:slurm2411m2(セカンダリ)側

#プライマリ側で作成した"slurm_acct_db24"がセカンダリ側で見えている事を確認
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| slurm_acct_db24    |
| sys                |
+--------------------+
5 rows in set (0.001 sec)

# プライマリ側とセカンダリ側が同期しているか確認
# 基本| wsrep_local_state_comment     | Synced  になっていたらOK

MariaDB [(none)]> show status like 'wsrep_%'; 
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| Variable_name                 | Value                                                                                                                                          |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
| wsrep_local_state_uuid        | 68f4bd32-fee4-11ef-969a-e236893ae3d0                                                                                                           |
| wsrep_protocol_version        | 10                                                                                                                                             |
| wsrep_last_committed          | 507                                                                                                                                            |
| wsrep_replicated              | 26                                                                                                                                             |
| wsrep_replicated_bytes        | 22104                                                                                                                                          |
| wsrep_repl_keys               | 59                                                                                                                                             |
| wsrep_repl_keys_bytes         | 1096                                                                                                                                           |
| wsrep_repl_data_bytes         | 19297                                                                                                                                          |
| wsrep_repl_other_bytes        | 0                                                                                                                                              |
| wsrep_received                | 488                                                                                                                                            |
| wsrep_received_bytes          | 483143                                                                                                                                         |
| wsrep_local_commits           | 2                                                                                                                                              |
| wsrep_local_cert_failures     | 0                                                                                                                                              |
| wsrep_local_replays           | 0                                                                                                                                              |
| wsrep_local_send_queue        | 0                                                                                                                                              |
| wsrep_local_send_queue_max    | 1                                                                                                                                              |
| wsrep_local_send_queue_min    | 0                                                                                                                                              |
| wsrep_local_send_queue_avg    | 0                                                                                                                                              |
| wsrep_local_recv_queue        | 0                                                                                                                                              |
| wsrep_local_recv_queue_max    | 3                                                                                                                                              |
| wsrep_local_recv_queue_min    | 0                                                                                                                                              |
| wsrep_local_recv_queue_avg    | 0.022541                                                                                                                                       |
| wsrep_local_cached_downto     | 2                                                                                                                                              |
| wsrep_flow_control_paused_ns  | 0                                                                                                                                              |
| wsrep_flow_control_paused     | 0                                                                                                                                              |
| wsrep_flow_control_sent       | 0                                                                                                                                              |
| wsrep_flow_control_recv       | 0                                                                                                                                              |
| wsrep_flow_control_active     | false                                                                                                                                          |
| wsrep_flow_control_requested  | false                                                                                                                                          |
| wsrep_cert_deps_distance      | 8.16501                                                                                                                                        |
| wsrep_apply_oooe              | 0                                                                                                                                              |
| wsrep_apply_oool              | 0                                                                                                                                              |
| wsrep_apply_window            | 1                                                                                                                                              |
| wsrep_apply_waits             | 0                                                                                                                                              |
| wsrep_commit_oooe             | 0                                                                                                                                              |
| wsrep_commit_oool             | 0                                                                                                                                              |
| wsrep_commit_window           | 1                                                                                                                                              |
| wsrep_local_state             | 4                                                                                                                                              |
| wsrep_local_state_comment     | Synced                                                                                                                                         |
| wsrep_cert_index_size         | 192                                                                                                                                            |
| wsrep_causal_reads            | 0                                                                                                                                              |
| wsrep_cert_interval           | 0                                                                                                                                              |
| wsrep_open_transactions       | 0                                                                                                                                              |
| wsrep_open_connections        | 0                                                                                                                                              |
| wsrep_incoming_addresses      | 10.100.100.69:0,10.100.100.71:0                                                                                                                |
| wsrep_cluster_weight          | 2                                                                                                                                              |
| wsrep_desync_count            | 0                                                                                                                                              |
| wsrep_evs_delayed             |                                                                                                                                                |
| wsrep_evs_evict_list          |                                                                                                                                                |
| wsrep_evs_repl_latency        | 0/0/0/0/0                                                                                                                                      |
| wsrep_evs_state               | OPERATIONAL                                                                                                                                    |
| wsrep_gcomm_uuid              | 891943fd-fee4-11ef-a535-578502acbe56                                                                                                           |
| wsrep_gmcast_segment          | 0                                                                                                                                              |
| wsrep_applier_thread_count    | 1                                                                                                                                              |
| wsrep_cluster_capabilities    |                                                                                                                                                |
| wsrep_cluster_conf_id         | 4                                                                                                                                              |
| wsrep_cluster_size            | 2                                                                                                                                              |
| wsrep_cluster_state_uuid      | 68f4bd32-fee4-11ef-969a-e236893ae3d0                                                                                                           |
| wsrep_cluster_status          | Primary                                                                                                                                        |
| wsrep_connected               | ON                                                                                                                                             |
| wsrep_local_bf_aborts         | 0                                                                                                                                              |
| wsrep_local_index             | 0                                                                                                                                              |
| wsrep_provider_capabilities   | :MULTI_MASTER:CERTIFICATION:PARALLEL_APPLYING:TRX_REPLAY:ISOLATION:PAUSE:CAUSAL_READS:INCREMENTAL_WRITESET:UNORDERED:PREORDERED:STREAMING:NBO: |
| wsrep_provider_name           | Galera                                                                                                                                         |
| wsrep_provider_vendor         | Codership Oy <info@codership.com>                                                                                                              |
| wsrep_provider_version        | 4.9(rcece3ba2)                                                                                                                                 |
| wsrep_ready                   | ON                                                                                                                                             |
| wsrep_rollbacker_thread_count | 1                                                                                                                                              |
| wsrep_thread_count            | 2                                                                                                                                              |
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------+
69 rows in set (0.002 sec)



最後に

今回はslurmを冗長構成にするための要であるgalera clusterの作成まで進めました。
次回はslurmdbdとslurmctldのactive/standby検証まで行います。

0
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
0
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?