当前位置:   article > 正文

主从版本升级_主从_8.0.32_软链接_基于二进制日志文件

主从版本升级_主从_8.0.32_软链接_基于二进制日志文件

升级需求

将一套MySQL 8.0.32主从环境版本升级到8.0.35版本,主从环境如下:

服务器

登录账号密码

端口

当前版本

目标版本

主服务器

59.217.250.226

root/topnet@123

3306

8.0.32

8.0.35

从服务器

59.217.250.227

root/topnet@123

3306

8.0.32

8.0.35

升级步骤

关键步骤如下:

1.断开应用 2.确定主从无延时 3.关闭主库 4.关闭从库 5.备份主库数据目录 6.启动主库 7.启动备库 8.查看主从同步状态

查数据库版本

主服务器数据库版本

  1. mysql> select version();
  2. +-----------+
  3. | version() |
  4. +-----------+
  5. | 8.0.32 |
  6. +-----------+
  7. 1 row in set (0.00 sec)
  8. mysql> show variables like '%version%';
  9. +--------------------------+------------------------------+
  10. | Variable_name | Value |
  11. +--------------------------+------------------------------+
  12. | admin_tls_version | TLSv1.2,TLSv1.3 |
  13. | immediate_server_version | 999999 |
  14. | innodb_version | 8.0.32 |
  15. | original_server_version | 999999 |
  16. | protocol_version | 10 |
  17. | replica_type_conversions | |
  18. | slave_type_conversions | |
  19. | tls_version | TLSv1.2,TLSv1.3 |
  20. | version | 8.0.32 |
  21. | version_comment | MySQL Community Server - GPL |
  22. | version_compile_machine | x86_64 |
  23. | version_compile_os | Linux |
  24. | version_compile_zlib | 1.2.13 |
  25. +--------------------------+------------------------------+
  26. 13 rows in set (0.00 sec)
  27. mysql> exit
  28. Bye
  29. [root@localhost ~]# mysql -V
  30. mysql Ver 8.0.32 for Linux on x86_64 (MySQL Community Server - GPL)

从服务器数据库版本

  1. mysql> select version();
  2. +-----------+
  3. | version() |
  4. +-----------+
  5. | 8.0.32 |
  6. +-----------+
  7. 1 row in set (0.00 sec)
  8. mysql> show variables like '%version%';
  9. +--------------------------+------------------------------+
  10. | Variable_name | Value |
  11. +--------------------------+------------------------------+
  12. | admin_tls_version | TLSv1.2,TLSv1.3 |
  13. | immediate_server_version | 999999 |
  14. | innodb_version | 8.0.32 |
  15. | original_server_version | 999999 |
  16. | protocol_version | 10 |
  17. | replica_type_conversions | |
  18. | slave_type_conversions | |
  19. | tls_version | TLSv1.2,TLSv1.3 |
  20. | version | 8.0.32 |
  21. | version_comment | MySQL Community Server - GPL |
  22. | version_compile_machine | x86_64 |
  23. | version_compile_os | Linux |
  24. | version_compile_zlib | 1.2.13 |
  25. +--------------------------+------------------------------+
  26. 13 rows in set (0.01 sec)
  27. mysql> exit
  28. Bye
  29. [root@xzdcweb1 ~]# mysql -V
  30. mysql Ver 8.0.32 for Linux on x86_64 (MySQL Community Server - GPL)

停止应用

确保业务已停止,保证数据一致性

  1. --查询数据库中哪些线程正在执行
  2. show processlist;

确定主从无延时

  1. --查询主库
  2. mysql> show master status;
  3. +---------------+-----------+--------------+------------------+-------------------+
  4. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  5. +---------------+-----------+--------------+------------------+-------------------+
  6. | binlog.000002 | 568694023 | | | |
  7. +---------------+-----------+--------------+------------------+-------------------+
  8. 1 row in set (0.00 sec)
  9. --查询备库
  10. mysql> show slave status\G
  11. *************************** 1. row ***************************
  12. Slave_IO_State: Waiting for source to send event
  13. Master_Host: 59.217.250.226
  14. Master_User: slave
  15. Master_Port: 3306
  16. Connect_Retry: 60
  17. Master_Log_File: binlog.000002
  18. Read_Master_Log_Pos: 568627797
  19. Relay_Log_File: xzdcweb1-relay-bin.000037
  20. Relay_Log_Pos: 568474217
  21. Relay_Master_Log_File: binlog.000002
  22. Slave_IO_Running: Yes
  23. Slave_SQL_Running: Yes
  24. Replicate_Do_DB:
  25. Replicate_Ignore_DB:
  26. Replicate_Do_Table:
  27. Replicate_Ignore_Table:
  28. Replicate_Wild_Do_Table:
  29. Replicate_Wild_Ignore_Table:
  30. Last_Errno: 0
  31. Last_Error:
  32. Skip_Counter: 0
  33. Exec_Master_Log_Pos: 568627797
  34. Relay_Log_Space: 568474776
  35. Until_Condition: None
  36. Until_Log_File:
  37. Until_Log_Pos: 0
  38. Master_SSL_Allowed: No
  39. Master_SSL_CA_File:
  40. Master_SSL_CA_Path:
  41. Master_SSL_Cert:
  42. Master_SSL_Cipher:
  43. Master_SSL_Key:
  44. Seconds_Behind_Master: 0
  45. Master_SSL_Verify_Server_Cert: No
  46. Last_IO_Errno: 0
  47. Last_IO_Error:
  48. Last_SQL_Errno: 0
  49. Last_SQL_Error:
  50. Replicate_Ignore_Server_Ids:
  51. Master_Server_Id: 1
  52. Master_UUID: 5e53417b-c152-11ed-b3a0-a8494daa8138
  53. Master_Info_File: mysql.slave_master_info
  54. SQL_Delay: 0
  55. SQL_Remaining_Delay: NULL
  56. Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
  57. Master_Retry_Count: 86400

