mysql5.7.24升级到5.7.30 rpm部署模式 redhat7

一年一度的mysql安全月升级又开始了

CDH 元数据库升级 元数据库切换

之前使用cdh的元数据库使用的是切换节点部署模式,今年又要升级,计划在线直接升级:

1、环境描述:

系统环境:CentOS Linux release 7.4.1708 (Core)
mysql环境:2.7.25
[root@dip001 dip]# rpm -qa |grep -i mysql
mysql-community-client-5.7.25-1.el7.x86_64
mysql-community-libs-compat-5.7.25-1.el7.x86_64
mysql-community-libs-5.7.25-1.el7.x86_64
MySQL-python-1.2.5-1.el7.x86_64
mysql-community-common-5.7.25-1.el7.x86_64
mysql-community-server-5.7.25-1.el7.x86_64

2、升级描述:

除去MySQL-python不用动外,其他的5个mysql包需要进行升级,我们先到mysql官网下载到每个rpm包对应的最新版本:


[root@dip001 lzm]# cd mysqlupdate2020/
[root@dip001 mysqlupdate2020]# ll
-rw-rw-r-- 1 dip dip  26452496 6月   5 13:48 mysql-community-client-5.7.30-1.el7.x86_64.rpm
-rw-rw-r-- 1 dip dip    318688 6月   5 13:48 mysql-community-common-5.7.30-1.el7.x86_64.rpm
-rw-rw-r-- 1 dip dip   2459484 6月   5 13:48 mysql-community-libs-5.7.30-1.el7.x86_64.rpm
-rw-rw-r-- 1 dip dip   1263752 6月   5 13:48 mysql-community-libs-compat-5.7.30-1.el7.x86_64.rpm
-rw-rw-r-- 1 dip dip 181564660 6月   5 13:49 mysql-community-server-5.7.30-1.el7.x86_64.rpm
[root@dip001 mysqlupdate2020]#

3、数据库备份防止升级失败:

mysqldump -uroot -p --all-databases > mysqlbak.sql

4、设置参数,使数据库关闭时会清空缓存,避免版本间缓存格式差异

mysql -u root -p --execute="SET GLOBAL innodb_fast_shutdown=0"

5、关闭数据库

systemctl stop mysqld

6、升级

[root@dip001 mysqlupdate2020]# rpm -Uvh  *.rpm                        ################################# [100%]
正在升级/安装...
   1:mysql-community-common-5.7.30-1.e################################# [ 10%]
   2:mysql-community-libs-5.7.30-1.el7################################# [ 20%]
   3:mysql-community-client-5.7.30-1.e################################# [ 30%]
   4:mysql-community-server-5.7.30-1.e################################# [ 40%]
   5:mysql-community-libs-compat-5.7.3################################# [ 50%]
正在清理/删除...
   6:mysql-community-server-5.7.25-1.e################################# [ 60%]
   7:mysql-community-client-5.7.25-1.e################################# [ 70%]
   8:mysql-community-libs-compat-5.7.2################################# [ 80%]
   9:mysql-community-libs-5.7.25-1.el7################################# [ 90%]
  10:mysql-community-common-5.7.25-1.e################################# [100%]

7、启动mysql

systemctl start mysqld

8、检查并可能解决旧数据和升级软件之间的任何不兼容性

