mariadbのバージョンアップ【5.3 → 10.2】
wordpress導入後にmariadbをチューニング中に脆弱性が多数見つかったため、mariadbをバージョンアップ。対応内容を備忘録。
- MySQLTunerで検査
- インストール
# cd /usr/local/src/ # wget -O mysqltuner.zip https://github.com/rackerhacker/MySQLTuner-perl/archive/master.zip # unzip mysqltuner.zip # rm mysqltuner.zip # cd MySQLTuner-perl-master # chmod 755 mysqltuner.pl
- 実行
perlの実行ファイルをそのまま実行できる。
色々脆弱性がありますよー。と表示されている。
# perl mysqltuner.pl --buffers
<略>
[!!] CVE-2016-5584(<= 5.5.52) : "Unspecified vulnerability in Oracle MySQL 5.5.52 and earlier
[!!] CVE-2017-3238(<= 5.5.53) : "Vulnerability in the MySQL Server component of Oracle MySQL (subcomponent: Server: Optimizer). Supported versions that are affected are 5.5.53 and earlier
[!!] CVE-2017-3243(<= 5.5.53) : "Vulnerability in the MySQL Server component of Oracle MySQL (subcomponent: Server: Charsets). Supported versions that are affected are 5.5.53 and earlier. Difficult to exploit vulnerability allows high privileged attacker with network access via multiple protocols to compromise MySQL Server. Successful attacks of this vulnerability can result in unauthorized ability to cause a hang or frequently repeatable crash (complete DOS) of MySQL Server. CVSS v3.0 Base Score 4.4 (Availability impacts)."
[!!] CVE-2017-3244(<= 5.5.53) : "Vulnerability in the MySQL Server component of Oracle MySQL (subcomponent: Server: DML). Supported versions that are affected are 5.5.53 and earlier
<略>
-
MariaDBのアップデート
参考にしたサイトはこちら
http://www.84kure.com/blog/2016/04/12/mysql-mariadb%E3%82%925%E3%81%8B%E3%82%8910%E3%81%AB%E3%82%A2%E3%83%83%E3%83%97%E3%83%87%E3%83%BC%E3%83%88%E3%81%99%E3%82%8B/
-
GPG-KEYの取得
# rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
- リポジトリ設定
cat << EOF > /etc/yum.repos.d/mariadb.repo> [mariadb]> name = MariaDB> baseurl = http://yum.mariadb.org/10.2.6/centos7-amd64/> gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB> gpgcheck=1> enabled=1> EOF
- アップデート
# yum update MariaDB-server MariaDB-client
- 確認&起動
[root@www1 ~]# rpm -qa | grep MariaMariaDB-compat-10.2.6-1.el7.centos.x86_64MariaDB-common-10.2.6-1.el7.centos.x86_64MariaDB-client-10.2.6-1.el7.centos.x86_64MariaDB-server-10.2.6-1.el7.centos.x86_64
[root@www1 ~]# systemctl restart mariadb
Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details. - エラー内容確認
# systemctl status mariadb
InnoDBでトラブルっぽい?
<略>
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
mariadb.service: main process exited, code=exited, status=1/FAILURE
<略> - もう一度サービス起動しつつ確認
エラーが発生しているため起動に時間がかかるので途中でとめて、ログ確認
# systemctl start mariadb
下記エラーが多数発生。
Ctrl+Cでとめて
# systemctl status mariadb
./ibdata1というファイルを別のプロセスが掴んでいるのかな?
[ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
[Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files. - 関連プロセスをKILL
# ps aux | grep mysqld
# kill ******1
- mariaDB起動
# systemctl start mariadb
エラーは出ていないっぽい?
# systemctl status mariadb
- 原因を調べたいけど、時間がないからまた後日
*1:プロセス番号