1.如下的两参数代表主从同步能够正常的运行网络

若是是Slave_IO_Running的参数不是YES则说明从库读取不到主库的bin-log日志,

若是是Slave_SQL_Running参数不是YES,则说明从库在读取中继日志发生问题。

Slave_IO_Running: Yes

Slave_SQL_Running: Yes同步

2.查看Seconds_Behind_Master参数,若是为0的话,则表示主从复制良好

原文链接:mysql如何准确判断主从延时情况_判断mysql主从延时的方法(不依赖中间件)-CSDN博客

停止数据库

停止从库
  1. --查正在运行的MySQL进程,确定安装目录和数据目录
  2. [root@xzdcweb1 ~]# ps -ef | grep mysql
  3. root 33033 1 0 2023 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/xzdcweb1.pid
  4. mysql 33383 33033 0 2023 ? 03:44:54 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=xzdcweb1.err --pid-file=/data1/mysql/data/xzdcweb1.pid --socket=/var/lib/mysql/mysql.sock
  5. root 50368 45094 0 20:01 pts/0 00:00:00 grep --color=auto mysql
  6. [root@xzdcweb1 ~]# systemctl status mysqld
  7. ● mysqld.service - LSB: start and stop MySQL
  8. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  9. Active: active (running) since Mon 2023-09-18 12:41:33 CST; 3 months 21 days ago
  10. Docs: man:systemd-sysv-generator(8)
  11. Tasks: 83
  12. CGroup: /system.slice/mysqld.service
  13. ├─33033 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/xzdcweb1.pid
  14. └─33383 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin -...
  15. Sep 18 12:41:27 xzdcweb1 systemd[1]: Starting LSB: start and stop MySQL...
  16. Sep 18 12:41:33 xzdcweb1 mysqld[33022]: Starting MySQL......[ OK ]
  17. Sep 18 12:41:33 xzdcweb1 systemd[1]: Started LSB: start and stop MySQL.
  18. --查看从同步情况
  19. show slave status\G
  20. --停止同步
  21. mysql>stop slave;
  22. --停止数据库
  23. --1.进入原8.0.23 mysql命令行 正确关闭数据库
  24. 1
  25. mysqladmin -uroot -p shutdown
  26. [root@mysql]# mysql -uroot -p
  27. Enter password:
  28. #使用mysql shell 命令util.checkForServerUpgrade('root@127.0.0.1:3307', {"password":"XXXXX", "targetVersion":"8.0.26", "configPath":"/etc/my3307.cnf"}) 检查升级到目标版本8.0.26,确认没有error级别的问题
  29. Errors: 0
  30. Warnings: 17
  31. Notices: 0
  32. #检查没有未提交的xa事务
  33. mysql> xa recover;
  34. Empty set (0.00 sec)
  35. # 确保数据都刷到硬盘上,更改成0
  36. mysql> show variables like 'innodb_fast_shutdown';
  37. +----------------------+-------+
  38. | Variable_name | Value |
  39. +----------------------+-------+
  40. | innodb_fast_shutdown | 1 |
  41. +----------------------+-------+
  42. 1 row in set (0.00 sec)
  43. mysql> set global innodb_fast_shutdown=0;
  44. Query OK, 0 rows affected (0.00 sec)
  45. mysql> show variables like 'innodb_fast_shutdown';
  46. +----------------------+-------+
  47. | Variable_name | Value |
  48. +----------------------+-------+
  49. | innodb_fast_shutdown | 0 |
  50. +----------------------+-------+
  51. mysql> shutdown;
  52. Query OK, 0 rows affected (0.00 sec)
  53. mysql> exit
  54. #查看进程和端口后,已无输出记录,确保已停止
  55. [root@xzdcweb1 ~]# ps -ef | grep mysql
  56. root 51658 45094 0 20:07 pts/0 00:00:00 grep --color=auto mysql
  57. [root@xzdcweb1 ~]# ss -nlt | grep 3306
