hbase-site.xml配置:
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.root.dir</name>
<value>hdfs://localhost:9011/hbase</value>
</property>
<property>
<name>hbase.tmp.dir</name>
<value>./tmp</value>
</property>
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost:2181</value>
</property>
<property>
<name>hbase.master.hostname</name>
<value>localhost</value>
</property>
<property>
<name>hbase.regionserver.hostname</name>
<value>localhost</value>
</property>
<property>
<name>hbase.master.ipc.address</name>
<value>0.0.0.0</value>
</property>
<property>
<name>hbase.regionserver.ipc.address</name>
<value>0.0.0.0</value>
</property>
我用ngrok开放了2181和16000端口:
Forwarding https://33e8-60-176-33-90.ngrok-free.app -> http://localhost:2181
Forwarding https://9c1b-60-176-33-90.ngrok-free.app -> http://localhost:5100
Forwarding https://b7a9-60-176-33-90.ngrok-free.app -> http://localhost:16000
外部java是这样连接的:
Configuration configuration = HBaseConfiguration.create();
configuration.set("hbase.zookeeper.quorum", "ce88-60-176-33-90.ngrok-free.app");
configuration.set("hbase.zookeeper.property.clientPort", "80");
但是运行以后报错了:
求解谢谢🙏
直接用本地端口映射吧 ssh -L