ユーザ用ツール

サイト用ツール


mysql:mysql57memo

MySQL 5.7 に関するあれこれ

VerUP

既存の5.6から5.7へのアップデートは以下の手順で可能。
https://dev.mysql.com/doc/refman/5.7/en/upgrading.html#upgrade-procedure-inplace

# /usr/bin/mysql -V
/usr/bin/mysql  Ver 14.14 Distrib 5.6.29, for Linux (x86_64) using  EditLine wrapper

WALの内容をシャットダウン時にテーブルスペースに反映させる
# /usr/bin/mysql -u root -p -e "show global variables like 'innodb_fast_shutdown';"
Enter password: 
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+

# /usr/bin/mysql -u root -p -e "set global innodb_fast_shutdown=0"
Enter password:

シャットダウン
# /usr/bin/mysqladmin -u root -p shutdown
Enter password:

(必要であれば)5.6のリポジトリ情報削除
# yum remove mysql-community-release

# yum install http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
# yum clean all
# yum update mysql-server
~省略~
==========================================================================================
 パッケージ                      アーキテクチャ
                                            バージョン        リポジトリー           容量
==========================================================================================
更新:
 mysql-community-server          x86_64     5.7.11-1.el6      mysql57-community     135 M
依存性関連での更新をします。:
 mysql-community-client          x86_64     5.7.11-1.el6      mysql57-community      23 M
 mysql-community-common          x86_64     5.7.11-1.el6      mysql57-community     326 k
 mysql-community-devel           x86_64     5.7.11-1.el6      mysql57-community     3.7 M
 mysql-community-libs            x86_64     5.7.11-1.el6      mysql57-community     2.1 M
 mysql-community-libs-compat     x86_64     5.7.11-1.el6      mysql57-community     1.6 M

トランザクションの要約
==========================================================================================
アップグレード       6 パッケージ
~省略~
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
~省略~

# mysql -V
mysql  Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using  EditLine wrapper

# cp /etc/my.cnf /etc/my.cnf.56
# vi /etc/my.cnf
28,39c28
< ##----------------- 5.6 compatible -----------------##
<
< sql_mode= NO_ENGINE_SUBSTITUTION
< secure_file_priv= ""
< binlog_format= STATEMENT
< innodb_buffer_pool_dump_at_shutdown= 0
< innodb_buffer_pool_load_at_startup= 0
< innodb_buffer_pool_dump_pct= 100
< default_password_lifetime= 0
< ### Remove log_warnings!!
< log_error_verbosity= 3
< log_timestamps= SYSTEM
< internal_tmp_disk_storage_engine= MyISAM
< show_compatibility_56= ON
---
> sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
40a30
> [mysqld_safe]
43,45d32
< 
< validate-password=OFF
< 

# /etc/init.d/mysqld start 

# mysql_upgrade -u root -p
Enter password:

# /etc/init.d/mysqld restart 

5.6をMasterとしたReplication

可能。

https://dev.mysql.com/doc/refman/5.7/en/replication-compatibility.html

MySQL supports replication from one release series to the next higher release series. For example, you can replicate from a master running MySQL 5.5 to a slave running MySQL 5.6, from a master running MySQL 5.6 to a slave running MySQL 5.7, and so on.

Percona XtraBackup

2.4から対応している。

https://www.percona.com/doc/percona-xtrabackup/2.4/index.html

yumでインストールする時には、Verを指定する必要がある。

# yum install percona-xtrabackup-24

Percona XtraBackup からのリストア

5.7のバックアップを5.7なら可能。
5.6など以前のVerへは不可能。

memo

オリジナルのデータディレクトリを置き換えたあとMySQLが起動しない場合は、SELINUXを疑う。

# /etc/init.d/mysqld start                                                                                                                                                                                                    
MySQL Daemon failed to start.
mysqld を起動中:                                           [失敗]

# tail /var/log/mysqld.log
160407 04:09:28 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-04-07 04:09:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-07 04:09:29 0 [Note] /usr/sbin/mysqld (mysqld 5.6.29-log) starting as process 14762 ...
2016-04-07 04:09:29 14762 [Warning] Can't create test file /var/lib/mysql/my03.lower-test
2016-04-07 04:09:29 14762 [Warning] Can't create test file /var/lib/mysql/my03.lower-test
/usr/sbin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13 - Permission denied)
2016-04-07 04:09:29 14762 [ERROR] Aborting

2016-04-07 04:09:29 14762 [Note] Binlog end
2016-04-07 04:09:29 14762 [Note] /usr/sbin/mysqld: Shutdown complete

160407 04:09:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

# getenforce                                                                                                                                                                                                                  
Enforcing
# setenforce 0                                                                                                                                                                                                                
# getenforce 
Permissive
mysql/mysql57memo.txt · 最終更新: 2016/05/24 01:57 by clownclown

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki