GA

2024/01/20

xtrabackup + InnoDB TDE / keyring_file_dataで--prepareと--move-back 続き

日々の覚書: xtrabackup + InnoDB TDE / keyring_file_dataで--prepareと--move-back の続き

keyring_file_dataを真面目に与えなくても何故か —prepare できてしまったのが謎だったので書き込みながら。

$ for n in {101..10000} ; do
> sudo mysql -e "INSERT INTO d1.t1 VALUES ($n)"
> done
$ sudo xtrabackup --backup -uroot --stream=xbstream | pzstd -dc > test.xb.zst
2024-01-20T05:23:28.912847-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --datadir=/var/lib/mysql
2024-01-20T05:23:28.913000-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --user=root --stream=xbstream
xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
..

$ mkdir backup_with_running
$ cd backup_with_running
$ pzstd -dc ../test.xb.zst | xbstream -x
$ xtrabackup --prepare --target-dir=./ --keyring-file-data=/tmp/dummy2
2024-01-20T05:27:26.978005-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=0 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0
2024-01-20T05:27:26.978103-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=./ --keyring-file-data=/tmp/dummy2
xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
..
2024-01-20T05:27:27.080448-00:00 0 [Note] [MY-012552] [InnoDB] Starting crash recovery.
2024-01-20T05:27:27.080686-00:00 0 [Note] [MY-013086] [InnoDB] Starting to parse redo log at lsn = 20334092, whereas checkpoint_lsn = 20334355 and start_lsn = 20334080
2024-01-20T05:27:27.083746-00:00 0 [Note] [MY-012550] [InnoDB] Doing recovery: scanned up to log sequence number 20923858
2024-01-20T05:27:27.143189-00:00 0 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2024-01-20T05:27:27.192664-00:00 0 [Note] [MY-012532] [InnoDB] Applying a batch of 302 redo log records ...
2024-01-20T05:27:27.193694-00:00 0 [Note] [MY-012533] [InnoDB] 10%
2024-01-20T05:27:27.194170-00:00 0 [Note] [MY-012533] [InnoDB] 20%
2024-01-20T05:27:27.194838-00:00 0 [Note] [MY-012533] [InnoDB] 30%
2024-01-20T05:27:27.194982-00:00 0 [Note] [MY-012533] [InnoDB] 40%
2024-01-20T05:27:27.195690-00:00 0 [Note] [MY-012533] [InnoDB] 50%
2024-01-20T05:27:27.196225-00:00 0 [Note] [MY-012533] [InnoDB] 60%
2024-01-20T05:27:27.196386-00:00 0 [Note] [MY-012533] [InnoDB] 70%
2024-01-20T05:27:27.196937-00:00 0 [Note] [MY-012533] [InnoDB] 80%
2024-01-20T05:27:27.197047-00:00 0 [Note] [MY-012533] [InnoDB] 90%
2024-01-20T05:27:27.198439-00:00 0 [Note] [MY-011825] [InnoDB] Encryption information in datafile: ./d1/t1.ibd can't be decrypted, please confirm that keyring is loaded.
2024-01-20T05:27:27.198468-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Invalid encryption metadata in tablespace header.
2024-01-20T05:27:27.198477-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Unable to decrypt. Please check if xtrabackup is configured correctly to access the keyring plugin or component. Check --xtrabackup-plugin-dir. Also verify if valid keyring_file_data is passed with the option --keyring_file_data. If keyring component is used, check if --component-keyring-config points to valid configuration

ちゃんと転けた。やっぱり暗号対象テーブルスペースがクラッシュリカバリ対象にならない限りは復号化が必要ないから 前回 は転けなかったので合ってるらしい。

さて、ここまで整理がついたので、本題(?) の「rpmではないバイナリtarボールを展開したxtrabackupでパスの様子を見る」をやる。

