hive入门环境启动测试实战

版权声明:所有文章禁止转载但是均可在生产中使用提高效率 https://blog.csdn.net/viviliving/article/details/82893974

首先启动hadoop(存放hive表数据),spark可以不用启动

 /usr/local/hadoop/sbin/start-all.sh
 /usr/local/spark/sbin/start-all.sh

启动mysql(metastore存hive元数据)

 检查hive配置more hive-site.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
    <description>Driver class name for a JDBC metastore</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hive</value>
    <description>username to use against metastore database</description>
  </property>
  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>hive</value>
    <description>password to use against metastore database</description>
  </property>
</configuration>

启动hive

hive --service metastore

hive --service hiveserver2

测试

hive

show databases

create table test(a string, b int);

扫描二维码关注公众号,回复: 3963618 查看本文章

show tables;

desc test;

查询mysql元数据信息

mysql -uroot -phadoop hive

select TBL_ID, CREATE_TIME, DB_ID, OWNER, TBL_NAME,TBL_TYPE from TBLS;

查询hadoop中test表存储

http://10.0.3.101:50070/explorer.html#/user/hive/warehouse

hadoop fs -ls /user/hive/warehouse

hadoop fs -ls /user/hive/warehouse/test

hadoop fs -cat /user/hive/warehouse/test/000000_0

猜你喜欢

转载自blog.csdn.net/viviliving/article/details/82893974