续上一篇:
[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>--测试创建表,查看表信息,以上显示为测试成功显示效果
新闻热点
疑难解答