• MariaDB 数据库升级10.0--->10.4


    因需求将MariaDB galera cluster 版本10.0 升级为10.4 版本

    思路:

    1.先进行备份,预防意外

    2.关闭数据库,卸载原先的10.0 MariaDB

    3.安装10.4 版本的 MariaDB

    4.配置配置文件,启动数据库。

    升级步骤:

    ## 关闭数据库,卸载原先的10.0 MariaDB

    [root@test1 ~]# service mysql stop
    Shutting down MariaDB..... SUCCESS!
    [root@test1 ~]# rpm -qa |grep Maria
    MariaDB-client-10.0.38-1.el7.centos.x86_64
    MariaDB-common-10.0.38-1.el7.centos.x86_64
    MariaDB-Galera-server-10.0.38-1.el7.centos.x86_64
    [root@test1 ~]# rpm -e Maria*
    [root@test1 ~]# rpm -e galera*
    [root@test1 ~]# rpm -qa |grep Maria

    如果利用yum进行操作
    [root@test1 ~]# yum search Maria
    Loaded plugins: fastestmirror
    Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
    Determining fastest mirrors

     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    ========================================================================= N/S matched: Maria =========================================================================
    MariaDB-Galera-server.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-Galera-test.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-cassandra-engine.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-client.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-common.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-compat.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-connect-engine.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-devel.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-oqgraph-engine.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-server.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-shared.x86_64 : MariaDB: a very fast and robust SQL database server
    MariaDB-test.x86_64 : MariaDB: a very fast and robust SQL database server
    mariadb-bench.x86_64 : MariaDB benchmark scripts and data
    mariadb-devel.i686 : Files for development of MariaDB/MySQL applications
    mariadb-devel.x86_64 : Files for development of MariaDB/MySQL applications
    mariadb-embedded.i686 : MariaDB as an embeddable library
    mariadb-embedded.x86_64 : MariaDB as an embeddable library
    mariadb-embedded-devel.i686 : Development files for MariaDB as an embeddable library
    mariadb-embedded-devel.x86_64 : Development files for MariaDB as an embeddable library
    mariadb-libs.i686 : The shared libraries required for MariaDB/MySQL clients
    mariadb-libs.x86_64 : The shared libraries required for MariaDB/MySQL clients
    mariadb-server.x86_64 : The MariaDB server and related files
    mariadb-test.x86_64 : The test suite distributed with MariaD
    mariadb.x86_64 : A community developed branch of MySQL
      Name and summary matches only, use "search all" for everything.


    [root@test1 ~]# yum remove Maria*
    Loaded plugins: fastestmirror
    Resolving Dependencies
    --> Running transaction check
    ---> Package MariaDB-Galera-server.x86_64 0:10.0.38-1.el7.centos will be erased
    ---> Package MariaDB-client.x86_64 0:10.0.38-1.el7.centos will be erased
    ---> Package MariaDB-common.x86_64 0:10.0.38-1.el7.centos will be erased
    --> Finished Dependency Resolution

    Dependencies Resolved

    ======================================================================================================================================================================
     Package                                        Arch                            Version                                       Repository                         Size
    ======================================================================================================================================================================
    Removing:
     MariaDB-Galera-server                          x86_64                          10.0.38-1.el7.centos                          @mariadb                          145 M
     MariaDB-client                                 x86_64                          10.0.38-1.el7.centos                          @mariadb                           49 M
     MariaDB-common                                 x86_64                          10.0.38-1.el7.centos                          @mariadb                          248 k

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

    Installed size: 194 M
    Is this ok [y/N]: y
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Erasing    : MariaDB-Galera-server-10.0.38-1.el7.centos.x86_64                                                                                                  1/3
    warning: /etc/my.cnf.d/server.cnf saved as /etc/my.cnf.d/server.cnf.rpmsave
      Erasing    : MariaDB-client-10.0.38-1.el7.centos.x86_64                                                                                                         2/3
      Erasing    : MariaDB-common-10.0.38-1.el7.centos.x86_64                                                                                                         3/3
      Verifying  : MariaDB-client-10.0.38-1.el7.centos.x86_64                                                                                                         1/3
      Verifying  : MariaDB-common-10.0.38-1.el7.centos.x86_64                                                                                                         2/3
      Verifying  : MariaDB-Galera-server-10.0.38-1.el7.centos.x86_64                                                                                                  3/3

    Removed:
      MariaDB-Galera-server.x86_64 0:10.0.38-1.el7.centos        MariaDB-client.x86_64 0:10.0.38-1.el7.centos        MariaDB-common.x86_64 0:10.0.38-1.el7.centos

    Complete!
    [root@test1 ~]# yum remove galera*

    ## 安装10.4 MariaDB数据库

    yum install MariaDB-Galera-server MariaDB-client galera -y

    ## 启动数据库: systemctl start mariadb

    ## 验证数据量大小

    select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'GB') as data from information_schema.TABLES;

    ## mysql_upgrade检查不兼容的表,更新grant表;

    [root@test1 data]# mysql_upgrade -uroot -p
    Phase 1/7: Checking and upgrading mysql database
    `````

    ## 验证数据量大小

    select concat(round(sum(DATA_LENGTH/1024/1024/1024),2),'GB') as data from information_schema.TABLES;

     

  • 相关阅读:
    个人不断学习的真正起因(值得收藏)——北漂18年(24)
    IPython基础使用_Round2
    IPython基础使用_Round2
    Mysql 创建查询用户
    8.11.3 Concurrent Inserts 并发插入:
    8.11.2 Table Locking Issues 表锁发生
    8.11.1 Internal Locking Methods
    Oracle timestamp
    报表引擎API开发入门— EJB程序数据源
    8.10.3 The MySQL Query Cache
  • 原文地址:https://www.cnblogs.com/Leo-Cjh/p/13469430.html
Copyright © 2020-2023  润新知