Hive学习(使用mysql存储元数据)

Hive2.3版本的安装

参考文章:

http://m.blog.csdn.net/lym152898/article/details/77334997

注意事项:

下载的mysql-connector-java-5.1.43.tar.gz,需要解压后再移动到$HIVE_HOME/lib中去。

报错解决:
hive> show tables;
FAILED: Hive Internal Error: java.net.UnknownHostException(hive: hive: Name or service not known)
java.net.UnknownHostException: hive: hive: Name or service not known
        at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
        at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1751)
        at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1525)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1236)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1226)
        at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:233)
        at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:184)
        at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
        at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.net.UnknownHostException: hive: Name or service not known
        at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
        at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
        ... 16 more

解决方法:

[root@hive apache-hive-2.3.0-bin]# hostname
hive
[root@hive apache-hive-2.3.0-bin]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
1.1.1.36 hive
[root@hive apache-hive-2.3.0-bin]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast state UP qlen 1000
    link/ether fa:16:3e:68:67:1d brd ff:ff:ff:ff:ff:ff
    inet 1.1.1.36/24 brd 1.1.1.255 scope global dynamic eth0
       valid_lft 64737sec preferred_lft 64737sec
    inet6 fe80::f816:3eff:fe68:671d/64 scope link 
       valid_lft forever preferred_lft forever
基础练习

http://blog.csdn.net/z971829916/article/details/49718557

    原文作者:tonyemail_st
    原文地址: https://www.jianshu.com/p/b06656a5cf87
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