Thursday, November 18, 2021

Upgrading fom mariadb 10.4 to 10.5

 Reference: 

https://mariadb.com/kb/en/upgrading-from-mariadb-104-to-mariadb-105/

https://computingforgeeks.com/how-to-install-mariadb-server-on-centos-rhel-linux/


1. Shutdown all client applications (eg. tomcat)

2. Shutdown mariadb

[root@database-rhel84 yum.repos.d]# systemctl stop mariadb

[root@database-rhel84 yum.repos.d]# systemctl status mariadb

● mariadb.service - MariaDB 10.4.22 database server

   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)

  Drop-In: /etc/systemd/system/mariadb.service.d

           └─migrated-from-my.cnf-settings.conf

   Active: inactive (dead)

     Docs: man:mysqld(8)

           https://mariadb.com/kb/en/library/systemd/


Nov 19 20:09:26 database-rhel84 mysqld[40315]: 2021-11-19 20:09:26 0 [Note] InnoDB: FTS optimize thread exiting.

Nov 19 20:09:26 database-rhel84 mysqld[40315]: 2021-11-19 20:09:26 0 [Note] InnoDB: Starting shutdown...

Nov 19 20:09:26 database-rhel84 mysqld[40315]: 2021-11-19 20:09:26 0 [Note] InnoDB: Dumping buffer pool(s) to /data/mysql-data/ib_buffer_pool

Nov 19 20:09:26 database-rhel84 mysqld[40315]: 2021-11-19 20:09:26 0 [Note] InnoDB: Instance 0, restricted to 1013 pages due to innodb_buf_pool_dump_pct=25

Nov 19 20:09:26 database-rhel84 mysqld[40315]: 2021-11-19 20:09:26 0 [Note] InnoDB: Buffer pool(s) dump completed at 211119 20:09:26

Nov 19 20:09:27 database-rhel84 mysqld[40315]: 2021-11-19 20:09:27 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"

Nov 19 20:09:27 database-rhel84 mysqld[40315]: 2021-11-19 20:09:27 0 [Note] InnoDB: Shutdown completed; log sequence number 236382536; transaction id 89052

Nov 19 20:09:27 database-rhel84 mysqld[40315]: 2021-11-19 20:09:27 0 [Note] /usr/sbin/mysqld: Shutdown complete

Nov 19 20:09:27 database-rhel84 systemd[1]: mariadb.service: Succeeded.

Nov 19 20:09:27 database-rhel84 systemd[1]: Stopped MariaDB 10.4.22 database server.




3. Add 10.5 repo 

[root@database-rhel84 yum.repos.d]# sudo bash mariadb_repo_setup --mariadb-server-version=10.5

[info] Checking for script prerequisites.

[warning] Found existing file at /etc/yum.repos.d/mariadb.repo. Moving to /etc/yum.repos.d/mariadb.repo.old_1

[info] Repository file successfully written to /etc/yum.repos.d/mariadb.repo

[info] Adding trusted package signing keys...

/etc/pki/rpm-gpg /etc/yum.repos.d

/etc/yum.repos.d

[info] Successfully added trusted package signing keys

[info] Cleaning package cache...

40 files removed



4. Uninstall old version of Mariadb
[root@database-rhel84 yum.repos.d]# sudo yum remove MariaDB-server
Dependencies resolved.
=======================================================================================================================================================================
 Package                                 Architecture                    Version                                   Repository                                     Size
=======================================================================================================================================================================
Removing:
 MariaDB-server                          x86_64                          10.4.22-1.el8                             @mariadb-main                                 125 M
Removing unused dependencies:
 galera-4                                x86_64                          26.4.9-1.el8                              @mariadb-main                                  61 M
 socat                                   x86_64                          1.7.3.3-2.el8                             @LocalRepo_AppStream                          1.1 M

Transaction Summary
=======================================================================================================================================================================
Remove  3 Packages

Freed space: 187 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                               1/1
  Running scriptlet: MariaDB-server-10.4.22-1.el8.x86_64                                                                                                           1/1
  Running scriptlet: MariaDB-server-10.4.22-1.el8.x86_64                                                                                                           1/3
  Erasing          : MariaDB-server-10.4.22-1.el8.x86_64                                                                                                           1/3
warning: /etc/my.cnf.d/server.cnf saved as /etc/my.cnf.d/server.cnf.rpmsave

  Running scriptlet: MariaDB-server-10.4.22-1.el8.x86_64                                                                                                           1/3
  Running scriptlet: galera-4-26.4.9-1.el8.x86_64                                                                                                                  2/3
  Erasing          : galera-4-26.4.9-1.el8.x86_64                                                                                                                  2/3
  Running scriptlet: galera-4-26.4.9-1.el8.x86_64                                                                                                                  2/3
  Erasing          : socat-1.7.3.3-2.el8.x86_64                                                                                                                    3/3
  Running scriptlet: socat-1.7.3.3-2.el8.x86_64                                                                                                                    3/3
  Verifying        : MariaDB-server-10.4.22-1.el8.x86_64                                                                                                           1/3
  Verifying        : galera-4-26.4.9-1.el8.x86_64                                                                                                                  2/3
  Verifying        : socat-1.7.3.3-2.el8.x86_64                                                                                                                    3/3
