GreatSQL社区

搜索

[讨论中] GreatSQL 8.0.32-26 版本测试使用xtrabckup的stream功能建立主从

244 4 2024-10-3 17:41

环境如下:
10.1.30.137 是主库
10.1.30.138 是打算做成从库

137和138的root用户已做ssh对等性,137和138 都已安装xtrabckup和qpress,并且都配置了/etc/profile的环境变量


  1. --137:
  2. [root@mysqldb1 ~]# which xbstream
  3. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xbstream
  4. [root@mysqldb1 ~]# which xtrabackup
  5. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xtrabackup

  6. --138:
  7. [root@mysqldb2 data]# which xtrabackup
  8. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xtrabackup
  9. [root@mysqldb2 data]#  which xbstream
  10. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xbstream
复制代码





参考文档:
  1. https://docs.percona.com/percona-xtrabackup/innovation-release/take-streaming-backup.html
复制代码



使用命令如下:
  1. xtrabackup \
  2. --user=root --password='vUdqtDE7n.8b' --socket=/data/mysql-data/mysql.sock \
  3. --backup --compress --stream=xbstream | ssh root@10.1.30.138 "cat | xbstream -v -x -C /data/mysql-data/data/"
复制代码





报错如下:
  1. [root@mysqldb1 ~]# xtrabackup \
  2. > --user=root --password='vUdqtDE7n.8b' --socket=/data/mysql-data/mysql.sock \
  3. > --backup --compress --stream=xbstream | ssh root@10.1.30.138 "cat | xbstream -v -x -C /data/mysql-data/data/"
  4. 2024-10-03T17:36:05.186695+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --server-id=30137 --datadir=/data/mysql-data/data --open_files_limit=65535 --log_bin=/data/mysql-data/binlogs/mybinlog --innodb_buffer_pool_size=22528M --innodb_data_file_path=ibdata1:12M:autoextend --innodb_flush_log_at_trx_commit=1 --innodb_log_buffer_size=32M --innodb_log_file_size=4G --innodb_log_files_in_group=3 --innodb_io_capacity=50000 --innodb_open_files=65535 --innodb_flush_method=O_DIRECT --innodb_adaptive_hash_index=0 --innodb_adaptive_hash_index=0
  5. 2024-10-03T17:36:05.186800+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --port=3306 --socket=/data/mysql-data/mysql.sock --user=root --password=* --socket=/data/mysql-data/mysql.sock --backup=1 --compress --stream=xbstream
  6. xtrabackup version 8.0.32-26 based on MySQL server 8.0.32 Linux (x86_64) (revision id: 34cf2908)
  7. 241003 17:36:05  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/data/mysql-data/mysql.sock' as 'root'  (using password: YES).
  8. Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1548.
  9. 2024-10-03T17:36:05.246032+08:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /data/mysql-data/mysql.sock
  10. 2024-10-03T17:36:05.251953+08:00 0 [Note] [MY-011825] [Xtrabackup] Using server version 8.0.32-26

  11. Authorized users only. All activities may be monitored and reported.
  12. 2024-10-03T17:36:05.254197+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing LOCK TABLES FOR BACKUP ...
  13. 2024-10-03T17:36:05.257034+08:00 0 [Note] [MY-011825] [Xtrabackup] uses posix_fadvise().
  14. 2024-10-03T17:36:05.257057+08:00 0 [Note] [MY-011825] [Xtrabackup] cd to /data/mysql-data/data
  15. 2024-10-03T17:36:05.257068+08:00 0 [Note] [MY-011825] [Xtrabackup] open files limit requested 65535, set to 65535
  16. 2024-10-03T17:36:05.258322+08:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration:
  17. 2024-10-03T17:36:05.258333+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
  18. 2024-10-03T17:36:05.258338+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
  19. 2024-10-03T17:36:05.258363+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = ./
  20. 2024-10-03T17:36:05.258368+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 3
  21. 2024-10-03T17:36:05.258376+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 4294967296
  22. 2024-10-03T17:36:05.258392+08:00 0 [Note] [MY-011825] [Xtrabackup] using O_DIRECT
  23. 2024-10-03T17:36:05.259393+08:00 0 [Note] [MY-011825] [Xtrabackup] inititialize_service_handles suceeded
  24. bash:行1: xbstream:未找到命令
  25. 2024-10-03T17:36:05.365958+08:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /data/mysql-data/mysql.sock
  26. 2024-10-03T17:36:05.381529+08:00 0 [Note] [MY-011825] [Xtrabackup] Redo Log Archiving is not set up.
  27. 2024-10-03T17:36:05.466124+08:00 0 [Warning] [MY-011825] [Xtrabackup] --compress using quicklz is deprecated and the ability to take backups using this compression algorithm will be removed in a future release. Please use ZSTD or LZ4 instead.
  28. 2024-10-03T17:36:05.466805+08:00 1 [Note] [MY-011825] [Xtrabackup] >> log scanned up to (24571719787)
  29. 2024-10-03T17:36:05.673055+08:00 0 [Note] [MY-011825] [Xtrabackup] Generating a list of tablespaces
  30. 2024-10-03T17:36:05.673114+08:00 0 [Note] [MY-012204] [InnoDB] Scanning './'
  31. 2024-10-03T17:36:05.674001+08:00 0 [Note] [MY-012208] [InnoDB] Completed space ID check of 2 files.
  32. 2024-10-03T17:36:05.674127+08:00 0 [Warning] [MY-012091] [InnoDB] Allocated tablespace ID 20 for businessex/applicationimport, old maximum was 0
  33. 2024-10-03T17:36:05.679679+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_001'.
  34. 2024-10-03T17:36:05.680155+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_002'.
  35. 2024-10-03T17:36:05.680814+08:00 0 [Note] [MY-012910] [InnoDB] Opened 2 existing undo tablespaces.
  36. 2024-10-03T17:36:05.681480+08:00 2 [Note] [MY-011825] [Xtrabackup] Compressing and streaming ./centerSearch/t_brm_inclastb_log_20240903.ibd
  37. xtrabackup: Error writing file '<unopen fd>' (OS errno 32 - Broken pipe)
  38. xb_stream_write_data() failed.
  39. compress: write to the destination stream failed.
  40. xtrabackup: Error writing file '<unopen fd>' (OS errno 32 - Broken pipe)
  41. 2024-10-03T17:36:05.821561+08:00 2 [ERROR] [MY-011825] [Xtrabackup] xtrabackup_copy_datafile() failed
  42. 2024-10-03T17:36:05.821594+08:00 2 [ERROR] [MY-011825] [Xtrabackup] failed to copy datafile ./centerSearch/t_brm_inclastb_log_20240903.ibd
  43. 2024-10-03T17:36:06.467005+08:00 1 [Note] [MY-011825] [Xtrabackup] >> log scanned up to (24571719787)