停止主库
  1. --查正在运行的MySQL进程,确定安装目录和数据目录
  2. [root@localhost ~]# ps -ef | grep mysql
  3. root 41766 41065 0 19:52 pts/0 00:00:00 grep --color=auto mysql
  4. root 45742 1 0 2023 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  5. mysql 46126 45742 0 2023 ? 04:18:50 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data1/mysql/data/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock
  6. [root@localhost ~]# systemctl status mysqld
  7. ● mysqld.service - LSB: start and stop MySQL
  8. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  9. Active: active (running) since Mon 2023-09-18 11:54:00 CST; 3 months 22 days ago
  10. Docs: man:systemd-sysv-generator(8)
  11. CGroup: /system.slice/mysqld.service
  12. ├─45742 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  13. └─46126 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin -...
  14. Sep 18 11:53:57 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
  15. Sep 18 11:54:00 localhost.localdomain mysqld[45731]: Starting MySQL... SUCCESS!
  16. Sep 18 11:54:00 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
  17. --记下输出中的 File 和 Position 值,后续在从服务器上使用。
  18. mysql> show master status;
  19. +---------------+-----------+--------------+------------------+-------------------+
  20. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  21. +---------------+-----------+--------------+------------------+-------------------+
  22. | binlog.000002 | 568694023 | | | |
  23. +---------------+-----------+--------------+------------------+-------------------+
  24. 1 row in set (0.00 sec)
  25. 参数说明:
  26. Binlog_Do_DB:同步数据库
  27. Binlog_Ignore_DB:忽略数据库即不同步的数据库
  28. Executed_Gtid_Set:空
  29. --停止数据库
  30. --1.进入原8.0.23 mysql命令行 正确关闭数据库
  31. 1
  32. mysqladmin -uroot -p shutdown
  33. [root@mysql]# mysql -uroot -p
  34. Enter password:
  35. #使用mysql shell 命令util.checkForServerUpgrade('root@127.0.0.1:3307', {"password":"XXXXX", "targetVersion":"8.0.26", "configPath":"/etc/my3307.cnf"}) 检查升级到目标版本8.0.26,确认没有error级别的问题
  36. Errors: 0
  37. Warnings: 17
  38. Notices: 0
  39. #检查没有未提交的xa事务
  40. mysql> xa recover;
  41. Empty set (0.00 sec)
  42. # 确保数据都刷到硬盘上,更改成0
  43. mysql> show variables like 'innodb_fast_shutdown';
  44. +----------------------+-------+
  45. | Variable_name | Value |
  46. +----------------------+-------+
  47. | innodb_fast_shutdown | 1 |
  48. +----------------------+-------+
  49. 1 row in set (0.00 sec)
  50. mysql> set global innodb_fast_shutdown=0;
  51. Query OK, 0 rows affected (0.00 sec)
  52. mysql> show variables like 'innodb_fast_shutdown';
  53. +----------------------+-------+
  54. | Variable_name | Value |
  55. +----------------------+-------+
  56. | innodb_fast_shutdown | 0 |
  57. +----------------------+-------+
  58. mysql> shutdown;
  59. Query OK, 0 rows affected (0.00 sec)
  60. mysql> exit
  61. #查看进程和端口后,已无输出记录,确保已停止
  62. [root@localhost ~]# ps -ef | grep mysql
  63. root 43674 43397 0 20:04 pts/0 00:00:00 grep --color=auto mysql
  64. [root@localhost ~]# ss -ntl | grep 3306

主库升级

主服务器备份安装目录

  1. --查正在运行的MySQL使用的配置文件
  2. [root@localhost ~]# cat /etc/my.cnf | grep basedir
  3. basedir=/usr/local/mysql #安装目录
  4. [root@localhost ~]# cat /etc/my.cnf | grep datadir
  5. datadir=/data1/mysql/data #数据目录
  6. --备份安装目录
  7. [root@localhost ~]# cd /usr/local/
  8. [root@localhost local]# ls -l
  9. total 0
  10. drwxr-xr-x. 2 root root 6 Apr 11 2018 bin
  11. drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
  12. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  13. drwxrwxr-x. 11 root root 208 Jul 31 23:00 hb
  14. drwxr-xr-x. 2 root root 6 Apr 11 2018 include
  15. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  16. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64
  17. drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec
  18. lrwxrwxrwx. 1 root root 42 Mar 22 2023 mysql -> /data1/mysql-8.0.32-linux-glibc2.12-x86_64
  19. drwxr-xr-x. 2 root root 6 Jul 31 23:00 process_temp
  20. drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin
  21. drwxr-xr-x. 5 root root 49 Dec 15 2022 share
  22. drwxr-xr-x. 2 root root 6 Apr 11 2018 src
  23. [root@localhost data1]# cp -r mysql-8.0.32-linux-glibc2.12-x86_64 mysql-8.0.32-linux-glibc2.12-x86_64_bak_`date +%F`
  24. [root@localhost data1]# ls -l
  25. total 428996
  26. -rwxr--r--. 1 root root 1530 Sep 18 15:43 bf.sh
  27. drwxr-xr-x. 2 root root 278 Jan 9 01:00 db
  28. drwxr-xr-x. 2 root root 27 Jan 9 01:00 log
  29. drwxr-xr-x. 4 mysql mysql 29 Mar 13 2023 mysql
  30. drwxr-xr-x. 9 root root 129 Mar 22 2023 mysql-8.0.32-linux-glibc2.12-x86_64
  31. drwxr-xr-x. 9 root root 129 Jan 9 20:11 mysql-8.0.32-linux-glibc2.12-x86_64_bak_2024-01-09
  32. -rw-r--r--. 1 root root 439284500 Jan 8 17:12 mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz
  33. --删除/usr/local目录下mysql的软链接
  34. lrwxrwxrwx. 1 root root 42 Mar 22 2023 mysql -> /data1/mysql-8.0.32-linux-glibc2.12-x86_64
  35. [root@localhost local]# unlink mysql
  36. [root@localhost local]# ls -l
  37. total 0
  38. drwxr-xr-x. 2 root root 6 Apr 11 2018 bin
  39. drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
  40. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  41. drwxrwxr-x. 11 root root 208 Jul 31 23:00 hb
  42. drwxr-xr-x. 2 root root 6 Apr 11 2018 include
  43. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  44. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64
  45. drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec
  46. drwxr-xr-x. 2 root root 6 Jul 31 23:00 process_temp
  47. drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin
  48. drwxr-xr-x. 5 root root 49 Dec 15 2022 share
  49. drwxr-xr-x. 2 root root 6 Apr 11 2018 src
  50. 不建议rm mysql(规避误操作)

