前言:经过测试这个工具存在BUG;不可以使用这个工具移动binglog;可能导致数据库宕机。
1.执行后数据库宕机,无法启动。危险操作。
(1)
mysqlbinlogmove --server=root:rootroot@localhost:3306 /mysql/data/binlogbak1
[root@mysql1 binlogbak1]# mysqlbinlogmove --server=root:rootroot@localhost:3306 /mysql/data/binlogbak1
数据库宕机,并生成如下日志。
# Moving bin-log files...
# - mysql-binlog.000067
# - mysql-binlog.000068
# - mysql-binlog.000069
# - mysql-binlog.000070
#
# Flushing binary logs...
2023-02-22T03:29:03.239839Z 2 [ERROR] mysqld: Unknown error 1598
03:29:03 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.
key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68195 K bytes of memory
Hope that''s ok; if not, decrease some variables in the equation.
..................................
Thread pointer: 0x7fe6b8000ae0
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...
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7fe6b8005640): is an invalid pointer
Connection ID (thread ID): 2
Status: NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.
(2).查看剩余binlog;
[root@mysql1 binlog]# ll
total 20
-rw-r--r--. 1 mysql mysql 3591 Feb 18 15:34 1.out
-rw-r--r--. 1 mysql mysql 5559 Feb 18 16:26 2.out
-rw-r-----. 1 mysql mysql 244 Feb 22 13:11 mysql-binlog.000072
-rw-r--r--. 1 root root 340 Feb 22 13:11 mysql-binlog.index --发现权限不对。
[root@mysql1 binlog]# more mysql-binlog.index
/mysql/data/binlogbak1/mysql-binlog.000065
/mysql/data/binlogbak1/mysql-binlog.000066
/mysql/data/binlogbak1/mysql-binlog.000067
/mysql/data/binlogbak1/mysql-binlog.000068
/mysql/data/binlogbak1/mysql-binlog.000069
/mysql/data/binlogbak1/mysql-binlog.000070
/mysql/data/binlogbak1/mysql-binlog.000071
/mysql/data/binlog/mysql-binlog.000072
前面的binlog 移动到了新目录,最后一个binlog没有移动。
--更改权限为mysql;
chown mysql:mysql mysql-binlog.index
(3).systemctl start mysql 无法启动数据库处理。
启动时报如下错误:
service myservice does not support chkconfig
启动文件的头部加入如下:
vi /etc/init.d/mysql
#!/bin/bash
# chkconfig: 2345 10 90
# description: myservice
(4)重启成功
systemctl stop mysql
systemctl start mysql
(5)总结。
mysqlbinlogmove
我们发现可见这个命令是存在bug或者有问题的。
虽然拷贝成功,但是导致了数据库宕机。原来的systemctl start mysql 无法使用。
通过mysqld --defaults-file=/mysql/mysql3306.cnf & 启动数据库。
另外发现:部分binlog被移动到了新的目录,mysql-binlog.index 文件权限不对,变成了root:root;
需要重新改回:mysql:mysql 权限。