# cd $HIVE_HOME/scripts/metastore/upgrade/mysql
[Dev root @ sd-9c1f-2eac /usr/local/src/apache-hive-2.1.1-bin/scripts/metastore/upgrade/mysql]
# ls
001-HIVE-972.mysql.sql 027-HIVE-12819.mysql.sql hive-schema-2.0.0.mysql.sql
002-HIVE-1068.mysql.sql 028-HIVE-12821.mysql.sql hive-schema-2.1.0.mysql.sql
003-HIVE-675.mysql.sql 029-HIVE-12822.mysql.sql hive-txn-schema-0.13.0.mysql.sql
004-HIVE-1364.mysql.sql 030-HIVE-12823.mysql.sql hive-txn-schema-0.14.0.mysql.sql
005-HIVE-417.mysql.sql 031-HIVE-12831.mysql.sql hive-txn-schema-1.3.0.mysql.sql
006-HIVE-1823.mysql.sql 032-HIVE-12832.mysql.sql hive-txn-schema-2.0.0.mysql.sql
007-HIVE-78.mysql.sql 034-HIVE-13076.mysql.sql hive-txn-schema-2.1.0.mysql.sql
008-HIVE-2246.mysql.sql 035-HIVE-13395.mysql.sql README
009-HIVE-2215.mysql.sql 036-HIVE-13354.mysql.sql upgrade-0.10.0-to-0.11.0.mysql.sql
010-HIVE-3072.mysql.sql hive-schema-0.10.0.mysql.sql upgrade-0.11.0-to-0.12.0.mysql.sql
011-HIVE-3649.mysql.sql hive-schema-0.11.0.mysql.sql upgrade-0.12.0-to-0.13.0.mysql.sql
012-HIVE-1362.mysql.sql hive-schema-0.12.0.mysql.sql upgrade-0.13.0-to-0.14.0.mysql.sql
013-HIVE-3255.mysql.sql hive-schema-0.13.0.mysql.sql upgrade-0.14.0-to-1.1.0.mysql.sql
014-HIVE-3764.mysql.sql hive-schema-0.14.0.mysql.sql upgrade-0.5.0-to-0.6.0.mysql.sql
016-HIVE-6386.mysql.sql hive-schema-0.3.0.mysql.sql upgrade-0.6.0-to-0.7.0.mysql.sql
017-HIVE-6458.mysql.sql hive-schema-0.4.0.mysql.sql upgrade-0.7.0-to-0.8.0.mysql.sql
018-HIVE-6757.mysql.sql hive-schema-0.4.1.mysql.sql upgrade-0.8.0-to-0.9.0.mysql.sql
019-HIVE-7784.mysql.sql hive-schema-0.5.0.mysql.sql upgrade-0.9.0-to-0.10.0.mysql.sql
020-HIVE-9296.mysql.sql hive-schema-0.6.0.mysql.sql upgrade-1.1.0-to-1.2.0.mysql.sql
021-HIVE-7018.mysql.sql hive-schema-0.7.0.mysql.sql upgrade-1.2.0-to-1.3.0.mysql.sql
022-HIVE-11970.mysql.sql hive-schema-0.8.0.mysql.sql upgrade-1.2.0-to-2.0.0.mysql.sql
023-HIVE-12807.mysql.sql hive-schema-0.9.0.mysql.sql upgrade-2.0.0-to-2.1.0.mysql.sql
024-HIVE-12814.mysql.sql hive-schema-1.1.0.mysql.sql upgrade.order.mysql
025-HIVE-12816.mysql.sql hive-schema-1.2.0.mysql.sql
026-HIVE-12818.mysql.sql hive-schema-1.3.0.mysql.sql

cat README
Hive MetaStore Upgrade HowTo
============================

This document describes how to upgrade the schema of a MySQL backed
Hive MetaStore instance from one release version of Hive to another
release version of Hive. For example, by following the steps listed
below it is possible to upgrade a Hive 0.5.0 MetaStore schema to a
Hive 0.7.0 MetaStore schema. Before attempting this project we
strongly recommend that you read through all of the steps in this
document and familiarize yourself with the required tools.

MetaStore Upgrade Steps
=======================

1) Shutdown your MetaStore instance and restrict access to the
MetaStore's MySQL database. It is very important that no one else
accesses or modifies the contents of database while you are
performing the schema upgrade.

