启动 Hive Metastore 时无法创建 ServerSocket

Could not create ServerSocket when starting Hive metastore

在 HDInsight 集群(Microsoft Azure 的 Hadoop 发行版)上启动 Hive Metastore 时,出现此错误:

org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083.
        at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:93)
        at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:75)
        at org.apache.hadoop.hive.metastore.TServerSocketKeepAlive.<init>(TServerSocketKeepAlive.java:34)
        at org.apache.hadoop.hive.metastore.HiveMetaStore.startMetaStore(HiveMetaStore.java:5183)
        at org.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:5126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)
Exception in thread "main" org.apache.thrift.transport.TTransportException: Could not create ServerSocket on address 0.0.0.0/0.0.0.0:9083.
        at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:93)
        at org.apache.thrift.transport.TServerSocket.<init>(TServerSocket.java:75)
        at org.apache.hadoop.hive.metastore.TServerSocketKeepAlive.<init>(TServerSocketKeepAlive.java:34)
        at org.apache.hadoop.hive.metastore.HiveMetaStore.startMetaStore(HiveMetaStore.java:5183)
        at org.apache.hadoop.hive.metastore.HiveMetaStore.main(HiveMetaStore.java:5126)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

这是命令我运行:

hive --service metastore

你接下来会尝试做什么?

您是否使用 netstat 检查端口 9083?您可能已经有其他服务使用此端口号。

而不是 hive --service metastore 我 运行 stop_daemons 然后 start_daemons 似乎每次都有效。

试试

ps -ef | grep hive 

应该只是配置单元服务的一个进程,在我的例子中有 2 个进程 运行, 使用 pid ( kill -9 pid ) 终止进程 启动配置单元服务。