版本升级--自测

从库

------------

停止主从复制

stop slave

全库备份

mysqldump -u root -p -S mysql.sock --all-databases>/data/mysql/standby/dump.sql

加-R参数可备份函数

备份数据库global variables参数

mysql -uroot -p -Bse "show global variables" > /data/mysql/standby/before_var.cnf

备份my.cnf配置文件

cp standby.cnf standby.cnf.bak

备份basedir目录

mkdir -p /mysqlbackup/basedir_bak

cd /usr/local

tar -cvf mysql.tar mysql

mv *.tar /mysqlbackup/basedir_bak

mkdir -p /mysqlbackup/

mv mysql/ /mysqlbackup/

进入到bin目录关闭mysql服务

cd /mysqlbackup/mysql/bin

设置慢关闭

./mysql -uroot -p -e "SET GLOBAL innodb_fast_shutdown=0;" --socket=/data/mysql/standby/mysql.sock

查看是否设置为0

./mysql -uroot -p --socket=/data/mysql/standby/mysql.sock -e "show global variables like '%fast_shutdown%';"

关闭mysql数据库

./mysqladmin -uroot -p -S /data/mysql/standby/mysql.sock shutdown

记录binlog位置和pos信息

tail -300f /data/mysql/standby/elog/mysql.err

read up to log 'mysql-bin.000001', position 6451

解压软件包

cd /data/mysql

tar -xvf mysql-boost-5.7.21.tar.gz

编译5.7.21版本

cd mysql-5.7.21

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DWITH_BOOST=/data/mysql/mysql-5.7.21/boost

修改版本

[root@rac02 mysql-5.7.21]# cat VERSION

MYSQL_VERSION_MAJOR=5

MYSQL_VERSION_MINOR=7

MYSQL_VERSION_PATCH=99

MYSQL_VERSION_EXTRA=

编译

make && make install

查看是否升级成功

mysql -V

mysql  Ver 14.14 Distrib 5.7.99, for Linux (x86_64) using  EditLine wrapper

从库起库

/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/standby.cnf --ledir=/usr/local/mysql/bin &

执行升级脚本

/usr/local/mysql/bin/mysql_upgrade -uroot -p -S /data/mysql/standby/mysql.sock

Enter password:

Checking if update is needed.

Checking server version.

Running queries to upgrade MySQL server.

Checking system database.

mysql.columns_priv                                 OK

mysql.db                                           OK

mysql.engine_cost                                  OK

mysql.event                                        OK

mysql.func                                         OK

mysql.general_log                                  OK

mysql.gtid_executed                                OK

mysql.help_category                                OK

mysql.help_keyword                                 OK

mysql.help_relation                                OK

mysql.help_topic                                   OK

mysql.innodb_index_stats                           OK

mysql.innodb_table_stats                           OK

mysql.jzw                                          OK

mysql.jzw2                                         OK

mysql.jzw3                                         OK

mysql.jzw4                                         OK

mysql.ndb_binlog_index                             OK

mysql.plugin                                       OK

mysql.proc                                         OK

mysql.procs_priv                                   OK

mysql.proxies_priv                                 OK

mysql.server_cost                                  OK

mysql.servers                                      OK

mysql.slave_master_info                            OK

mysql.slave_relay_log_info                         OK

mysql.slave_worker_info                            OK

mysql.slow_log                                     OK

mysql.tables_priv                                  OK

mysql.time_zone                                    OK

mysql.time_zone_leap_second                        OK

mysql.time_zone_name                               OK

mysql.time_zone_transition                         OK

mysql.time_zone_transition_type                    OK

mysql.user                                         OK

The sys schema is already up to date (version 1.5.1).

Checking databases.

sys.sys_config                                     OK

Upgrade process completed successfully.

Checking if update is needed.

mysql> \s

--------------

mysql  Ver 14.14 Distrib 5.7.99, for Linux (x86_64) using  EditLine wrapper

Connection id:          5

Current database:

Current user:           root@localhost

SSL:                    Not in use

Current pager:          stdout

Using outfile:          ''

Using delimiter:        ;

Server version:         5.7.99-log Source distribution

Protocol version:       10

Connection:             Localhost via UNIX socket

Server characterset:    utf8

Db     characterset:    utf8

Client characterset:    utf8

Conn.  characterset:    utf8

UNIX socket:            mysql.sock

Uptime:                 5 min 56 sec

Threads: 3  Questions: 2729  Slow queries: 0  Opens: 274  Flush tables: 1  Open tables: 39  Queries per second avg: 7.665

--------------

-------------------------------------------------------------------------------------------------------------------------------------------------------

主库

------------

停止主从复制

stop slave

全库备份