复制代码








全部回复(4)
yejr 2024-10-3 21:33:54
Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1548.
===
这里提示错误信息了,需要先安装它
起飞小宇 2024-10-3 22:16:44
yejr 发表于 2024-10-3 21:33
Failed to connect to MySQL server as DBD::mysql module is not installed at - line 1548.
===
这里提示 ...
  1. 安装后,出现了新的报错
  2. [root@mysqldb1 ~]# xtrabackup --user=root --password='vUdqtDE7n.8b' --socket=/data/mysql-data/mysql.sock --backup --compress --stream=xbstream | ssh root@10.1.30.138 "cat | xbstream -v -x -C /data/bak2/"
  3. 2024-10-03T22:14:09.322146+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --server-id=30137 --datadir=/data/mysql-data/data --open_files_limit=65535 --log_bin=/data/mysql-data/binlogs/mybinlog --innodb_buffer_pool_size=22528M --innodb_data_file_path=ibdata1:12M:autoextend --innodb_flush_log_at_trx_commit=1 --innodb_log_buffer_size=32M --innodb_log_file_size=4G --innodb_log_files_in_group=3 --innodb_io_capacity=50000 --innodb_open_files=65535 --innodb_flush_method=O_DIRECT --innodb_adaptive_hash_index=0 --innodb_adaptive_hash_index=0
  4. 2024-10-03T22:14:09.322272+08:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --port=3306 --socket=/data/mysql-data/mysql.sock --user=root --password=* --socket=/data/mysql-data/mysql.sock --backup=1 --compress --stream=xbstream
  5. xtrabackup version 8.0.32-26 based on MySQL server 8.0.32 Linux (x86_64) (revision id: 34cf2908)

  6. Authorized users only. All activities may be monitored and reported.
  7. 241003 22:14:09  version_check Connecting to MySQL server with DSN 'dbi:mysql:;mysql_read_default_group=xtrabackup;port=3306;mysql_socket=/data/mysql-data/mysql.sock' as 'root'  (using password: YES).
  8. 241003 22:14:09  version_check Connected to MySQL server
  9. 241003 22:14:09  version_check Executing a version check against the server...
  10. 241003 22:14:09  version_check Done.
  11. 2024-10-03T22:14:09.393579+08:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /data/mysql-data/mysql.sock
  12. 2024-10-03T22:14:09.397155+08:00 0 [Note] [MY-011825] [Xtrabackup] Using server version 8.0.32-26
  13. 2024-10-03T22:14:09.398502+08:00 0 [Note] [MY-011825] [Xtrabackup] Executing LOCK TABLES FOR BACKUP ...
  14. 2024-10-03T22:14:09.401240+08:00 0 [Note] [MY-011825] [Xtrabackup] uses posix_fadvise().
  15. 2024-10-03T22:14:09.401261+08:00 0 [Note] [MY-011825] [Xtrabackup] cd to /data/mysql-data/data
  16. 2024-10-03T22:14:09.401275+08:00 0 [Note] [MY-011825] [Xtrabackup] open files limit requested 65535, set to 65535
  17. 2024-10-03T22:14:09.402503+08:00 0 [Note] [MY-011825] [Xtrabackup] using the following InnoDB configuration:
  18. 2024-10-03T22:14:09.402517+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_home_dir = .
  19. 2024-10-03T22:14:09.402528+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_data_file_path = ibdata1:12M:autoextend
  20. 2024-10-03T22:14:09.402557+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_group_home_dir = ./
  21. 2024-10-03T22:14:09.402565+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_files_in_group = 3
  22. 2024-10-03T22:14:09.402576+08:00 0 [Note] [MY-011825] [Xtrabackup] innodb_log_file_size = 4294967296
  23. 2024-10-03T22:14:09.402590+08:00 0 [Note] [MY-011825] [Xtrabackup] using O_DIRECT
  24. 2024-10-03T22:14:09.403467+08:00 0 [Note] [MY-011825] [Xtrabackup] inititialize_service_handles suceeded
  25. bash:行1: xbstream:未找到命令
  26. 2024-10-03T22:14:09.506768+08:00 0 [Note] [MY-011825] [Xtrabackup] Connecting to MySQL server host: localhost, user: root, password: set, port: 3306, socket: /data/mysql-data/mysql.sock
  27. 2024-10-03T22:14:09.510090+08:00 0 [Note] [MY-011825] [Xtrabackup] Redo Log Archiving is not set up.
  28. 2024-10-03T22:14:09.606942+08:00 0 [Warning] [MY-011825] [Xtrabackup] --compress using quicklz is deprecated and the ability to take backups using this compression algorithm will be removed in a future release. Please use ZSTD or LZ4 instead.
  29. 2024-10-03T22:14:09.607372+08:00 1 [Note] [MY-011825] [Xtrabackup] >> log scanned up to (24577498830)
  30. 2024-10-03T22:14:09.814030+08:00 0 [Note] [MY-011825] [Xtrabackup] Generating a list of tablespaces
  31. 2024-10-03T22:14:09.814081+08:00 0 [Note] [MY-012204] [InnoDB] Scanning './'
  32. 2024-10-03T22:14:09.815783+08:00 0 [Note] [MY-012208] [InnoDB] Completed space ID check of 2 files.
  33. 2024-10-03T22:14:09.815905+08:00 0 [Warning] [MY-012091] [InnoDB] Allocated tablespace ID 20 for businessex/applicationimport, old maximum was 0
  34. 2024-10-03T22:14:09.821976+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_001'.
  35. 2024-10-03T22:14:09.822402+08:00 0 [Note] [MY-013252] [InnoDB] Using undo tablespace './undo_002'.
  36. 2024-10-03T22:14:09.822906+08:00 0 [Note] [MY-012910] [InnoDB] Opened 2 existing undo tablespaces.
  37. 2024-10-03T22:14:09.823504+08:00 2 [Note] [MY-011825] [Xtrabackup] Compressing and streaming ./centerSearch/t_brm_inclastb_log_20240903.ibd
  38. xtrabackup: Error writing file '<unopen fd>' (OS errno 32 - Broken pipe)
  39. xb_stream_write_data() failed.
  40. compress: write to the destination stream failed.
  41. 2024-10-03T14:14:09Z UTC - mysqld got signal 11 ;
  42. Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
  43. BuildID[sha1]=
  44. Thread pointer: 0x0
  45. Attempting backtrace. You can use the following information to find out
  46. where mysqld died. If you see no messages after this, something went
  47. terribly wrong...
  48. stack_bottom = 0 thread_stack 0x100000
  49. xtrabackup: Error writing file '<unopen fd>' (OS errno 32 - Broken pipe)
  50. 2024-10-03T22:14:09.967054+08:00 2 [ERROR] [MY-011825] [Xtrabackup] xtrabackup_copy_datafile() failed
  51. 2024-10-03T22:14:09.967084+08:00 2 [ERROR] [MY-011825] [Xtrabackup] failed to copy datafile ./centerSearch/t_brm_inclastb_log_20240903.ibd
  52. xtrabackup(my_print_stacktrace(unsigned char const*, unsigned long)+0x3d) [0x25dc7bd]
  53. xtrabackup(print_fatal_signal(int)+0x393) [0x133e523]
  54. xtrabackup(handle_fatal_signal+0x95) [0x133e605]
  55. /usr/lib64/libc.so.6(+0x40ef0) [0x7f671f15fef0]
  56. xtrabackup(qlz_compress+0x424) [0xdba0a4]
  57. xtrabackup() [0xdaf8d1]
  58. xtrabackup(std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::_Bind<std::function<void (unsigned long)> (std::_Placeholder<1>)>, std::allocator<int>, void (unsigned long)>::_M_run(unsigned long&&)::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&)+0x48) [0xdafba8]
  59. xtrabackup(std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)+0x2e) [0xd8c4ce]
  60. /usr/lib64/libc.so.6(+0x90160) [0x7f671f1af160]
  61. xtrabackup(void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_baxtrabackup(std::_Function_handler<void (unsigned long), Thread_pool::add_task(std::function<void (unsigned long)>&&)::{lambda(unsigned long)#1}>::_M_invoke(std::_Any_data const&, unsigned long&&)+0xc6) [0xdb07a6]
  62. xtrabackup(std::thread::_State_impl<std::thread::_Invoker<std::tuple<Thread_pool::Thread_pool(unsigned long)::{lambda()#1}> > >::_M_run()+0x1c7) [0xdafe27]
  63. xtrabackup() [0x2a80ccf]
  64. /usr/lib64/libc.so.6(+0x8b60a) [0x7f671f1aa60a]
  65. /usr/lib64/libc.so.6(+0x10dbe0) [0x7f671f22cbe0]

  66. Please report a bug at https://jira.percona.com/projects/PXB
复制代码
yejr 2024-10-4 23:06:27

bash:行1: xbstream:未找到命令

还是有报错
起飞小宇 2024-10-5 22:22:00
yejr 发表于 2024-10-4 23:06
bash:行1: xbstream:未找到命令

还是有报错

这个报错确实很奇怪。xbstream 已经跟随xtrabckup安装了才对。  环境变量在137和138上也都有了。用的是二进制包的pt工具,欧拉22.03 tls sp4系统。

  1. --137:
  2. [root@mysqldb1 ~]# which xbstream
  3. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xbstream
  4. [root@mysqldb1 ~]# which xtrabackup
  5. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xtrabackup

  6. --138:
  7. [root@mysqldb2 data]# which xtrabackup
  8. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xtrabackup
  9. [root@mysqldb2 data]#  which xbstream
  10. /usr/local/percona-xtrabackup-8.0.32-26-Linux-x86_64.glibc2.17-minimal/bin/xbstream
复制代码
起飞小宇

9

主题

0

博客

42

贡献

注册会员

Rank: 2

积分
72

助人为乐(铜)

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2024-11-23 17:36 , Processed in 0.024456 second(s), 20 queries , Redis On.
快速回复 返回顶部 返回列表