1. 程式人生 > >CDH 5.3.9(parcels)叢集中hive0.13.0升級到hive-1.2.1步驟全,升級hive元資料庫,資料不丟失

CDH 5.3.9(parcels)叢集中hive0.13.0升級到hive-1.2.1步驟全,升級hive元資料庫,資料不丟失

2.將安裝包傳到叢集所有節點上

3.所有節點root使用者下 

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

5.所有節點將解壓出來hive/lib下所有檔案拷貝到lib121

6.Coudera 介面停止Hive服務,如果安裝了Hue,Ozzie,Impala先停掉再停掉Hive

6.所有節點修改HIVE_LIB變數 HIVE_LIB=${HIVE_HOME}/lib ==> HIVE_LIB=${HIVE_HOME}/lib121

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

7.所有節點更新hadoop上jline jar包,並刪除老的jlien jar包

cd /opt/cloudera/parcels/CDH/jars
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.元資料節點備份MySQL中hive元資料庫

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

9.元資料節點進入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.元資料節點升級Hive元資料庫

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 管理介面啟動Hive服務

12.任意節點

hive #進入前hive shell介面
show databases;  
use testupdate;
show tables;
select * from test1;  #檢視是否原來的資料還在
insert into test1 values("AAAA","BBBB","CCCC");
select * from test1;
#hive支援行級操作了!