본 포스팅에선 mariadb 10.1 -> mariadb 10.2로 upgrade 내용을 게시하도록 하겠습니다!
사전 확인
MariaDB [(none)]> select @@version;
+-----------------+
| @@version |
+-----------------+
| 10.1.45-MariaDB |
+-----------------+
1 row in set (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| kim |
| mysql |
| performance_schema |
| sakila |
| test |
+--------------------+
6 rows in set (0.00 sec)
■ DB Shutdown & Database Backup
공식문서에는 업그레이드 하기전에 Database 백업을 추천하고 Mariabackup을 추천하고 있습니다.
Backup 하고 있는 동안은 DB에 접근하는 Session이 없어야 혹시 모를 Restore상황에서 Data의 정합성에 문제가 없습니다.
[root@localhost ~]# mariabackup --backup --target-dir=/back --user=root --password=root
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying ./sakila/customer.TRG to /back/sakila/customer.TRG
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying ./sakila/payment_date.TRN to /back/sakila/payment_date.TRN
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying ./sakila/payment.TRG to /back/sakila/payment.TRG
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying ./sakila/rental_date.TRN to /back/sakila/rental_date.TRN
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying ./sakila/rental.TRG to /back/sakila/rental.TRG
211013 11:01:44 [01] ...done
211013 11:01:44 Finished backing up non-InnoDB tables and files
211013 11:01:44 [01] Copying aria_log_control to /back/aria_log_control
211013 11:01:44 [01] ...done
211013 11:01:44 [01] Copying aria_log.00000001 to /back/aria_log.00000001
211013 11:01:44 [01] ...done
211013 11:01:44 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
mariabackup: The latest check point (for incremental): '10085271'
mariabackup: Stopping log copying thread.
.211013 11:01:44 >> log scanned up to (10085271)
211013 11:01:45 Executing UNLOCK TABLES
211013 11:01:45 All tables unlocked
211013 11:01:45 Backup created in directory '/back/'
211013 11:01:45 [00] Writing backup-my.cnf
211013 11:01:45 [00] ...done
211013 11:01:45 [00] Writing xtrabackup_info
211013 11:01:45 [00] ...done
mariabackup: Transaction log of lsn (10085271) to (10085271) was copied.
211013 11:01:45 completed OK!
■ shutdown
[root@localhost ~]# mysqladmin -uroot -proot shutdown
■새로운 버전의 mariadb 설치 파일을 옮겨줍니다.
■ 새로운 Database Version으로 Basedir 변경
기존 Basedir를 제거하고 새로운 10.2.12 Version의 Binary 파일을 Basedir로 변경합니다.
10.2.12 Basedir의 mysqld_safe로 Database를 올린다.
[root@localhost /]# tar -zxvf mariadb-10.2.12-linux-x86_64.tar.gz
[root@localhost mariadb-10.2.12-linux-x86_64]# chown -R mysql.mysql /mariadb-10.2.12-linux-x86_64
[root@localhost /]# cd mariadb-10.2.12-linux-x86_64/
[root@localhost mariadb-10.2.12-linux-x86_64]# cd bin
## 10.2.12 Basedir의 Database를 기동시켜줍니다.
[root@localhost bin]# ./mysqld_safe --user=mysql &
[1] 9353
[root@localhost bin]# 211013 13:59:12 mysqld_safe Logging to '/log/mariadb.log'.
211013 13:59:12 mysqld_safe Starting mysqld daemon with databases from /data
■mysql_upgrade 실행
mysql 데이터 베이스의 시스템 테이블 이 새 버전과 완전히 호환되는지 확인합니다.
모든 테이블을 매우 빠르게 확인하고 새 버전의 MariaDB와 호환되는 것으로 표시합니다.
[root@localhost bin]# pwd
/mariadb-10.2.12-linux-x86_64/bin
[root@localhost bin]# ./mysql_upgrade -uroot -proot
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.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
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.user OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
sakila.actor_info OK
sakila.customer_list OK
sakila.film_list OK
sakila.nicer_but_slower_film_list OK
sakila.sales_by_film_category OK
sakila.sales_by_store OK
sakila.staff_list OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
information_schema
kim
kim.abc OK
performance_schema
sakila
sakila.actor OK
sakila.address OK
sakila.category OK
sakila.city OK
sakila.country OK
sakila.customer OK
sakila.film OK
sakila.film_actor OK
sakila.film_category OK
sakila.film_text OK
sakila.inventory OK
sakila.language OK
sakila.payment OK
sakila.rental OK
sakila.staff OK
sakila.store OK
test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
■DB 재부팅
DB 재부팅 이후 Version 및 Database의 Data가 제대로 존재하는지 확인해보았습니다.
[root@localhost bin]# ./mysqladmin -uroot -proot shutdown
[1]+ Done ./mysqld_safe --user=mysql
[root@localhost bin]# ./mysqld_safe --user=mysql &
[1] 9557
■ Version 확인
MariaDB [(none)]> select @@version;
+-----------------+
| @@version |
+-----------------+
| 10.2.12-MariaDB |
+-----------------+
1 row in set (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| kim |
| mysql |
| performance_schema |
| sakila |
| test |
+--------------------+
6 rows in set (0.00 sec)
버전이 잘 바뀐것을 확인 할 수 있습니다~ 이상으로 Mariadb upgrade 포스팅을 마치겠습니다.
'DataBase > MySQL & MariaDB' 카테고리의 다른 글
[MariaDB - Galera Cluster & Maxscale 구성 및 failover test] part 2 (0) | 2022.02.24 |
---|---|
[MariaDB - Galera Cluster 구성] part 1 (0) | 2022.02.24 |
[MySQL - MHA 구성 + failover/switchover] part 2 (0) | 2022.01.28 |
[MySQL - MHA 구성 + VIP생성] part 1 (2) | 2022.01.28 |
[MySQL 5.7 binary install] (0) | 2022.01.14 |