こんにちは。
株式会社クラスアクト インフラストラクチャ事業部の大塚です。
前回、Promoxクラスタ上にCeph環境を構築し、Cephが提供するサービス?の一つであるCephFSを軽く使ってみました。
今回はCephサービスの1つであるRBDを作成し、それを使ってVMを立ち上げていきたいと思います。また、クラスタのノード間でVMをライブマイグレーションさせたいと思います。以下の記事の正統進化みたいなイメージです。
用語
RBD
以前こちらで軽く説明しているので、こちらの記事では割愛します。
環境イメージ
今回の構築イメージは以下となります。
RBDをクラスタ上に作成し、そのRBDを使ったVMを立ち上げます。
その後ライブマイグレーションをやってみます。
構築
RBDを作成する
Proxmox Cluster内の適当なノードを選択し、Ceph内にあるPoolsを押下します。
Createを押下しましょう。
任意のPool名を入力し、Createを押下します。
今回はRBD_POOLとしました。
Pools上のリストにRBD_POOLが作成されていることを確認します。
また各ノード上でもRBD_POOLが表示されてることを確認します。
RBDを使ってVMを立ち上げる
作成したRBDを使ってVMを立ち上げます。pve02ノードに今回は立ち上げます。VM名はMySQLとしました。
ISOはCephFSに格納しているubuntu22.04を選択しました。
DiskのStorage欄で今回作成したRBDを選択します。
その他のHWの設定は以下を参照。この状態で立ち上げました。
立ち上げたときのイメージは以下です。
MySQL環境をセットアップし、ライブマイグレーションをしてみる
立ち上げたVMにMySQLをインストールしていきます。
root@mysql:~# apt update
root@mysql:~# apt upgrade -y
root@mysql:~# apt install -y mysql-server mysql-client
root@mysql:~# systemctl start mysql.service
root@mysql:~# systemctl enable mysql.service
Synchronizing state of mysql.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable mysql
mysqlに入るためのrootユーザのパスワードを変更します。
root@mysql:~# mysqladmin -u root password
New password:
Confirm new password:
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
適当なDBを作成します。
root@mysql:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.34-0ubuntu0.22.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.01 sec)
mysql> create database test;
Query OK, 1 row affected (0.61 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.02 sec)
この状態でライブマイグレーションを行います。
ProxmoxのUI右上にあるMigrateを押下します。
pve01に移動したいため、Target nodeにpve01を選択し、Migrateを押下します。
TASK OKと表示されればOKです。
MySQL VMがpve01に移動することを確認します。
MySQLも問題なさそうですね。
root@mysql:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.34-0ubuntu0.22.04.1 (Ubuntu)
Copyright (c) 2000, 2023, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.01 sec)