Apache HBase REST API的默认IP是localhost,端口是8080。但是这可以通过修改HBase的配置文件进行更改。
以下是使用Java代码示例来获取Apache HBase REST API的IP和端口:
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.rest.client.Client;
import org.apache.hadoop.hbase.rest.client.Cluster;
public class HBaseRESTAPIInfo {
public static void main(String[] args) {
Configuration configuration = HBaseConfiguration.create();
// 设置HBase REST API的主机名和端口
configuration.set("hbase.rest.hostname", "localhost");
configuration.set("hbase.rest.port", "8080");
Client client = new Client(new Cluster(configuration));
System.out.println("HBase REST API的IP:" + client.getBaseURI().getHost());
System.out.println("HBase REST API的端口:" + client.getBaseURI().getPort());
}
}
请注意,需要将localhost
和8080
替换为您实际使用的IP和端口。