Forum

Nextcloud 21 - Mari...
 
Notifications
Clear all

Nextcloud 21 - MariaDB 10.2 en hoger

Lantern
(@lantern)
Illustrious Member Admin

Nextcloud 21 ondersteund alleen nog maar MariaDB 10.2 en hoger (10.5) dus we moesten aan de bak ! Want mijn Nextcloud draaide nog op het oude MariaDB 5.5. 

Hoe check ik mijn versie van MariaDB?

1. log in op MariaDB via cmd: sudo mariadb -u -p - waarbij de u = user en p = paswoord

2. Type dan in cmd: SELECT VERSION(); [ENTER]

3. Dan zou je het onderstaande moeten zien:

+-----------------+
| VERSION()       |
+-----------------+
| 10.5.13-MariaDB |
+-----------------+

LET OP: * Lees eerst deze how to door voordat je gaat upgraden *

(!) : Mijn Nextcloud omgeving draait op CENTOS 7 waardoor commando's, meldingen etc kan verschillen van o.a. UBUNTU

(!!): Fix MariaDB 10.6 upgrade (zie einde post)

 

HOW TO: UBUNTU VERSION

Data Backup 

Occasionally, issues can be encountered during upgrades. These issues can even potentially corrupt the database's data files, preventing you from easily reverting to the old installation. Therefore, it is generally best to perform a backup prior to upgrading. If an issue is encountered during the upgrade, you can use the backup to restore your MariaDB Server database to the old version. If the upgrade finishes without issue, then the backup can be deleted.

The instructions below show how to perform a backup using MariaDB Backup. For more information about backing up and restoring the database, please see the Recovery Guide.

  1. Take a full backup:

    $ sudo mariadb-backup --backup \
          --user=mariabackup_user \
          --password=mariabackup_passwd \
          --target-dir=/data/backup/preupgrade_backup
    

    Confirm successful completion of the backup operation.

  2. The backup must be prepared:

    $ sudo mariadb-backup --prepare \
          --target-dir=/data/backup/preupgrade_backup
    

    Confirm successful completion of the prepare operation.

  3. Backups should be tested before they are trusted.

 

Uninstall the Old Version

When upgrading to a new major release of MariaDB Community Server, it is necessary to remove the existing installation of MariaDB Community Server, before installing the new version of MariaDB Community Server. Otherwise, the package manager will refuse to install the new version of MariaDB Community Server.

 

Stop the MariaDB Server Process

Before the old version can be uninstalled, we first need to stop the current MariaDB Server process.

  1. Set theinnodb_fast_shutdownsystem variable to1:

    SET GLOBAL innodb_fast_shutdown = 1;
    
  2. UseXA RECOVERto confirm that there are no external XA transactions in a prepared state:

    XA RECOVER;
    

    Commit or rollback any open XA transactions before stopping the node for upgrade.

  3. Stop the server process using thesystemctlcommand:

    $ sudo systemctl stop mariadb
    
 
 

Uninstall via APT (Debian/Ubuntu)

  1. Uninstall all of the MariaDB Community Server packages. Note that a wildcard character is used to ensure that all MariaDB Community Server packages are uninstalled.

    $ sudo apt-get remove "mariadb-*"
    

    Be sure to check that this wildcard does not unintentionally refer to any of your custom applications.

  2. Uninstall the Galera package as well (1).

    The name of the package depends on the specific version of MariaDB Community Server.

    When upgrading from MariaDB Community Server 10.4, the package is calledgalera-4:

    $ sudo apt remove galera-4
    

    When upgrading from MariaDB Community Server 10.3 or earlier, the package is calledgalera-3:

    $ sudo apt remove galera-3
    
  3. Before proceeding, verify that all MariaDB Community Server packages are uninstalled. The following command should not return any results:

    $ apt list --installed | grep -i -E "mariadb|galera"
    
 
(1) - Galera package heb ik niet geinstalleerd staan dus ik kon naar stap 3.
 

Install the New Version

