5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Proxmox上のCephクラスタにRBDを作成し、ライブマイグレーションする

Posted at

こんにちは。
株式会社クラスアクト インフラストラクチャ事業部の大塚です。

前回、Promoxクラスタ上にCeph環境を構築し、Cephが提供するサービス?の一つであるCephFSを軽く使ってみました。

今回はCephサービスの1つであるRBDを作成し、それを使ってVMを立ち上げていきたいと思います。また、クラスタのノード間でVMをライブマイグレーションさせたいと思います。以下の記事の正統進化みたいなイメージです。

用語

RBD

以前こちらで軽く説明しているので、こちらの記事では割愛します。

環境イメージ

今回の構築イメージは以下となります。
RBDをクラスタ上に作成し、そのRBDを使ったVMを立ち上げます。
その後ライブマイグレーションをやってみます。
proxmox-ページ2.drawio.png

構築

RBDを作成する

Proxmox Cluster内の適当なノードを選択し、Ceph内にあるPoolsを押下します。
Createを押下しましょう。
image (24).png
任意のPool名を入力し、Createを押下します。
今回はRBD_POOLとしました。
image (26).png
Pools上のリストにRBD_POOLが作成されていることを確認します。
また各ノード上でもRBD_POOLが表示されてることを確認します。
image (27).png

RBDを使ってVMを立ち上げる

作成したRBDを使ってVMを立ち上げます。pve02ノードに今回は立ち上げます。VM名はMySQLとしました。
image (28).png
ISOはCephFSに格納しているubuntu22.04を選択しました。
image (29).png
DiskのStorage欄で今回作成したRBDを選択します。
image (30).png
その他のHWの設定は以下を参照。この状態で立ち上げました。
image (31).png
立ち上げたときのイメージは以下です。
image.png

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を押下します。
image.png
pve01に移動したいため、Target nodeにpve01を選択し、Migrateを押下します。
image.png
TASK OKと表示されればOKです。
image.png
MySQL VMがpve01に移動することを確認します。
image.png

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)
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?