Wednesday, January 15, 2020

Increase mariadb page size (innodb-page-size=32768) from 16K


If you try to increase innodb page size, you will get the following error when you restart mariadb:

Jan 15 15:53:56 rhel73.localdomain.com mysqld[49821]: 2020-01-15 15:53:56 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the m
Jan 15 15:53:56 rhel73.localdomain.com mysqld[49821]: 2020-01-15 15:53:56 0 [ERROR] InnoDB: Data file './ibdata1' uses page size 16384, but the innodb_page_size start-up parameter is 32768
Jan 15 15:53:56 rhel73.localdomain.com mysqld[49821]: 2020-01-15 15:53:56 0 [ERROR] InnoDB: Corrupted page [page id: space=0, page number=0] of datafile './ibdata1' could not be found in th
Jan 15 15:53:56 rhel73.localdomain.com mysqld[49821]: 2020-01-15 15:53:56 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error

To resolve this:
- Remove the innodb_data_file_path line from your my.cnf file

- Restart the server; it should come up normally now

- Perform a complete dump of all your databases (just in case) (use mysqldump)
- Perform a complete dump of your InnoDB tables (use mysqldump)
[root@rhel73 my.cnf.d]# mysqldump --all-databases > all_databases.sql

[root@rhel73 my.cnf.d]#
[root@rhel73 my.cnf.d]# ls -l
total 488
-rw-r--r--. 1 root root 480599 Jan 15 16:22 all_databases.sql
-rw-r--r--. 1 root root    763 Feb 20  2019 enable_encryption.preset
-rw-r--r--. 1 root root    232 Feb 20  2019 mysql-clients.cnf
-rw-r--r--. 1 root root   1210 Jan 15 16:22 server.cnf
-rw-r--r--. 1 root root   1080 Feb 20  2019 server.cnf.orig



- Remove your InnoDB tables
- Shut down the server
[root@rhel73 my.cnf.d]# systemctl stop mariadb


- Remove the default InnoDB data file and log files (these will
be the files that begin with "ib" in your data directory)
[root@rhel73 my.cnf.d]# ls -l /var/lib/mysql
total 110620
-rw-rw----. 1 mysql mysql    16384 Jan 15 17:50 aria_log.00000001
-rw-rw----. 1 mysql mysql       52 Jan 15 17:50 aria_log_control
-rw-rw----. 1 mysql mysql      860 Jan 15 17:50 ib_buffer_pool
-rw-rw----. 1 mysql mysql 12582912 Jan 15 17:50 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Jan 15 17:50 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Jan 15 17:50 ib_logfile1
-rw-rw----. 1 mysql mysql        0 Jan 14 23:10 multi-master.info
drwx--x--x. 2 mysql mysql     4096 Jan 14 23:09 mysql
drwx------. 2 mysql mysql       20 Jan 14 23:09 performance_schema
drwxr-xr-x. 2 mysql mysql        6 Jan 14 23:09 test
drwx------. 2 mysql mysql       20 Jan 14 23:18 ucdb
drwx------. 2 mysql mysql       20 Jan 14 23:17 umpdb
[root@rhel73 my.cnf.d]# rm /var/lib/mysql/ib*
rm: remove regular file ‘/var/lib/mysql/ib_buffer_pool’? y
rm: remove regular file ‘/var/lib/mysql/ibdata1’? y
rm: remove regular file ‘/var/lib/mysql/ib_logfile0’? y
rm: remove regular file ‘/var/lib/mysql/ib_logfile1’? y



- Add the innodb_data_file_path line to your my.cnf file
- Start the server
[root@rhel73 my.cnf.d]# systemctl start mariadb
[root@rhel73 my.cnf.d]# systemctl status mariadb
● mariadb.service - MariaDB 10.3.13 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: active (running) since Wed 2020-01-15 17:50:56 SGT; 13s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 52384 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 52325 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: 52323 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 52352 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           └─52352 /usr/sbin/mysqld



- Load the dump file back into the server to recreate your InnoDB

MariaDB Bsaics

Starting to learn MariaDB for my work.

Here are some basics:

Start MariaDB services
systemctl start mariadb

Check status of mariadb
systemctl status mariadb

StopMariaDB services
systemctl stop mariadb

Check error messages:
journalctl -xe