[root@dip mysqlupdate2020]# mysql_upgrade -uroot -p

Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     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
Found outdated sys schema version 1.5.1.
Upgrading the sys schema.
Checking databases.
hive.AUX_TABLE                                     OK
hive.BUCKETING_COLS                                OK
hive.CDS                                           OK
hive.COLUMNS_V2                                    OK
hive.COMPACTION_QUEUE                              OK
hive.COMPLETED_COMPACTIONS                         OK
hive.COMPLETED_TXN_COMPONENTS                      OK
hive.DATABASE_PARAMS                               OK
hive.DBS                                           OK
hive.DB_PRIVS                                      OK
hive.DELEGATION_TOKENS                             OK
hive.FUNCS                                         OK
hive.FUNC_RU                                       OK
hive.GLOBAL_PRIVS                                  OK
hive.HIVE_LOCKS                                    OK
hive.IDXS                                          OK
hive.INDEX_PARAMS                                  OK
hive.MASTER_KEYS                                   OK
hive.NEXT_COMPACTION_QUEUE_ID                      OK
hive.NEXT_LOCK_ID                                  OK
hive.NEXT_TXN_ID                                   OK
hive.NOTIFICATION_LOG                              OK
hive.NOTIFICATION_SEQUENCE                         OK
hive.NUCLEUS_TABLES                                OK
hive.PARTITIONS                                    OK
hive.PARTITION_EVENTS                              OK
hive.PARTITION_KEYS                                OK
hive.PARTITION_KEY_VALS                            OK
hive.PARTITION_PARAMS                              OK
hive.PART_COL_PRIVS                                OK
hive.PART_COL_STATS                                OK
hive.PART_PRIVS                                    OK
hive.ROLES                                         OK
hive.ROLE_MAP                                      OK
hive.SDS                                           OK
hive.SD_PARAMS                                     OK
hive.SEQUENCE_TABLE                                OK
hive.SERDES                                        OK
hive.SERDE_PARAMS                                  OK
hive.SKEWED_COL_NAMES                              OK
hive.SKEWED_COL_VALUE_LOC_MAP                      OK
hive.SKEWED_STRING_LIST                            OK
hive.SKEWED_STRING_LIST_VALUES                     OK
hive.SKEWED_VALUES                                 OK
hive.SORT_COLS                                     OK
hive.TABLE_PARAMS                                  OK
hive.TAB_COL_STATS                                 OK
hive.TBLS                                          OK
hive.TBL_COL_PRIVS                                 OK
hive.TBL_PRIVS                                     OK
hive.TXNS                                          OK
hive.TXN_COMPONENTS                                OK
hive.TYPES                                         OK
hive.TYPE_FIELDS                                   OK
hive.VERSION                                       OK
metastore.AUX_TABLE                                OK
metastore.BUCKETING_COLS                           OK
metastore.CDS                                      OK
metastore.COLUMNS_V2                               OK
metastore.COMPACTION_QUEUE                         OK
metastore.COMPLETED_COMPACTIONS                    OK
metastore.COMPLETED_TXN_COMPONENTS                 OK
metastore.DATABASE_PARAMS                          OK
metastore.DBS                                      OK
metastore.DB_PRIVS                                 OK
metastore.DELEGATION_TOKENS                        OK
metastore.FUNCS                                    OK
metastore.FUNC_RU                                  OK
metastore.GLOBAL_PRIVS                             OK
metastore.HIVE_LOCKS                               OK
metastore.IDXS                                     OK
metastore.INDEX_PARAMS                             OK
metastore.KEY_CONSTRAINTS                          OK
metastore.MASTER_KEYS                              OK
metastore.NEXT_COMPACTION_QUEUE_ID                 OK
metastore.NEXT_LOCK_ID                             OK
metastore.NEXT_TXN_ID                              OK
metastore.NOTIFICATION_LOG                         OK
metastore.NOTIFICATION_SEQUENCE                    OK
metastore.NUCLEUS_TABLES                           OK
metastore.PARTITIONS                               OK
metastore.PARTITION_EVENTS                         OK
metastore.PARTITION_KEYS                           OK
metastore.PARTITION_KEY_VALS                       OK
metastore.PARTITION_PARAMS                         OK
metastore.PART_COL_PRIVS                           OK
metastore.PART_COL_STATS                           OK
metastore.PART_PRIVS                               OK
metastore.ROLES                                    OK
metastore.ROLE_MAP                                 OK
metastore.SDS                                      OK
metastore.SD_PARAMS                                OK
metastore.SEQUENCE_TABLE                           OK
metastore.SERDES                                   OK
metastore.SERDE_PARAMS                             OK
metastore.SKEWED_COL_NAMES                         OK
metastore.SKEWED_COL_VALUE_LOC_MAP                 OK
metastore.SKEWED_STRING_LIST                       OK
metastore.SKEWED_STRING_LIST_VALUES                OK
metastore.SKEWED_VALUES                            OK
metastore.SORT_COLS                                OK
metastore.TABLE_PARAMS                             OK
metastore.TAB_COL_STATS                            OK
metastore.TBLS                                     OK
metastore.TBL_COL_PRIVS                            OK
metastore.TBL_PRIVS                                OK
metastore.TXNS                                     OK
metastore.TXN_COMPONENTS                           OK
metastore.TYPES                                    OK
metastore.TYPE_FIELDS                              OK
metastore.VERSION                                  OK
metastore.WRITE_SET                                OK
sys.sys_config                                     OK
Upgrade process completed successfully.

8、验证

6.1rpm验证:
rpm -qa |grep -i mysql
6.1mysql命令:
mysql -V
6.3mysql系统后验证:
mysql> select version();

 

posted @ 2020-06-05 15:54  bioamin  阅读(1444)  评论(0编辑  收藏  举报