$ wget https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.35-30/binary/tarball/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17.tar.gz
$ tar xf percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17.tar.gz
$ sudo ./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --backup -uroot --stream=xbstream | pzstd -c > test.xb.zst
2024-01-20T05:57:43.365008-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --datadir=/var/lib/mysql
2024-01-20T05:57:43.365115-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --user=root --stream=xbstream
./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
240120 05:57:43  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup' as 'root'  (using password: NO).
240120 05:57:43  version_check Connected to MySQL server
240120 05:57:43  version_check Executing a version check against the server...
240120 05:57:43  version_check Done.
2024-01-20T05:57:43.425978-00:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: not set, port: not set, socket: not set
2024-01-20T05:57:43.426090-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Failed to connect to MySQL server: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

そもそもtarボール版だと --socket の暗黙のデフォルトの値が違う。

$ sudo ./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --backup -uroot --stream=xbstream --socket=/var/lib/mysql/mysql.sock | pzstd -c > test.xb.zst
2024-01-20T06:00:06.747082-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --datadir=/var/lib/mysql
2024-01-20T06:00:06.747179-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --user=root --stream=xbstream --socket=/var/lib/mysql/mysql.sock
./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49
..
2024-01-20T06:00:06.846775-00:00 0 [Note] [MY-011825] [Xtrabackup] Added plugin 'keyring_file.so' to load list.
2024-01-20T06:00:06.847814-00:00 0 [ERROR] [MY-010901] [Server] Can't open shared library '/mnt/jenkins/workspace/percona-xtrabackup-8.0-RELEASE/test/TARGET/xtrabackup-build.XXP2GX/percona-xtrabackup-8.0.35
-30-Linux-x86_64.glibc2.17/lib/plugin/keyring_file.so' (errno: 2 cannot open shared object file: No such file or directory).
2024-01-20T06:00:06.847914-00:00 0 [ERROR] [MY-010736] [Server] Couldn't load plugin named 'keyring_file.so' with soname 'keyring_file.so'.
..
2024-01-20T06:00:09.573058-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Space ID 2 is missing encryption information.

そもそも keyring_file.so が掴めないと言われる。
見るからにコンパイルした環境の lib/plugin を指しているっぽいので、 --xtrabackup-plugin-dir で展開したディレクトリの lib/plugin を指してやる必要がありそう。

$ sudo ./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --backup -uroot --stream=xbstream --socket=/var/lib/mysql/mysql.sock --xtrabackup-plugin-dir=/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin | pzstd -c > test.xb.zst
2024-01-20T06:03:54.596743-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --datadir=/var/lib/mysql
2024-01-20T06:03:54.596830-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --backup=1 --user=root --stream=xbstream --socket=/var/lib/mysql/mysql.sock --xtrabackup-plugin-dir=/home/opc/
percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin
./percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)

..
2024-01-20T06:03:57.435335-00:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'keyring_file'
2024-01-20T06:03:57.435594-00:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'daemon_keyring_proxy_plugin'
2024-01-20T06:03:57.436245-00:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!

取れた。

$ mkdir binary_tarball
$ cd binary_tarball
$ pzstd -dc ../test.xb.zst | xbstream -x

$ sudo /home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --prepare --target-dir=./ --keyring-file-data=/home/opc/mysql-secret --xtrabackup-plugin-dir=/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin
2024-01-20T06:10:57.745096-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --in
nodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=0 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0
2024-01-20T06:10:57.745205-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=./ --keyring-file-data=/home/opc/mysql-secret --xtrabackup-plugin-dir=/home/opc/perco
na-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)

..
2024-01-20T06:10:59.256124-00:00 0 [Note] [MY-012980] [InnoDB] Shutdown completed; log sequence number 24506902
2024-01-20T06:10:59.258134-00:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'keyring_file'
2024-01-20T06:10:59.258396-00:00 0 [Note] [MY-010733] [Server] Shutting down plugin 'daemon_keyring_proxy_plugin'
2024-01-20T06:10:59.258780-00:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!

