cdh cluster hive upgrade, data is not lost

1. Download hive-1.2.1 installation package http://archive.apache.org/dist/hive/hive-1.2.1/apache-hive-1.2.1-bin.tar.gz

2. The installation package passed on all nodes in the cluster

3. All nodes under the root user

cd /opt/cloudera/parcels/CDH/lib/hive
mkdir lib121

4. All nodes extract the apache-hive-1.2.1-bin.tar.gz

5. All nodes will extract from the hive / lib copy all files to lib121

6.Coudera interface Hive stop service, if the Hue installed, Ozzie, Impala first stopped and then stopped Hive

6. All the nodes modifications HIVE_LIB variable HIVE_LIB = $ {HIVE_HOME} / lib ==> HIVE_LIB = $ {HIVE_HOME} / lib121

vim /opt/cloudera/parcels/CDH/lib/hive/bin/hive

7. jline jar package on all nodes update hadoop, and delete the old jlien jar package

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

rm -rf /opt/cloudera/parcels/CDH/lib/hadoop-yarn/lib/jline-0.94.jar

8. The metadata node in the hive element MySQL database backup

mysqldump -uroot -hhserver -padmin123 hive > hive013.sql

9. The metadata node enters mysql

create database hive013 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
grant all privileges on *.* to 'root'@'hserver' identified by 'admin123' with grant option;
flush privileges;
use hive013;
source hive013.sql;

10. The metadata node metadata database upgrade Hive

View upgrade script before the upgrade, assess the impact, especially in the production environment, changed meta data according to business needs if it is to take over someone else's, it is relatively hard to force, each meta database table structure should look again.

If you like to upgrade directly untouched

cd /home/dp/apache-hive-1.2.1-bin/scripts/metastore/upgrade/mysql
mysql -uroot -hhserver -padmin123
use hive;
source upgrade-0.13.0-to-0.14.0.mysql.sql;
source upgrade-0.14.0-to-1.1.0.mysql.sql;
source upgrade-1.1.0-to-1.2.0.mysql.sql;
exit

11.cloudera management interface to start the service Hive

12. any node

hive #进入前hive shell界面
show databases;  
use testupdate;
show tables;
select * from test1;  #查看是否原来的数据还在
insert into test1 values("AAAA","BBBB","CCCC");
select * from test1;

hive supports row-level operations of the!

Reference https://blog.csdn.net/xjping0794/article/details/77542096

Guess you like

Origin www.cnblogs.com/kcxg/p/11099848.html