我正在尝试使用 gcloud beta 模拟器中的 bigtable 模拟器。我启动模拟器,获取主机名(localhost)和端口(在本例中为 8885)
gcloud beta 模拟器 bigtable 开始
执行:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/bigtable-emulator/cbtemulator --host=localhost --port=8885
我正在尝试从 java 测试客户端连接到模拟器,这是我提供的:
Configuration conf = BigtableConfiguration.configure(projectId, instanceId);
if(!Strings.isNullOrEmpty(host)){
conf.set(BigtableOptionsFactory.BIGTABLE_HOST_KEY, host);
conf.set(BigtableOptionsFactory.BIGTABLE_PORT_KEY, Integer.toString(port));
}
connection = BigtableConfiguration.connect(configuration);
try (Table table = connection.getTable("tName")){
table.put(<Put instance>);
}
当我执行测试代码时,我得到:
16:36:37.369 [bigtable-batch-pool-1] INFO com.google.cloud.bigtable.grpc.async.AbstractRetryingRpcListener - Retrying failed call. Failure #1, got: Status{code=UNAVAILABLE, description=null, cause=java.net.ConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:8885}
java.net.ConnectException: Connection refused: localhost/0:0:0:0:0:0:0:1:8885
我正在使用图书馆:com.google.cloud.bigtable:bigtable-hbase-1.2:0.9.1
知道我做错了什么吗?
谢谢 !