主服务器备份数据目录

  1. --备份数据目录
  2. [root@localhost mysql]# cd /data1/mysql
  3. [root@localhost mysql]# ls -l
  4. total 4
  5. drwxr-xr-x. 10 mysql mysql 4096 Jan 9 20:04 data
  6. drwxr-xr-x. 2 mysql mysql 6 Jan 8 23:54 tmp
  7. [root@localhost mysql]# cp -r data data_bak_`date +%F`
  8. [root@localhost mysql]# ls -l
  9. total 8
  10. drwxr-xr-x. 10 mysql mysql 4096 Jan 9 20:04 data
  11. drwxr-xr-x. 10 root root 4096 Jan 9 20:14 data_bak_2024-01-09
  12. drwxr-xr-x. 2 mysql mysql 6 Jan 8 23:54 tmp
  13. [root@localhost mysql]# du -sh data
  14. 14G data
  15. [root@localhost mysql]# du -sh data_bak_2024-01-09/
  16. 14G data_bak_2024-01-09/
  17. [root@localhost mysql]# chown -R mysql:mysql data_bak_2024-01-09/
  18. [root@localhost mysql]# ls -l
  19. total 8
  20. drwxr-xr-x. 10 mysql mysql 4096 Jan 9 20:04 data
  21. drwxr-xr-x. 10 mysql mysql 4096 Jan 9 20:14 data_bak_2024-01-09
  22. drwxr-xr-x. 2 mysql mysql 6 Jan 8 23:54 tmp

主服务器备份配置文件

  1. --备份配置文件
  2. [root@localhost mysql]# cp /etc/my.cnf /etc/my.cnf_bak_`date +%F`
  3. [root@localhost mysql]# ls -l /etc/my.cnf
  4. -rw-r--r--. 1 root root 782 Sep 18 11:53 /etc/my.cnf
  5. [root@localhost mysql]# ls -l /etc/my.cnf_bak_2024-01-09
  6. -rw-r--r--. 1 root root 782 Jan 9 20:15 /etc/my.cnf_bak_2024-01-09

安装数据库软件

上传mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz至/data1

  1. --解压
  2. [root@localhost data1]# cd /data1
  3. [root@localhost data1]# tar -xvf mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz -C /data1/
  4. --/usr/local目录下创建mysql的软链接
  5. [root@localhost local]# ln -s /data1/mysql-8.0.35-linux-glibc2.17-x86_64 /usr/local/mysql
  6. [root@localhost local]# ls -l
  7. total 0
  8. drwxr-xr-x. 2 root root 6 Apr 11 2018 bin
  9. drwxr-xr-x. 2 root root 6 Apr 11 2018 etc
  10. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  11. drwxrwxr-x. 11 root root 208 Jul 31 23:00 hb
  12. drwxr-xr-x. 2 root root 6 Apr 11 2018 include
  13. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  14. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64
  15. drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec
  16. lrwxrwxrwx. 1 root root 42 Jan 9 20:25 mysql -> /data1/mysql-8.0.35-linux-glibc2.17-x86_64
  17. drwxr-xr-x. 2 root root 6 Jul 31 23:00 process_temp
  18. drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin
  19. drwxr-xr-x. 5 root root 49 Dec 15 2022 share
  20. drwxr-xr-x. 2 root root 6 Apr 11 2018 src

启动主库

查看版本
  1. [root@localhost local]# mysql -V
  2. mysql Ver 8.0.35 for Linux on x86_64 (MySQL Community Server - GPL)

显示是新版本的版本号,升级成功

启动主库

建议重开一会话启动服务

  1. [root@localhost init.d]# systemctl start mysqld
  2. [root@localhost init.d]# systemctl status mysqld
  3. ● mysqld.service - LSB: start and stop MySQL
  4. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  5. Active: active (running) since Tue 2024-01-09 20:40:36 CST; 2s ago
  6. Docs: man:systemd-sysv-generator(8)
  7. Process: 48107 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)
  8. Process: 49535 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
  9. CGroup: /system.slice/mysqld.service
  10. ├─49546 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  11. └─49915 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin -...
  12. Jan 09 20:40:28 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
  13. Jan 09 20:40:36 localhost.localdomain mysqld[49535]: Starting MySQL........ SUCCESS!
  14. Jan 09 20:40:36 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
  15. [root@localhost init.d]# ps -ef | grep mysql
  16. root 49546 1 0 20:40 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  17. mysql 49915 49546 36 20:40 ? 00:00:08 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data1/mysql/data/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock
  18. root 50341 48949 0 20:40 pts/0 00:00:00 grep --color=auto mysql
