报错信息:
org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
Caused by: MetaException(message:Could not connect to meta store using any of the URIs provided. Most recent failure: org.apache.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect

解决方法:
执行
hive --service metastore &
提示没有hive时是没添加hive环境变量,进入hive/bin目录下再执行

问题原因:

通过hive metastore能访问hive的元数据,hive的元数据使用Data Nucleus持久化,而配置metastore服务端以及metastore数据库主要有内嵌、远程两种方式,内嵌方式中hive使用derby作为内嵌的metastore数据库,主要用于测试,但是在同一时间,它只允许一个进程连接metastore数据库。
而远程metastore服务端和客户端之间使用Thrift协议通信。需要执行hive --service metastore 启动Thrift服务端才可以进行远程连接,Thrift服务端未启动时会报以上的错误

Q.E.D.