Installed products updated.

Removed:
  MariaDB-server-10.4.22-1.el8.x86_64                         galera-4-26.4.9-1.el8.x86_64                         socat-1.7.3.3-2.el8.x86_64

Complete!


6. Install new version of mariadb

[root@database-rhel84 yum.repos.d]# sudo yum install MariaDB-server MariaDB-client MariaDB-backup
MariaDB Server                                                                                                                         457 kB/s | 597 kB     00:01
MariaDB MaxScale                                                                                                                       4.7 kB/s | 8.0 kB     00:01
MariaDB Tools                                                                                                                          3.2 kB/s | 3.6 kB     00:01
packages-microsoft-com-prod                                                                                                            9.7 MB/s | 7.9 MB     00:00
packages-microsoft-com-mssql-server-2019                                                                                               8.5 MB/s | 4.3 MB     00:00
LocalRepository_BaseOS                                                                                                                 307 MB/s | 2.3 MB     00:00
LocalRepository_AppStream                                                                                                              328 MB/s | 6.8 MB     00:00
Package MariaDB-client-10.4.22-1.el8.x86_64 is already installed.
Package MariaDB-backup-10.4.22-1.el8.x86_64 is already installed.
Dependencies resolved.
=======================================================================================================================================================================
 Package                                  Architecture                     Version                                 Repository                                     Size
=======================================================================================================================================================================
Installing:
 MariaDB-server                           x86_64                           10.5.13-1.el8                           mariadb-main                                   26 M
Upgrading:
 MariaDB-backup                           x86_64                           10.5.13-1.el8                           mariadb-main                                  7.0 M
 MariaDB-client                           x86_64                           10.5.13-1.el8                           mariadb-main                                   13 M
Installing dependencies:
 galera-4                                 x86_64                           26.4.9-1.el8                            mariadb-main                                   13 M
 socat                                    x86_64                           1.7.3.3-2.el8                           LocalRepo_AppStream                           302 k

Transaction Summary
=======================================================================================================================================================================
Install  3 Packages
Upgrade  2 Packages

Total size: 60 M
Total download size: 60 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): MariaDB-backup-10.5.13-1.el8.x86_64.rpm                                                                                         1.8 MB/s | 7.0 MB     00:03
(2/4): MariaDB-server-10.5.13-1.el8.x86_64.rpm                                                                                         4.0 MB/s |  26 MB     00:06
(3/4): MariaDB-client-10.5.13-1.el8.x86_64.rpm                                                                                         3.1 MB/s |  13 MB     00:04
(4/4): galera-4-26.4.9-1.el8.x86_64.rpm                                                                                                992 kB/s |  13 MB     00:13
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                  4.4 MB/s |  60 MB     00:13
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                               1/1
  Running scriptlet: MariaDB-client-10.5.13-1.el8.x86_64                                                                                                           1/7
  Upgrading        : MariaDB-client-10.5.13-1.el8.x86_64                                                                                                           1/7
  Running scriptlet: MariaDB-client-10.5.13-1.el8.x86_64                                                                                                           1/7
  Installing       : socat-1.7.3.3-2.el8.x86_64                                                                                                                    2/7
  Running scriptlet: galera-4-26.4.9-1.el8.x86_64                                                                                                                  3/7
  Installing       : galera-4-26.4.9-1.el8.x86_64                                                                                                                  3/7
  Running scriptlet: galera-4-26.4.9-1.el8.x86_64                                                                                                                  3/7
  Running scriptlet: MariaDB-server-10.5.13-1.el8.x86_64                                                                                                           4/7
  Installing       : MariaDB-server-10.5.13-1.el8.x86_64                                                                                                           4/7
  Running scriptlet: MariaDB-server-10.5.13-1.el8.x86_64                                                                                                           4/7


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/


  Running scriptlet: MariaDB-backup-10.5.13-1.el8.x86_64                                                                                                           5/7
  Upgrading        : MariaDB-backup-10.5.13-1.el8.x86_64                                                                                                           5/7
  Running scriptlet: MariaDB-backup-10.5.13-1.el8.x86_64                                                                                                           5/7
  Running scriptlet: MariaDB-client-10.4.22-1.el8.x86_64                                                                                                           6/7
  Cleanup          : MariaDB-client-10.4.22-1.el8.x86_64                                                                                                           6/7
  Running scriptlet: MariaDB-client-10.4.22-1.el8.x86_64                                                                                                           6/7
  Running scriptlet: MariaDB-backup-10.4.22-1.el8.x86_64                                                                                                           7/7
  Cleanup          : MariaDB-backup-10.4.22-1.el8.x86_64                                                                                                           7/7
  Running scriptlet: MariaDB-backup-10.4.22-1.el8.x86_64                                                                                                           7/7
  Running scriptlet: MariaDB-server-10.5.13-1.el8.x86_64                                                                                                           7/7
  Running scriptlet: MariaDB-backup-10.4.22-1.el8.x86_64                                                                                                           7/7
  Verifying        : MariaDB-server-10.5.13-1.el8.x86_64                                                                                                           1/7
  Verifying        : galera-4-26.4.9-1.el8.x86_64                                                                                                                  2/7
  Verifying        : socat-1.7.3.3-2.el8.x86_64                                                                                                                    3/7
  Verifying        : MariaDB-backup-10.5.13-1.el8.x86_64                                                                                                           4/7
  Verifying        : MariaDB-backup-10.4.22-1.el8.x86_64                                                                                                           5/7
  Verifying        : MariaDB-client-10.5.13-1.el8.x86_64                                                                                                           6/7
  Verifying        : MariaDB-client-10.4.22-1.el8.x86_64                                                                                                           7/7