问题处理
启库服务运行但是未加载目录和配置文件
  1. --问题描述
  2. 升级后启库后查看服务状态不正常
  3. [root@xzdcweb1 data1]# mysql -V
  4. mysql Ver 8.0.35 for Linux on x86_64 (MySQL Community Server - GPL)
  5. [root@xzdcweb1 ~]# systemctl start mysqld
  6. [root@xzdcweb1 ~]# systemctl status mysqld
  7. ● mysqld.service - LSB: start and stop MySQL
  8. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  9. Active: active (exited) since Mon 2023-09-18 12:41:33 CST; 3 months 22 days ago
  10. Docs: man:systemd-sysv-generator(8)
  11. Sep 18 12:41:27 xzdcweb1 systemd[1]: Starting LSB: start and stop MySQL...
  12. Sep 18 12:41:33 xzdcweb1 mysqld[33022]: Starting MySQL......[ OK ]
  13. Sep 18 12:41:33 xzdcweb1 systemd[1]: Started LSB: start and stop MySQL.
  14. [root@xzdcweb1 ~]# ps -ef | grep mysql
  15. root 64535 64356 0 21:10 pts/1 00:00:00 grep --color=auto mysql
  16. 以下是升级前关库前查看的服务和进程:
  17. [root@localhost ~]# ps -ef | grep mysql
  18. root 41766 41065 0 19:52 pts/0 00:00:00 grep --color=auto mysql
  19. root 45742 1 0 2023 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  20. mysql 46126 45742 0 2023 ? 04:18:50 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data1/mysql/data/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock
  21. [root@localhost ~]# systemctl status mysqld
  22. ● mysqld.service - LSB: start and stop MySQL
  23. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  24. Active: active (running) since Mon 2023-09-18 11:54:00 CST; 3 months 22 days ago
  25. Docs: man:systemd-sysv-generator(8)
  26. CGroup: /system.slice/mysqld.service
  27. ├─45742 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  28. └─46126 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin -...
  29. Sep 18 11:53:57 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
  30. Sep 18 11:54:00 localhost.localdomain mysqld[45731]: Starting MySQL... SUCCESS!
  31. Sep 18 11:54:00 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
  32. --问题原因
  33. mysql8.0.13之后启库时会自动进行升级字典,需要一些时间
  34. --解决办法
  35. 缓一会儿再启动就正常了
  36. 可查看日志,时间关系未进行查看
  37. 如果配置文件中无日志文件参数,默认在数据目录下
查看主库信息
  1. mysql> show master status;
  2. +---------------+----------+--------------+------------------+-------------------+
  3. | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
  4. +---------------+----------+--------------+------------------+-------------------+
  5. | binlog.000003 | 7562 | | | |
  6. +---------------+----------+--------------+------------------+-------------------+
  7. 1 row in set (0.00 sec)

备库升级

