mariadbのバージョンアップ【5.3 → 10.2】

wordpress導入後にmariadbをチューニング中に脆弱性が多数見つかったため、mariadbをバージョンアップ。対応内容を備忘録。

 

  • MySQLTunerで検査
  1. インストー
    # 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
  2. 実行

    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
    <略>

 

 

  1. GPG-KEYの取得

    # rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB 

  2. リポジトリ設定
    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
  3. アップデート
    # yum update MariaDB-server MariaDB-client


  4. 確認&起動
    [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.
  5. エラー内容確認
    # systemctl status mariadb
    <略>
    [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
    <略>

    InnoDBでトラブルっぽい?

  6. もう一度サービス起動しつつ確認 エラーが発生しているため起動に時間がかかるので途中でとめて、ログ確認
    # 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.
  7. 関連プロセスをKILL
    # ps aux | grep mysqld
    # kill ******1

     

  8. mariaDB起動
    # systemctl start mariadb
    # systemctl status mariadb
    エラーは出ていないっぽい?



  • 原因を調べたいけど、時間がないからまた後日

 

*1:プロセス番号