1.先启动hive
在hive目录下:
bin/hive
可以看到jar下有一个log4j的文件,还没启动起来
在conf文件里
可以看到log4j.properties文件还没启动,去启动
回到hive文件夹
mkdir log
cd conf/
mv hive-log4j.properties.template hive-log4j.properties
vi hive-log4j.properties
设置hive.log.dir=/opt/moduels/apache-hive-1.2.2-bin/log
然后保存退出
重新登录进去
bin/hive
在刚建的log文件夹里面就有日志信息了
show databases;
create database if not exists db01;
showdatabases;
user db01; //这里db01前面不显示数据库,需要如下的配置一下才会显示,知道进的哪个数据库
去配置一下:
进去conf
vi hive-site.xml
加入:
<property>
<name>hive.cli.print.current.db</name>//显示当前的数据库名 true
<value>true</value>
</property>
<property>
<name>hive.cli.print.header</name>//显示当前表的列明
<value>true</value>
</property>
然后退出hive 在进去一下
bin/hive
show databases;
user db01;
注:如果登录的时候报错,就在配置下hive-site.xml文件
先创建个文件夹
然后加入:
<property>
<name>system:java.io.tmpdir</name>
<value>/opt/moduels/apache-hive-1.2.2-bin/tmpdir</value>
</property>
<property>
<name>system:user.name</name>
<value>hive</value>
</property>
网友评论