HIVE如何修改默认端口
由于服务器网络安全策略限制,hive 的server2 默认的10000接口无法使用,需要修改为运维开放的接口
方案一:在配置文件中修改
找到hive的安装目录
然后在我的安装目录是在 /hadoop/install/apache-hive-3.1.2
然后找到conf目录下的hive-site.xml
文件
[hadoop@hadoop03 apache-hive-3.1.2]$ cd conf/
[hadoop@hadoop03 conf]$ vim hive-site.xml
<property>
<name>hive.server2.thrift.bind.host</name>
<value>node03</value>
</property>
<property>
<name>hive.server2.thrift.port</name>
<value>7101</value>
</property>
只需要修改hive.server2.thrift.port
参数为目标端口即可
方案二:在启动的时候指定端口
[hadoop@hadoop03 ~]$ hive --service hiveserver2 --hiveconf hive.server2.thrift.port 7101
这样就可以指定为想要的接口,如果想静默启动可以执行
[hadoop@hadoop03 ~]$ nohup hive --service hiveserver2 --hiveconf hive.server2.thrift.port 7101 &
我一般使用后面的方式启动
最后我们验证一下是否生效
[hadoop@hadoop03 ~]$ beeline --color=true
beeline> !connect jdbc:hive2://node03:7101
可以看到服务在7101端口上正常使用