备服务器备份安装目录

  1. --查正在运行的MySQL使用的配置文件
  2. [root@xzdcweb1 ~]# cat /etc/my.cnf | grep basedir
  3. basedir=/usr/local/mysql #mysql安装根目录
  4. [root@xzdcweb1 ~]# cat /etc/my.cnf | grep datadir
  5. datadir=/data1/mysql/data #mysql数据文件所在目录
  6. --备份安装目录
  7. [root@xzdcweb1 ~]# cd /usr/local/
  8. [root@xzdcweb1 local]# ls -l
  9. total 0
  10. drwxr-xr-x 6 root root 58 Jul 5 2021 apr
  11. drwxr-xr-x. 2 root root 177 Dec 29 10:40 bin
  12. drwxr-xr-x. 2 root root 225 Jun 9 2023 etc
  13. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  14. drwxrwxr-x 11 root root 208 Jul 31 23:00 hb
  15. drwxr-xr-x. 3 root root 21 Dec 29 10:40 include
  16. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  17. drwxr-xr-x. 4 root root 159 Dec 29 10:40 lib64
  18. drwxr-xr-x. 2 root root 90 Jun 9 2023 libexec
  19. lrwxrwxrwx 1 root root 42 Mar 22 2023 mysql -> /data1/mysql-8.0.32-linux-glibc2.12-x86_64
  20. drwxr-xr-x 11 root root 151 Jul 3 2021 nginx
  21. drwxr-xr-x 2 root root 6 Jul 31 23:00 process_temp
  22. drwxr-xr-x 6 root root 56 Jul 3 2021 python3
  23. drwxr-xr-x. 2 root root 18 Jun 9 2023 sbin
  24. drwxr-xr-x. 6 root root 60 Dec 29 10:41 share
  25. drwxr-xr-x. 3 root root 47 Jul 5 2021 src
  26. drwxr-xr-x 5 root root 140 Dec 29 10:40 ssl
  27. [root@xzdcweb1 local]# cd /data1
  28. [root@xzdcweb1 data1]# ls -l
  29. total 428992
  30. drwxr-xr-x 2 rsync rsync 6 Sep 18 19:04 fdfsbak
  31. drwxr-xr-x 4 mysql mysql 29 Mar 13 2023 mysql
  32. drwxr-xr-x 9 root root 129 Mar 22 2023 mysql-8.0.32-linux-glibc2.12-x86_64
  33. -rw-r--r-- 1 root root 439284500 Jan 8 17:17 mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz
  34. [root@xzdcweb1 data1]# cp -r mysql-8.0.32-linux-glibc2.12-x86_64 mysql-8.0.32-linux-glibc2.12-x86_64_bak_`date +%F`
  35. [root@xzdcweb1 data1]# ls -l
  36. total 428992
  37. drwxr-xr-x 2 rsync rsync 6 Sep 18 19:04 fdfsbak
  38. drwxr-xr-x 4 mysql mysql 29 Mar 13 2023 mysql
  39. drwxr-xr-x 9 root root 129 Mar 22 2023 mysql-8.0.32-linux-glibc2.12-x86_64
  40. drwxr-xr-x 9 root root 129 Jan 9 20:57 mysql-8.0.32-linux-glibc2.12-x86_64_bak_2024-01-09
  41. -rw-r--r-- 1 root root 439284500 Jan 8 17:17 mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz
  42. --删除软链接
  43. [root@xzdcweb1 data1]# cd /usr/local/
  44. [root@xzdcweb1 local]# ls -l
  45. total 0
  46. drwxr-xr-x 6 root root 58 Jul 5 2021 apr
  47. drwxr-xr-x. 2 root root 177 Dec 29 10:40 bin
  48. drwxr-xr-x. 2 root root 225 Jun 9 2023 etc
  49. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  50. drwxrwxr-x 11 root root 208 Jul 31 23:00 hb
  51. drwxr-xr-x. 3 root root 21 Dec 29 10:40 include
  52. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  53. drwxr-xr-x. 4 root root 159 Dec 29 10:40 lib64
  54. drwxr-xr-x. 2 root root 90 Jun 9 2023 libexec
  55. lrwxrwxrwx 1 root root 42 Mar 22 2023 mysql -> /data1/mysql-8.0.32-linux-glibc2.12-x86_64
  56. drwxr-xr-x 11 root root 151 Jul 3 2021 nginx
  57. drwxr-xr-x 2 root root 6 Jul 31 23:00 process_temp
  58. drwxr-xr-x 6 root root 56 Jul 3 2021 python3
  59. drwxr-xr-x. 2 root root 18 Jun 9 2023 sbin
  60. drwxr-xr-x. 6 root root 60 Dec 29 10:41 share
  61. drwxr-xr-x. 3 root root 47 Jul 5 2021 src
  62. drwxr-xr-x 5 root root 140 Dec 29 10:40 ssl
  63. [root@xzdcweb1 local]# unlink mysql
  64. [root@xzdcweb1 local]# ls -l
  65. total 0
  66. drwxr-xr-x 6 root root 58 Jul 5 2021 apr
  67. drwxr-xr-x. 2 root root 177 Dec 29 10:40 bin
  68. drwxr-xr-x. 2 root root 225 Jun 9 2023 etc
  69. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  70. drwxrwxr-x 11 root root 208 Jul 31 23:00 hb
  71. drwxr-xr-x. 3 root root 21 Dec 29 10:40 include
  72. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  73. drwxr-xr-x. 4 root root 159 Dec 29 10:40 lib64
  74. drwxr-xr-x. 2 root root 90 Jun 9 2023 libexec
  75. drwxr-xr-x 11 root root 151 Jul 3 2021 nginx
  76. drwxr-xr-x 2 root root 6 Jul 31 23:00 process_temp
  77. drwxr-xr-x 6 root root 56 Jul 3 2021 python3
  78. drwxr-xr-x. 2 root root 18 Jun 9 2023 sbin
  79. drwxr-xr-x. 6 root root 60 Dec 29 10:41 share
  80. drwxr-xr-x. 3 root root 47 Jul 5 2021 src
  81. drwxr-xr-x 5 root root 140 Dec 29 10:40 ssl
  82. 注意:
  83. 不建议rm mysql (规避误操作)

备服务器备份数据目录

  1. --备份数据目录
  2. [root@xzdcweb1 local]# cd /data1/mysql
  3. [root@xzdcweb1 mysql]# ls -l
  4. total 4
  5. drwxr-xr-x 10 mysql mysql 4096 Jan 9 20:07 data
  6. drwxr-xr-x 2 mysql mysql 6 Sep 18 12:41 tmp
  7. [root@xzdcweb1 mysql]# du -sh data/
  8. 4.0G data/
  9. [root@xzdcweb1 mysql]# cp -r data data_bak_`date +%F`
  10. [root@xzdcweb1 mysql]# ls -l
  11. total 8
  12. drwxr-xr-x 10 mysql mysql 4096 Jan 9 20:07 data
  13. drwxr-xr-x 10 root root 4096 Jan 9 21:01 data_bak_2024-01-09
  14. drwxr-xr-x 2 mysql mysql 6 Sep 18 12:41 tmp
  15. [root@xzdcweb1 mysql]# du -sh data
  16. 4.0G data
  17. [root@xzdcweb1 mysql]# du -sh data_bak_2024-01-09/
  18. 4.0G data_bak_2024-01-09/

备服务器备份配置文件

  1. --备份配置文件
  2. [root@xzdcweb1 mysql]# cp /etc/my.cnf /etc/my.cnf_bak_`date +%F`
  3. [root@xzdcweb1 mysql]# ls -l /etc/my.cnf
  4. -rw-r--r-- 1 root root 747 Sep 18 12:16 /etc/my.cnf
  5. [root@xzdcweb1 mysql]# ls -l /etc/my.cnf_bak_2024-01-09
  6. -rw-r--r-- 1 root root 747 Jan 9 21:02 /etc/my.cnf_bak_2024-01-09

安装数据库软件