mysqldump -u root -p -S mysql.sock --all-databases>/data/mysql/primary/dump.sql

备份数据库global variables参数

mysql -uroot -p -Bse "show global variables" > /data/mysql/primary/before_var.cnf

备份my.cnf配置文件

cp primary.cnf primary.cnf.bak

备份basedir目录

mkdir -p /mysqlbackup/basedir_bak

cd /usr/local

tar -cvf mysql.tar mysql

mv *.tar /mysqlbackup/basedir_bak

mkdir -p /mysqlbackup/

mv mysql/ /mysqlbackup/

进入到bin目录关闭mysql服务

cd /mysqlbackup/mysql/bin

设置慢关闭

./mysql -uroot -p -e "SET GLOBAL innodb_fast_shutdown=0;" --socket=/data/mysql/primary/mysql.sock

查看是否设置为0

./mysql -uroot -p --socket=/data/mysql/primary/mysql.sock -e "show global variables like '%fast_shutdown%';"

关闭mysql数据库

./mysqladmin -uroot -p -S /data/mysql/primary/mysql.sock shutdown

记录binlog位置和pos信息

tail -300f /data/mysql/primary/elog/mysql.err

read up to log 'mysql-bin.000001', position 6451

解压软件包

cd /data/mysql

tar -xvf mysql-boost-5.7.21.tar.gz

编译5.7.21版本

cd mysql-5.7.21

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -DWITH_BOOST=/data/mysql/mysql-5.7.21/boost

修改版本

[root@rac02 mysql-5.7.21]# cat VERSION

MYSQL_VERSION_MAJOR=5

MYSQL_VERSION_MINOR=7

MYSQL_VERSION_PATCH=99

MYSQL_VERSION_EXTRA=

编译

make && make install

查看是否升级成功

mysql -V

mysql  Ver 14.14 Distrib 5.7.99, for Linux (x86_64) using  EditLine wrapper

从库起库

/usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysql/primary.cnf --ledir=/usr/local/mysql/bin &

执行升级脚本

/usr/local/mysql/bin/mysql_upgrade -uroot -p -S /data/mysql/primary/mysql.sock

Enter password:

Checking if update is needed.

Checking server version.

Running queries to upgrade MySQL server.

Checking system database.

mysql.columns_priv                                 OK

mysql.db                                           OK

mysql.engine_cost                                  OK

mysql.event                                        OK

mysql.func                                         OK

mysql.general_log                                  OK

mysql.gtid_executed                                OK

mysql.help_category                                OK

mysql.help_keyword                                 OK

mysql.help_relation                                OK

mysql.help_topic                                   OK

mysql.innodb_index_stats                           OK

mysql.innodb_table_stats                           OK

mysql.jzw                                          OK

mysql.jzw2                                         OK

mysql.jzw3                                         OK

mysql.jzw4                                         OK

mysql.ndb_binlog_index                             OK

mysql.plugin                                       OK

mysql.proc                                         OK

mysql.procs_priv                                   OK

mysql.proxies_priv                                 OK

mysql.server_cost                                  OK

mysql.servers                                      OK

mysql.slave_master_info                            OK

mysql.slave_relay_log_info                         OK

mysql.slave_worker_info                            OK

mysql.slow_log                                     OK

mysql.tables_priv                                  OK

mysql.time_zone                                    OK

mysql.time_zone_leap_second                        OK

mysql.time_zone_name                               OK

mysql.time_zone_transition                         OK

mysql.time_zone_transition_type                    OK

mysql.user                                         OK

The sys schema is already up to date (version 1.5.1).

Checking databases.

sys.sys_config                                     OK

Upgrade process completed successfully.

Checking if update is needed.

mysql> \s

--------------

mysql  Ver 14.14 Distrib 5.7.99, for Linux (x86_64) using  EditLine wrapper

Connection id:          5

Current database:

Current user:           root@localhost

SSL:                    Not in use

Current pager:          stdout

Using outfile:          ''

Using delimiter:        ;

Server version:         5.7.99-log Source distribution

Protocol version:       10

Connection:             Localhost via UNIX socket

Server characterset:    utf8

Db     characterset:    utf8

Client characterset:    utf8

Conn.  characterset:    utf8

UNIX socket:            mysql.sock

Uptime:                 5 min 56 sec

Threads: 3  Questions: 2729  Slow queries: 0  Opens: 274  Flush tables: 1  Open tables: 39  Queries per second avg: 7.665

--------------

-------------------------------------------------------------------------------------------------------------------------------------------------------

升级完成后恢复主主复制

先做主从复制

------------------------

从库

stop slave;

start slave;

show slave status\G

如果有报错SQL,就要去修正,或者用set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;跳过

反向复制

-----------------------

