Help us understand the problem. What is going on with this article?

(解決)mysql(mariadb)が起動しなくなった

More than 1 year has passed since last update.

環境

GCP (Google Cloud Platform)
Compute Engine

状態チェック

sudo systemctl status mariadb

Active: failedで起動していません(涙
Status: "MariaDB server is down" が哀愁を深めます。

● mariadb.service - MariaDB 10.1.31 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: failed (Result: exit-code) since 日 2019-01-27 20:26:45 JST; 2min 17s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 1694 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/F
AILURE)
  Process: 1587 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`/usr/bin/galera_recovery`; [ $?
 -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
  Process: 1583 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 1694 (code=exited, status=1/FAILURE)
   Status: "MariaDB server is down"
 1月 27 20:26:43 instance-sugasaki-gom-kusanagi-02 systemd[1]: Starting MariaDB 10.1.31 database server...
 1月 27 20:26:45 instance-sugasaki-gom-kusanagi-02 mysqld[1694]: 2019-01-27 20:26:45 140290193697024 [Note] /usr/sbi......
 1月 27 20:26:45 instance-sugasaki-gom-kusanagi-02 systemd[1]: mariadb.service: main process exited, code=exited, st...URE
 1月 27 20:26:45 instance-sugasaki-gom-kusanagi-02 systemd[1]: Failed to start MariaDB 10.1.31 database server.
 1月 27 20:26:45 instance-sugasaki-gom-kusanagi-02 systemd[1]: Unit mariadb.service entered failed state.
 1月 27 20:26:45 instance-sugasaki-gom-kusanagi-02 systemd[1]: mariadb.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

以下のファイルにログファイルのパスを発見
/etc/my.cnf.d/server.cnf

/etc/my.cnf.d/server.cnf
...
log-error = /var/log/mysql/mysqld.log
...

vi /var/log/mysql/mysqld.logでログファイルを確認

2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Compressed tables use zlib 1.2.7
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Using Linux native AIO
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Using SSE crc32 instructions
2019-01-27 19:16:22 140146316003584 [Note] InnoDB: Initializing buffer pool, size = 384.0M

The InnoDB memory heap is disabled

と書いてあります。
はっ!

結果

GCPのVMインスタンスの料金をケチって、メモリを最小(0.6GB)に変えてたのが原因でした。
スクリーンショット 2019-01-27 20.43.44.png

  ↓

Kobito.7TpvlM.png

sugasaki
個人的なメモが多いです。 書いてる事は個人の見解であり所属する組織の公式見解ではありません
https://sugasaki.com/
runners
スポーツで世界を良くしたいエンジニアチーム。応援navi、.finisher、run&といった製品開発をしています!
https://www.wantedly.com/projects/167082
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away