上传mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz至/data1

  1. --解压
  2. [root@xzdcweb1 mysql]# cd /data1
  3. [root@xzdcweb1 data1]# ls -l
  4. total 428992
  5. drwxr-xr-x 2 rsync rsync 6 Sep 18 19:04 fdfsbak
  6. drwxr-xr-x 5 mysql mysql 56 Jan 9 21:01 mysql
  7. drwxr-xr-x 9 root root 129 Mar 22 2023 mysql-8.0.32-linux-glibc2.12-x86_64
  8. drwxr-xr-x 9 root root 129 Jan 9 20:57 mysql-8.0.32-linux-glibc2.12-x86_64_bak_2024-01-09
  9. -rw-r--r-- 1 root root 439284500 Jan 8 17:17 mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz
  10. [root@xzdcweb1 data1]# tar -xvf mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz -C /data1/
  11. [root@xzdcweb1 data1]# ls -l
  12. total 428992
  13. drwxr-xr-x 2 rsync rsync 6 Sep 18 19:04 fdfsbak
  14. drwxr-xr-x 5 mysql mysql 56 Jan 9 21:01 mysql
  15. drwxr-xr-x 9 root root 129 Mar 22 2023 mysql-8.0.32-linux-glibc2.12-x86_64
  16. drwxr-xr-x 9 root root 129 Jan 9 20:57 mysql-8.0.32-linux-glibc2.12-x86_64_bak_2024-01-09
  17. drwxr-xr-x 9 root root 129 Jan 9 21:05 mysql-8.0.35-linux-glibc2.17-x86_64
  18. -rw-r--r-- 1 root root 439284500 Jan 8 17:17 mysql-8.0.35-linux-glibc2.17-x86_64.tar.xz
  19. --/usr/local目录下创建mysql目录的软链接
  20. [root@xzdcweb1 data1]# ln -s /data1/mysql-8.0.35-linux-glibc2.17-x86_64 /usr/local/mysql
  21. [root@xzdcweb1 data1]# ls -l /usr/local/
  22. total 0
  23. drwxr-xr-x 6 root root 58 Jul 5 2021 apr
  24. drwxr-xr-x. 2 root root 177 Dec 29 10:40 bin
  25. drwxr-xr-x. 2 root root 225 Jun 9 2023 etc
  26. drwxr-xr-x. 2 root root 6 Apr 11 2018 games
  27. drwxrwxr-x 11 root root 208 Jul 31 23:00 hb
  28. drwxr-xr-x. 3 root root 21 Dec 29 10:40 include
  29. drwxr-xr-x. 2 root root 6 Apr 11 2018 lib
  30. drwxr-xr-x. 4 root root 159 Dec 29 10:40 lib64
  31. drwxr-xr-x. 2 root root 90 Jun 9 2023 libexec
  32. lrwxrwxrwx 1 root root 42 Jan 9 21:08 mysql -> /data1/mysql-8.0.35-linux-glibc2.17-x86_64
  33. drwxr-xr-x 11 root root 151 Jul 3 2021 nginx
  34. drwxr-xr-x 2 root root 6 Jul 31 23:00 process_temp
  35. drwxr-xr-x 6 root root 56 Jul 3 2021 python3
  36. drwxr-xr-x. 2 root root 18 Jun 9 2023 sbin
  37. drwxr-xr-x. 6 root root 60 Dec 29 10:41 share
  38. drwxr-xr-x. 3 root root 47 Jul 5 2021 src
  39. drwxr-xr-x 5 root root 140 Dec 29 10:40 ssl

启动备库

查看版本
  1. [root@xzdcweb1 data1]# mysql -V
  2. mysql Ver 8.0.35 for Linux on x86_64 (MySQL Community Server - GPL)

显示是新版本的版本号,升级成功

启动备库
  1. [root@xzdcweb1 ~]# systemctl start mysqld
  2. [root@xzdcweb1 ~]# systemctl status mysqld
  3. ● mysqld.service - LSB: start and stop MySQL
  4. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  5. Active: active (running) since Tue 2024-01-09 21:15:36 CST; 6s ago
  6. Docs: man:systemd-sysv-generator(8)
  7. Process: 64762 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)
  8. Process: 65533 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
  9. Tasks: 46
  10. CGroup: /system.slice/mysqld.service
  11. ├─345 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/xzdcweb1.pid
  12. └─719 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --u...
  13. Jan 09 21:15:25 xzdcweb1 systemd[1]: Starting LSB: start and stop MySQL...
  14. Jan 09 21:15:36 xzdcweb1 mysqld[65533]: Starting MySQL...........[ OK ]
  15. Jan 09 21:15:36 xzdcweb1 systemd[1]: Started LSB: start and stop MySQL.
  16. [root@xzdcweb1 ~]# ps -ef | grep mysql
  17. root 345 1 0 21:15 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/xzdcweb1.pid
  18. mysql 719 345 55 21:15 ? 00:00:14 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=xzdcweb1.err --pid-file=/data1/mysql/data/xzdcweb1.pid --socket=/var/lib/mysql/mysql.sock
  19. root 1147 64356 0 21:15 pts/1 00:00:00 grep --color=auto mysql