--xtrabackup-plugin-dir の指定を忘れてエラーにしたりしたけど、忘れなければ大丈夫っぽい。

ちなみにxb —prepareにsudoつけるの忘れて ( /home/opc/mysql-secret はopcアカウントでは読めないパーミッション )実行したら容赦なくSEGVした。もう少し優しく教えてくれても…()

$ /home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup --prepare --target-dir=./ --keyring-file-data=/home/opc/mysql-secret --xtrabackup-plugin-dir=/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin
2024-01-20T06:09:05.770533-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_log_checksums=1 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_undo_directory=./ --innodb_undo_tablespaces=2 --server-id=0 --innodb_log_checksums=ON --innodb_redo_log_encrypt=0 --innodb_undo_log_encrypt=0
2024-01-20T06:09:05.770857-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=./ --keyring-file-data=/home/opc/mysql-secret --xtrabackup-plugin-dir=/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/lib/plugin
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86_64) (revision id: 6beb4b49)
2024-01-20T06:09:05.770919-00:00 0 [Note] [MY-011825] [Xtrabackup] cd to /home/opc/binary_tarball/
2024-01-20T06:09:05.771148-00:00 0 [Note] [MY-011825] [Xtrabackup] This target seems to be not prepared yet.
2024-01-20T06:09:05.780986-00:00 0 [Note] [MY-011825] [Xtrabackup] xtrabackup_logfile detected: size=8388608, start_lsn=(24421351)
2024-01-20T06:09:05.781545-00:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration for recovery:
2024-01-20T06:09:05.781624-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
2024-01-20T06:09:05.781635-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
2024-01-20T06:09:05.781730-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = .
2024-01-20T06:09:05.781824-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 1
2024-01-20T06:09:05.781896-00:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 8388608
2024-01-20T06:09:05.782506-00:00 0 [Warning] [MY-013360] [InnoDB] Plugin keyring_file reported: ''keyring_file plugin' is deprecated and will be removed in a future release. Please use component_keyring_file instead'
2024-01-20T06:09:05.782771-00:00 0 [ERROR] [MY-011370] [InnoDB] Plugin keyring_file reported: 'File '/home/opc/mysql-secret' not found (OS errno 13 - Permission denied)'
2024-01-20T06:09:05.782837-00:00 0 [ERROR] [MY-011355] [InnoDB] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2024-01-20T06:09:05.782895-00:00 0 [ERROR] [MY-010202] [Server] Plugin 'keyring_file' init function returned error.
2024-01-20T06:09:05.783203-00:00 0 [Note] [MY-011825] [Xtrabackup] inititialize_service_handles suceeded
2024-01-20T06:09:05Z UTC - mysqld got signal 11 ;
Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
BuildID[sha1]=
Thread pointer: 0x4bdc3a0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7ffd8c5c4ef0 thread_stack 0x100000
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x2585b4d]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup(print_fatal_signal(int)+0x393) [0x12c4893]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup(handle_fatal_signal+0x95) [0x12c4975]
/lib64/libpthread.so.0(+0x12d40) [0x7fb681543d40]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup(add_plugin_options(std::vector<my_option, std::allocator<my_option> >*, MEM_ROOT*)+0x68) [0x117ba38]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup() [0xd0d835]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup() [0xd15f23]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup(main+0x1af5) [0xcc72b5]
/lib64/libc.so.6(__libc_start_main+0xe5) [0x7fb67efa0e45]
/home/opc/percona-xtrabackup-8.0.35-30-Linux-x86_64.glibc2.17/bin/xtrabackup() [0xcfd115]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0): Connection ID (thread ID): 0
Status: NOT_KILLED

Please report a bug at https://jira.percona.com/projects/PXB

InnoDBログとUNDOログの暗号化中のは試さなくても大丈夫かな、これなら。

0 件のコメント :

コメントを投稿