๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋ชฉ๋ก์ด ์—†์Šต๋‹ˆ๋‹ค.

[MySQL/MariaDB] ์„œ๋ฒ„ ์‹œ์ž‘ ์—๋Ÿฌ

๐Ÿ›ข DB/MySQL

     

    ์—๋Ÿฌ ๋‚ด์šฉ

     

    root@db-server:~# systemctl status mariadb.service
    โ— mariadb.service - MariaDB 10.5.8 database server
       Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
      Drop-In: /etc/systemd/system/mariadb.service.d
               โ””โ”€migrated-from-my.cnf-settings.conf
       Active: failed (Result: exit-code) since Mon 2021-05-31 11:14:34 KST; 24s ago
         Docs: man:mariadbd(8)
               https://mariadb.com/kb/en/library/systemd/
      Process: 7202 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
      Process: 7199 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
      Process: 3655 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
      Process: 3422 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
      Process: 3416 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
      Process: 3393 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
     Main PID: 3655 (code=exited, status=1/FAILURE)
       Status: "MariaDB server is down"
    
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] Plugin 'InnoDB' init function returned error.
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [Note] Plugin 'FEEDBACK' is disabled.
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be not loaded
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] Failed to initialize plugins.
    May 31 11:14:34 db-server mariadbd[3655]: 2021-05-31 11:14:34 0 [ERROR] Aborting
    May 31 11:14:34 db-server systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
    May 31 11:14:34 db-server systemd[1]: mariadb.service: Failed with result 'exit-code'.
    May 31 11:14:34 db-server systemd[1]: Failed to start MariaDB 10.5.8 database server.
    

     

     

    ์›์ธํŒŒ์•…

    MySQL data ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๋ฎ์–ด์“ฐ๊ธฐ ํ•ด๋†“๊ณ  service mysql restart๋ฅผ ์‹คํ–‰ํ–ˆ๋”๋‹ˆ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค. ์ด ๊ฒฝ์šฐ ๊ธฐ์กด์— data ๋””๋ ‰ํ† ๋ฆฌ๋Š” ์†Œ์œ ์ž๊ฐ€ mysql์ธ๋ฐ root ๊ถŒํ•œ์œผ๋กœ ๋ฎ์–ด์“ฐ๊ธฐ ํ•˜๋Š” ๋ฐ”๋žŒ์— ์†Œ์œ ์ž๊ฐ€ root๋กœ ๋˜์–ด์žˆ์–ด์„œ mysql ์„œ๋น„์Šค์—์„œ ์ ‘๊ทผํ•˜์ง€ ๋ชปํ•˜์—ฌ ๋ฐœ์ƒํ•œ ์—๋Ÿฌ์ด๋‹ค. ์ด ๊ฒฝ์šฐ mysql์ด ๋ฐ์ดํ„ฐ ํด๋”์— ์ ‘๊ทผ์ด ๋ถˆ๊ฐ€๋Šฅํ•˜๊ธฐ ๋–„๋ฌธ์— ์‹ค์ œ๋กœ data ๋””๋ ‰ํ† ๋ฆฌ์— mysql ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๊ฐ€ ์žˆ์Œ์—๋„ ์—†๋‹ค๊ณ  ์—๋Ÿฌ๋ฅผ ๋ฑ‰์–ด๋‚ธ๋‹ค.

     

    ํ•ด๊ฒฐ๋ฐฉ์•ˆ

    data ๋””๋ ‰ํ† ๋ฆฌ์˜ ์†Œ์œ ์ž๋ฅผ mysql๋กœ ๋ณ€๊ฒฝํ•ด์ค€๋‹ค.

     

    # chown -R mysql:mysql /mariadb/data