2) Create a backup of your MySQL metastore database. This will allow
you to revert any changes made during the upgrade process if
something goes wrong. The mysqldump utility is the easiest way to
create a backup of a MySQL database:

% mysqldump --opt <metastore_db_name> > metastore_backup.sql

Note that you may need also need to specify a hostname and username
using the --host and --user command line switches.

3) Dump your metastore database schema to a file. We use the mysqldump
utility again, but this time with a command line option that
specifies we are only interested in dumping the DDL statements
required to create the schema:

% mysqldump --skip-add-drop-table --no-data <metastore_db_name> > my-schema-x.y.z.mysql.sql

4) The schema upgrade scripts assume that the schema you are upgrading
closely matches the official schema for your particular version of
Hive. The files in this directory with names like
"hive-schema-x.y.z.mysql.sql" contain dumps of the official schemas
corresponding to each of the released versions of Hive. You can
determine differences between your schema and the official schema
by diffing the contents of the official dump with the schema dump
you created in the previous step. Some differences are acceptable
and will not interfere with the upgrade process, but others need to
be resolved manually or the upgrade scripts will fail to complete.

* Missing Tables: Hive's default configuration causes the MetaStore
to create schema elements only when they are needed. Some tables
may be missing from your MetaStore schema if you have not created
the corresponding Hive catalog objects, e.g. the PARTITIONS table
will probably not exist if you have not created any table
partitions in your MetaStore. You MUST create these missing tables
before running the upgrade scripts. The easiest way to do this is
by executing the official schema DDL script against your
schema. Each of the CREATE TABLE statements in the schema script
include an IF NOT EXISTS clause, so tables which already exist in
your schema will be ignored, and those which don't exist will get
created.

* Extra Tables: Your schema may include a table named NUCLEUS_TABLES
or a table named SEQUENCE_TABLE. These tables are managed
by the DataNucleus ORM layer and will be created automatically if
they don't exist. No action on your part is required.

* Reversed Column Constraint Names in the Same Table: Tables with
multiple constraints may have the names of the constraints
reversed. For example, the PARTITIONS table contains two foreign
key constraints named PARTITIONS_FK1 and PARTITIONS_FK2 which
reference SDS.SD_ID and TBLS.TBL_ID respectively. However, in your
schema you may find that PARTITIONS_FK1 references TBLS.TBL_ID and
PARTITIONS_FK2 references SDS.SD_ID. Either version is acceptable
-- the only requirement is that these constraints actually exist.

* Differences in Column/Constraint Names: Your schema may contain
tables with columns named "IDX" or unique keys named
"UNIQUE<tab_name>". If you find either of these in your schema you
will need to change the names to "INTEGER_IDX" and
"UNIQUE_<tab_name>" before running the upgrade scripts. For more
background on this issue please refer to HIVE-1435.

5) You are now ready to run the schema upgrade scripts. If you are
upgrading from Hive 0.5.0 to Hive 0.6.0 you need to run the
upgrade-0.5.0-to-0.6.0.mysql.sql script, but if you are upgrading
from 0.5.0 to 0.7.0 you will need to run the 0.5.0 to 0.6.0 upgrade
script followed by the 0.6.0 to 0.7.0 upgrade script.

% mysql --verbose
mysql> use <metastore_db_name>;
Database changed
mysql> source upgrade-0.5.0-to-0.6.0.mysql.sql
mysql> source upgrade-0.6.0-to-0.7.0.mysql.sql

These scripts should run to completion without any errors. If you
do encounter errors you need to analyze the cause and attempt to
trace it back to one of the preceding steps.

6) The final step of the upgrade process is validating your freshly
upgraded schema against the official schema for your particular
version of Hive. This is accomplished by repeating steps (3) and
(4), but this time comparing against the official version of the
upgraded schema, e.g. if you upgraded the schema to Hive 0.7.0 then
you will want to compare your schema dump against the contents of
hive-schema-0.7.0.mysql.sql