主库

stop slave;

start slave;

show slave status\G

如果有报错SQL,就要去修正,或者用set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;跳过

同步错误处理

发现mysql slave服务器经常因为一些特殊字符或者符号产生的更新语句报错,整个同步也会因此而卡在那,最初的办法只是手动去出错的机器执行下面三条SQL语句,跳过错误即可。
  mysql>slave stop;
  mysql>set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
  mysql>slave start;

mysql5.7.17版本升级源码方式及恢复主主复制的更多相关文章

  1. 源码方式安装mysql5.5

    mysql5.5开始,源码配置编译工具configure变成了cmake,所以先要去把cmake装上.并安装make,bison,cmake,gcc-c++,ncurses的包 去http://www ...

  2. 烂泥:mysql5.5数据库cmake源码编译安装

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 以前也写过一篇有关mysql5.0源码编译的文章,该文章为<烂泥:mysql5.0数据库源码编译安装>.但是MySQL自5.5版本以后,就开 ...

  3. 第6章 RTX 操作系统源码方式移植

    以下内容转载自安富莱电子: http://forum.armfly.com/forum.php 本章教程为大家将介绍 RTX 操作系统源码方式移植,移植工作比较简单,只需要用户添加需要的源码文件即可, ...

  4. mysql-5.5 for linux源码安装

    mysql-5.5 for linux源码安装 1.使用Yum安装依赖软件包 # yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison  ...

  5. centos7下源码方式安装gitlab8.9+发送邮件+ldap

    CentOS7下源码方式安装gitlab 环境描述 操作系统: centos7 redis: >=2.8 mysql >=5.5.14 git >=2.7.4 架构设计 一台gitl ...

  6. 源码方式安装 lrzsz 库

    我们都知道安装了lrzsz工具的linux系统环境: 在shell里可以非常方便的上传和下载linux里面的文件: 通常的安装方式: yum install lrzsz sudo apt-get in ...

  7. win10下通过编译源码方式在chrome中成功安装react-devtools开发工具插件

    win10下通过编译源码方式在chrome中成功安装react-devtools开发工具插件   1.去git上下载react-devtools文件到本地,https://github.com/fac ...

  8. 源码方式安装 lrzsz库

    源码方式安装 lrzsz库:https://www.cnblogs.com/cocoajin/p/11731787.html 我们都知道安装了lrzsz工具的linux系统环境,在shell里可以非常 ...

  9. Linux上生产环境源码方式安装配置postgresql12

    1.Linux上源码方式安装postgresql12 01.准备操作系统环境 echo "192.168.1.61 tsepg61" >> /etc/hosts mou ...

随机推荐

  1. Mysql --创建用户和授权,备份

    权限管理 我们知道我们的最高权限管理者是root用户,它拥有着最高的权限操作.包括select.update.delete.update.grant等操作.那么一般情况在公司之后DBA工程师会创建一个 ...

  2. Mac OSX 系统搭建 Java 开发环境

    转载:https://www.cnblogs.com/zjx2711904647/p/7735556.html 1. 安装JDK 双击jdk-9.0.1_osx-x64_bin.dmg文件进行安装 2 ...

  3. vue+cordova插件使用,bluetoothSerial.connect()连接失败

    这是GitHub地址https://github.com/don/BluetoothSerial

  4. eclipse编写连接MySQL的简单动态网页

    准备工作 下载Tomcat,建议使用最新版.下载并安装MySQL数据库,为了方便操作数据库,可以下载Navicat Premium,最新版不会提示不支持密码加密方式,所以下载最新版.除此之外,要想连接 ...

  5. const 成员函数

    我们知道,在成员函数中,如果没有修改成员变量,应该给成员函数加上 const 修饰符,例如 #include <iostream> using namespace std; class F ...

  6. codeforces 502 g The Tree

    题解: 一道优秀的题目 有几种做法: 1.维护后缀和 刚开始我想的是维护前缀和 然后用$sum[x]-sum[y]>=dep[x]-dep[y]$来做 但是这样子树赋值为0这个操作就很难进行了 ...

  7. springboot的jar包

    公用jar包放在api层.有些却包的不用增加pom文件.将已存在的jar包加入即可

  8. Microsoft Office Word 中的公式自动编号

    先插入公式,#,插入题注(交叉引用),生成了标号.此时整个公式是题注样式.在公式和标号之间插入一个样式分隔符. ____________________________________________ ...

  9. vue笔记-生命周期

    生命周期钩子 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...

  10. mysql 使用教程 入门

    转载 http://www.cnblogs.com/mr-wid/archive/2013/05/09/3068229.html MySQL有三大类数据类型, 分别为数字.日期\时间.字符串, 这三大 ...