MariaDB Corporation provides a APT package repository for Ubuntu 18.04 LTS.

 

Install via APT (Debian/Ubuntu)

  1. Configure the APT package repository.

    To configure APT package repositories:

    $ sudo apt install wget
    
    $ wget  https://downloads.mariadb.com/MariaDB/mariadb_repo_setup 
    
    $ echo "fd3f41eefff54ce144c932100f9e0f9b1d181e0edd86a6f6b8f2a0212100c32c mariadb_repo_setup" \
        | sha256sum -c -
    
    $ chmod +x mariadb_repo_setup
    
    $ sudo ./mariadb_repo_setup \
       --mariadb-server-version="mariadb-10.5"
    
    $ sudo apt update
    
  2. Install MariaDB Community Server and package dependencies:

    $ sudo apt install mariadb-server mariadb-backup
    

    Installation of additional packages may be required for some plugins.

  3. Configure MariaDB. - hier heb ik eigenlijk niks meegedaan 

    Installation only loads MariaDB Community Server to the system. MariaDB Community Server requires configuration before the database server is ready for use.

 

Starting the Server

MariaDB Community Server includes configuration to start, stop, restart, enable/disable on boot, and check the status of the Server using the operating system default process management system.

Ubuntu 18.04 LTS uses systemd. You can manage the Server process using thesystemctlcommand:

Operation

Command

Start

sudo systemctl start mariadb

Stop

sudo systemctl stop mariadb

Restart

sudo systemctl restart mariadb

Enable during startup (2)

sudo systemctl enable mariadb

Disable during startup

sudo systemctl disable mariadb

Status

sudo systemctl status mariadb

 
(2) - vergeet niet MariaDB automatisch te laten starten als de server herstart 

Upgrading the Data Directory

MariaDB Community Server 10.5 ships with themariadb-upgradeutility which can be used to identify and correct compatibility issues in the new version. After you upgrade your Server and start the server process, run this utility to upgrade the data directory:

$ sudo mariadb-upgrade
 
Dit gaf mijn de volgende foutmelding: 
 
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
FATAL ERROR: Upgrade failed
 
Dit heb ik op gelost door het volgene cmd:
 
sudo mariadb-upgrade -u [naam van je adminuser - bijv: root]  -p

Testing

When MariaDB Community Server is up and running on your system, you should test that it is working and there weren't any issues during startup.

  1. Connect to the server usingMariaDB Clientusing theroot@localhostuser account:

    $ sudo mariadb
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 9
    Server version: 10.5.13-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>
    

    The version of the server can be verified by checking the client's initial output.

  2. You can also verify the server version by checking the value of theversionsystem variable with theSHOW GLOBAL STATUSstatement:

    SHOW GLOBAL VARIABLES LIKE 'version';
    
    +---------------+-----------------+
    | Variable_name | Value           |
    +---------------+-----------------+
    | version       | 10.5.13-MariaDB |
    +---------------+-----------------+
    
  3. You can also verify the server version by calling theVERSION()function:

    SELECT VERSION();
    
    +-----------------+
    | VERSION()       |
    +-----------------+
    | 10.5.13-MariaDB |
    +-----------------+
    
 

(!!) deze HOW TO upgrade MariaDB naar de laatste versie 10.6 ! en dat wordt nog niet ondersteund door Nextcloud. 

Het starten van MariaDB via cmd: sudo systemctl start mariadb gaf de volgende error:

[CENTOS 7] (!) 

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

Mijn aanpassing:

[CENTOS 7] (!) 

stop MariaDB via cmd: sudo systemctl stop mariadb

pad: /etc/my.cnf.d/server.cnf 

aanpassing in de config file (zie rood)

# This group is only read by MariaDB-10.6 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.6]
innodb_read_only_compressed=0

na de aanpassing moet je MariaDB opnieuw starten door cmd: sudo systemctl start mariadb

 
Ik hoop dat deze post je helpt bij het upgraden van MariaDB voor je nextcloud omgeving. !
Quote
Topic starter Posted : 14/12/2021 4:15 pm