續上一篇:
[root@localhost hive]# cd /usr/hive[root@localhost hive]# mkdir warehouse1.2、/tmp系統目錄下創建方法
[root@localhost tmp]# mkdir hive[root@localhost tmp]# mkdirhive/Operaion_logs[root@localhost tmp]# mkdirhive/resources2、 配置hive
2.1、生成配置文件
[root@localhost hive]# cd conf[root@localhost conf]# cphive-env.sh.template hive-env.sh[root@localhost conf]# cphive-default.xml.template hive-site.xml[root@localhost conf]# cphive-log4j2.PRoperties.template hive-log4j2.properties[root@localhost conf]# cphive-exec-log4j2.properties.template hive-exec-log4j2.properties2.2、修改配置文件
2.2.1、修改文件(hive-env.sh)
[root@localhostconf]# vim hive-env.sh--添加# sethadoop/hive/jdk(java) pathexportHADOOP_HOME=/usr/hadoopexportHIVE_HOME=/usr/hiveexport JAVA_HOME=/usr/java/jdk1.8.0_111exportHIVE_CONF_DIR=/usr/hive/conf
2.2.2、修改文件(hive-site.xml)
--編輯文件
[root@localhostconf]# gedit hive-site.xml查找關健字
${system:java.io.tmpdir}/${hive.session.id}_resources替換為本機路徑/tmp/hive/resources
${system:java.io.tmpdir}/${system:user.name}/operation_logs替換為本機路徑/tmp/hive/operation_logs
${system:java.io.tmpdir}/${system:user.name}替換為本機路徑 /tmp/hive
3、 啟動hive(hadoop服務需要主啟用才能做以下操作)
3.1調用hive
[root@localhost hive]# schematool-dbType derby -initSchema[root@localhost hive]# hivehive> 啟用成功顯示命令行顯示為 hive>3.2 測試連接
hive> createtable Test(id int,name string);OKTime taken: 2.999secondshive> describetest;OKid int name string Time taken: 0.821seconds, Fetched: 2 row(s)hive>--測試創建表,查看表信息,以上顯示為測試成功顯示效果
新聞熱點
疑難解答