问题处理
启库服务运行但是未加载目录和配置文件
  1. --问题描述
  2. 升级后启库后查看服务状态不正常
  3. [root@xzdcweb1 data1]# mysql -V
  4. mysql Ver 8.0.35 for Linux on x86_64 (MySQL Community Server - GPL)
  5. [root@xzdcweb1 ~]# systemctl start mysqld
  6. [root@xzdcweb1 ~]# systemctl status mysqld
  7. ● mysqld.service - LSB: start and stop MySQL
  8. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  9. Active: active (exited) since Mon 2023-09-18 12:41:33 CST; 3 months 22 days ago
  10. Docs: man:systemd-sysv-generator(8)
  11. Sep 18 12:41:27 xzdcweb1 systemd[1]: Starting LSB: start and stop MySQL...
  12. Sep 18 12:41:33 xzdcweb1 mysqld[33022]: Starting MySQL......[ OK ]
  13. Sep 18 12:41:33 xzdcweb1 systemd[1]: Started LSB: start and stop MySQL.
  14. [root@xzdcweb1 ~]# ps -ef | grep mysql
  15. root 64535 64356 0 21:10 pts/1 00:00:00 grep --color=auto mysql
  16. 以下是升级前关库前查看的服务和进程:
  17. [root@localhost ~]# ps -ef | grep mysql
  18. root 41766 41065 0 19:52 pts/0 00:00:00 grep --color=auto mysql
  19. root 45742 1 0 2023 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  20. mysql 46126 45742 0 2023 ? 04:18:50 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=localhost.localdomain.err --pid-file=/data1/mysql/data/localhost.localdomain.pid --socket=/var/lib/mysql/mysql.sock
  21. [root@localhost ~]# systemctl status mysqld
  22. ● mysqld.service - LSB: start and stop MySQL
  23. Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
  24. Active: active (running) since Mon 2023-09-18 11:54:00 CST; 3 months 22 days ago
  25. Docs: man:systemd-sysv-generator(8)
  26. CGroup: /system.slice/mysqld.service
  27. ├─45742 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data1/mysql/data --pid-file=/data1/mysql/data/localhost.localdomain.pid
  28. └─46126 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data1/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin -...
  29. Sep 18 11:53:57 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...
  30. Sep 18 11:54:00 localhost.localdomain mysqld[45731]: Starting MySQL... SUCCESS!
  31. Sep 18 11:54:00 localhost.localdomain systemd[1]: Started LSB: start and stop MySQL.
  32. --问题原因
  33. mysql8.0.13之后启库时会自动进行升级字典,需要一些时间
  34. --解决办法
  35. 缓一会儿再启动就正常了
  36. 可查看日志,时间关系未进行查看
  37. 如果配置文件中无日志文件参数,默认在数据目录下
查看备库同步信息
  1. root@localhost :mysql 19:24:53>show slave status\G
  2. *************************** 1. row ***************************
  3. Slave_IO_State: Waiting for source to send event
  4. Master_Host: 192.168.40.160
  5. Master_User: replication
  6. Master_Port: 2213
  7. Connect_Retry: 60
  8. Master_Log_File: mybinlog.000003
  9. Read_Master_Log_Pos: 157
  10. Relay_Log_File: mysql-relay-bin.000005
  11. Relay_Log_Pos: 371
  12. Relay_Master_Log_File: mybinlog.000003
  13. Slave_IO_Running: Yes
  14. Slave_SQL_Running: Yes
  15. Replicate_Do_DB:
  16. Replicate_Ignore_DB:
  17. Replicate_Do_Table:
  18. Replicate_Ignore_Table:
  19. Replicate_Wild_Do_Table:
  20. Replicate_Wild_Ignore_Table:
  21. Last_Errno: 0
  22. Last_Error:
  23. Skip_Counter: 0
  24. Exec_Master_Log_Pos: 157
  25. Relay_Log_Space: 749
  26. Until_Condition: None
  27. Until_Log_File:
  28. Until_Log_Pos: 0
  29. Master_SSL_Allowed: No
  30. Master_SSL_CA_File:
  31. Master_SSL_CA_Path:
  32. Master_SSL_Cert:
  33. Master_SSL_Cipher:
  34. Master_SSL_Key:
  35. Seconds_Behind_Master: 0
  36. Master_SSL_Verify_Server_Cert: No
  37. Last_IO_Errno: 0
  38. Last_IO_Error:
  39. Last_SQL_Errno: 0
  40. Last_SQL_Error:
  41. Replicate_Ignore_Server_Ids:
  42. Master_Server_Id: 160
  43. Master_UUID: d9eafe5f-aeaf-11ee-a9c8-000c29528229
  44. Master_Info_File: mysql.slave_master_info
  45. SQL_Delay: 0
  46. SQL_Remaining_Delay: NULL
  47. Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
  48. Master_Retry_Count: 86400
  49. Master_Bind:
  50. Last_IO_Error_Timestamp:
  51. Last_SQL_Error_Timestamp:
  52. Master_SSL_Crl:
  53. Master_SSL_Crlpath:
  54. Retrieved_Gtid_Set:
  55. Executed_Gtid_Set:
  56. Auto_Position: 0
  57. Replicate_Rewrite_DB:
  58. Channel_Name:
  59. Master_TLS_Version:
  60. Master_public_key_path:
  61. Get_master_public_key: 1
  62. Network_Namespace:
  63. 1 row in set, 1 warning (0.00 sec)

mysql从库默认启动时slave也会自动启动复制。

1.如下的两参数代表主从同步能够正常的运行网络

若是是Slave_IO_Running的参数不是YES则说明从库读取不到主库的bin-log日志

若是是Slave_SQL_Running参数不是YES,则说明从库在读取中继日志发生问题。

Slave_IO_Running: Yes

Slave_SQL_Running: Yes同步

2.查看Seconds_Behind_Master参数,若是为0的话,则表示主从复制良好

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/100731?site
推荐阅读
相关标签
  

闽ICP备14008679号