Hive MetaStore Upgrade的更多相关文章

  1. Hive安装配置指北(含Hive Metastore详解)

    个人主页: http://www.linbingdong.com 本文介绍Hive安装配置的整个过程,包括MySQL.Hive及Metastore的安装配置,并分析了Metastore三种配置方式的区 ...

  2. Hadoop之Hive(2)--配置Hive Metastore

    Hive metastore服务以关系性数据库的方式存储Hive tables和partitions的metadata,并且提供给客户端访问这些数据的metastore service的API.下面介 ...

  3. 【原创】大叔经验分享(24)hive metastore的几种部署方式

    hive及其他组件(比如spark.impala等)都会依赖hive metastore,依赖的配置文件位于hive-site.xml hive metastore重要配置 hive.metastor ...

  4. HIVE metastore Duplicate key name 'PCS_STATS_IDX' (state=42000,code=1061)

    HDP 版本:2.4.0.0-169. 解决:将hive 所在 节点上的/usr/hdp/2.4.0.0-169/hive/script/metastore/upgrade/msql/hive-sch ...

  5. Hive metastore三种配置方式

    http://blog.csdn.net/reesun/article/details/8556078 Hive的meta数据支持以下三种存储方式,其中两种属于本地存储,一种为远端存储.远端存储比较适 ...

  6. Hive Metastore 代码简析

    1.  hive metastore 内部结构 1.1 包结构 从package结构来看,主要的5个package,让我们来看看这几个package的内容 (1) metastorepackage是m ...

  7. hive metastore异常 org.apache.thrift.protocol.TProtocolException: Missing version in readMessageBegin, old client

    hiveserver2的端口是10000hive.metastoe.uris 的端口9083改为10000之后 beelien 连接hiveserver2报错 Error: Could not ope ...

  8. Hive Metastore ObjectStore PersistenceManager自动关闭bug解析

    最近在测试HCatalog,由于Hcatalog本身就是一个独立JAR包,虽然它也可以运行service,但是其实这个service就是metastore thrift server,我们在写基于Hc ...

  9. hive metastore Server 出现异常

    报错信息: 常见问题分析: 1 hive metastore 数据库中用户名或者密码出现更改,并且重启了hive,导致生效但是CDH下没有及时更改hive metastore设置密码 2 Mysql ...

随机推荐

  1. [CERC 2008] Suffix reconstruction

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4319 [算法] 首先 , 我们可以求出这个字符串的rank数组 按照SA逐位枚举 , ...

  2. params 和 query 传参的区别

    很多人都知道params 和  query  都可以在页面跳转的时候传递参数. query更加类似于我们ajax中get传参,params则类似于post,说的再简单一点,前者在浏览器地址栏中显示参数 ...

  3. Poj1258_Agri-Net(最小生成树)

    一.Description(poj1258) Farmer John has been elected mayor of his town! One of his campaign promises ...

  4. 【转】 Pro Android学习笔记(四八):ActionBar(1):Home图标区

    目录(?)[-] Home Icon 源代码 TextView的滚动 返回主activity或指定activity     ActionBar在Android 3.0 SDK中为平板引入,在4.0中也 ...

  5. 1 ELK 简介

    日志主要包括系统日志.应用程序日志和安全日志,系统运维和开发人员可以通过日志了解服务器软硬件信息.检查配置过程中的错误及错误发生的原因.经常分析日志可以了解服务器的负荷,性能安全性,从而及时采取措施纠 ...

  6. tomcat安装与运行

    实验环境:CentOS7 使用系统yum仓库安装: #安装基本包和开发工具包 [root@~ localhost]#yum install -y java-1.8.0-openjdk java-1.8 ...

  7. 测试RDP回放

    Dim fso,num,flagflag=trueset bag=getobject("winmgmts:\\.\root\cimv2") Set fso=CreateObject ...

  8. Learning Python 010 函数 2

    Python 函数 2 函数的参数 位置参数(普通,正常的参数) 随便编写一个求x^n的值的函数power(x, n): def power(x, n): s = 1 while n > 0: ...

  9. Frequent Pattern 挖掘之二(FP Growth算法)

    Frequent Pattern 挖掘之二(FP Growth算法) FP树构造 FP Growth算法利用了巧妙的数据结构,大大降低了Aproir挖掘算法的代价,他不需要不断得生成候选项目队列和不断 ...

  10. 电脑MAC地址

    电脑MAC地址(Media Access Control) MAC地址是固化在网卡上串行EEPROM中的物理地址,通常有48位长.用来表示互联网上每一个站点的标识符,采用十六进制数表示. 任一网络设备 ...