CDH-5.14.2クラスタアップグレードHive-1.1.0からHive-1.2.1

24159 ワード

参照:CDH 5.1.5(parcels)クラスタのhive 1.1.0 hive-1.2.1にアップグレードする手順はすべて、hiveメタデータベースをアップグレードし、データが失われない(親測定で利用可能)
操作手順:
ダウンロードhive-1.2.1-bin
解凍:
[root@node01 ~]# cd /opt/software/
[root@node01 software]# ls
apache-hive-1.2.1-bin.tar.gz                cloudera-manager-centos7-cm5.14.2_x86_64.tar.gz  jdk-8u231-linux-x64.tar.gz  maxwell-1.22.1.tar.gz
apache-phoenix-4.14.0-cdh5.14.2-bin.tar.gz  flink-1.9.1-cdh-5.14.2.tar.gz                    kafka-manager-1.3.1.6.zip   mysql-connector-java.jar
[root@node01 software]# tar -zxf apache-hive-1.2.1-bin.tar.gz -C /opt/module/
[root@node01 software]# cd /opt/module/
[root@node01 module]# mv apache-hive-1.2.1-bin hive-1.2.1
[root@node01 module]# cd hive-1.2.1/

hive-1.2.1のlibをcdhのhiveのlib 121ディレクトリにコピー
[root@node01 hive]# cd /opt/cloudera/parcels/CDH/lib/hive
[root@node01 hive]# mkdir lib121
[root@node01 hive]# cp /opt/module/hive-1.2.1/lib/* lib121/

cdhのhive起動ファイルのhive-lib構成を変更する
[root@node01 bin]# pwd
/opt/cloudera/parcels/CDH/lib/hive/bin
[root@node01 bin]# vi hive
......
HIVE_LIB=${HIVE_HOME}/lib121
......

CouderaインタフェースはHiveサービスを停止し、Hue,Ozzieをインストールした場合、Impalaは先に停止してからHiveを停止します.
すべてのノードはhadoop上のjline jarパッケージを更新し、古いjlien jarパッケージを削除します.
[root@node01 lib121]# ln -s /opt/cloudera/parcels/CDH/lib/hive/lib121/jline-2.12.jar /opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/jline-2.12.jar
[root@node01 lib121]# cd /opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/
[root@node01 lib]# ls
activation-1.1.jar             commons-lang-2.6.jar          jackson-xc-1.8.8.jar   jersey-server-1.9.jar             log4j-1.2.17.jar
aopalliance-1.0.jar            commons-logging-1.1.3.jar     javax.inject-1.jar     jettison-1.1.jar                  protobuf-java-2.5.0.jar
asm-3.2.jar                    guava-11.0.2.jar              jaxb-api-2.2.2.jar     jetty-6.1.26.cloudera.4.jar       servlet-api-2.5.jar
commons-cli-1.2.jar            guice-3.0.jar                 jaxb-impl-2.2.3-1.jar  jetty-util-6.1.26.cloudera.4.jar  spark-1.6.0-cdh5.14.2-yarn-shuffle.jar
commons-codec-1.4.jar          guice-servlet-3.0.jar         jersey-client-1.9.jar  jline-2.11.jar                    spark-yarn-shuffle.jar
commons-collections-3.2.2.jar  jackson-core-asl-1.8.8.jar    jersey-core-1.9.jar    jline-2.12.jar                    stax-api-1.0-2.jar
commons-compress-1.4.1.jar     jackson-jaxrs-1.8.8.jar       jersey-guice-1.9.jar   jsr305-3.0.0.jar                  xz-1.0.jar
commons-io-2.4.jar             jackson-mapper-asl-1.8.8.jar  jersey-json-1.9.jar    leveldbjni-all-1.8.jar            zookeeper.jar
[root@node01 lib]# mv /opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/jline-2.11.jar /opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/jline-2.11.jar.bak

すべてのノードに配布し、所属するユーザー、ユーザー・グループを変更
chown -R cloudera-scm:cloudera-scm /opt/cloudera

メタデータストアのノードでMySQLのhiveメタデータベースをバックアップするには、次の手順に従います.
[root@node02 ~]# mysqldump -uroot -hnode02 -p metastore > metastore110.sql

アップグレードスクリプトの実行:
[root@node02 hive-1.2.1]# cd /opt/module/hive-1.2.1/scripts/metastore/upgrade/mysql/
[root@node02 mysql]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.28-log MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use metastore;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> source upgrade-0.13.0-to-0.14.0.mysql.sql;
+--------------------------------------------------+
|                                                  |
+--------------------------------------------------+
| Upgrading MetaStore schema from 0.13.0 to 0.14.0 |
+--------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.01 sec)

ERROR 1061 (42000): Duplicate key name 'PCS_STATS_IDX'
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

+-----------------------------------------------------------+
|                                                           |
+-----------------------------------------------------------+
| Finished upgrading MetaStore schema from 0.13.0 to 0.14.0 |
+-----------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> source upgrade-0.14.0-to-1.1.0.mysql.sql;
+-------------------------------------------------+
|                                                 |
+-------------------------------------------------+
| Upgrading MetaStore schema from 0.14.0 to 1.1.0 |
+-------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

+----------------------------------------------------------+
|                                                          |
+----------------------------------------------------------+
| Finished upgrading MetaStore schema from 0.14.0 to 1.1.0 |
+----------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

mysql> source upgrade-1.1.0-to-1.2.0.mysql.sql;
+------------------------------------------------+
|                                                |
+------------------------------------------------+
| Upgrading MetaStore schema from 1.1.0 to 1.2.0 |
+------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

+---------------------------------------------------------+
|                                                         |
+---------------------------------------------------------+
| Finished upgrading MetaStore schema from 1.1.0 to 1.2.0 |
+---------------------------------------------------------+
1 row in set, 1 warning (0.00 sec)

cloudera管理インタフェースでHiveサービスを開始
アップグレードされたバージョンを表示するには、次の手順に従います.
[root@node01 module]# hive --version
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Hive 1.2.1
Subversion git://localhost.localdomain/home/sush/dev/hive.git -r 243e7c1ac39cb7ac8b65c5bc6988f5cc3162f558
Compiled by sush on Fri Jun 19 02:03:48 PDT 2015
From source with checksum ab480aca41b24a9c3751b8c023338231

データがアップグレード前と一致しているかどうかを確認します.
[root@node01 module]# hive
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0

Logging initialized using configuration in jar:file:/opt/cloudera/parcels/CDH-5.14.2-1.cdh5.14.2.p0.3/lib/hive/lib121/hive-common-1.2.1.jar!/hive-log4j.properties
hive> show databases;
OK
default
test_myq
Time taken: 1.969 seconds, Fetched: 2 row(s)
hive> use test_myq;
OK
Time taken: 0.046 seconds
hive> show tables;
OK
mytable
test
Time taken: 0.093 seconds, Fetched: 2 row(s)
hive> select * from mytable;
OK
Time taken: 0.502 seconds
hive> select * from test;
OK
mort    6.66
zane    5.55
Time taken: 0.113 seconds, Fetched: 2 row(s)