Installed products updated.

Upgraded:
  MariaDB-backup-10.5.13-1.el8.x86_64                                                MariaDB-client-10.5.13-1.el8.x86_64
Installed:
  MariaDB-server-10.5.13-1.el8.x86_64                         galera-4-26.4.9-1.el8.x86_64                         socat-1.7.3.3-2.el8.x86_64

Complete!


7. Start mariadb ** put back any changes to server.cnf

[root@database-rhel84 yum.repos.d]# systemctl start mariadb
[root@database-rhel84 yum.repos.d]# systemctl status mariadb
● mariadb.service - MariaDB 10.5.13 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
   Active: active (running) since Fri 2021-11-19 20:16:11 +08; 7s ago
     Docs: man:mariadbd(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 202704 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 202675 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl s>
  Process: 202672 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 202685 (mariadbd)
   Status: "Taking your SQL requests now..."
    Tasks: 18 (limit: 100943)
   Memory: 71.1M
   CGroup: /system.slice/mariadb.service
           └─202685 /usr/sbin/mariadbd

Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] InnoDB: 10.5.13 started; log sequence number 45094; transaction id 20
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] Plugin 'FEEDBACK' is disabled.
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] InnoDB: Buffer pool(s) load completed at 211119 20:16:11
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] Server socket created on IP: '::'.
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] Reading of all Master_info entries succeeded
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] Added new Master_info '' to hash table
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: 2021-11-19 20:16:11 0 [Note] /usr/sbin/mariadbd: ready for connections.
Nov 19 20:16:11 database-rhel84 mariadbd[202685]: Version: '10.5.13-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
Nov 19 20:16:11 database-rhel84 systemd[1]: Started MariaDB 10.5.13 database server.


8. Run mysql_upgrade - make sure your server.cnf is pointing to the right data directory or else u will get the error below.

[root@database-rhel84 my.cnf.d]# mysql_upgrade --verbose
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos
Error    : Table 'mysql.gtid_slave_pos' doesn't exist in engine
status   : Operation failed
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats
Error    : Table 'mysql.innodb_index_stats' doesn't exist in engine
status   : Operation failed
mysql.innodb_table_stats
Error    : Table 'mysql.innodb_table_stats' doesn't exist in engine
status   : Operation failed
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry
Error    : Table 'mysql.transaction_registry' doesn't exist in engine
status   : Operation failed

Repairing tables
mysql.gtid_slave_pos
Error    : Table 'mysql.gtid_slave_pos' doesn't exist in engine
status   : Operation failed
mysql.innodb_index_stats
Error    : Table 'mysql.innodb_index_stats' doesn't exist in engine
status   : Operation failed
mysql.innodb_table_stats
Error    : Table 'mysql.innodb_table_stats' doesn't exist in engine
status   : Operation failed
mysql.transaction_registry
Error    : Table 'mysql.transaction_registry' doesn't exist in engine
status   : Operation failed
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Processing databases
information_schema
mysql
mysql.user                                         OK
performance_schema
test
ucdb
uidb
uidb.uaci_offerstatstx_syn                         OK
ujdb
ujrptdb
umpdb
updb
urptdb
Phase 4/7: Running 'mysql_fix_privilege_tables'
ERROR 1932 (42S02) at line 448: Table 'mysql.innodb_index_stats' doesn't exist in engine
FATAL ERROR: Upgrade failed



No comments:

Post a Comment