How to connect to a running bigtable emulator from java -
i trying use bigtable emulator gcloud beta emulators. launch emulator, grab hostname (localhost) , port (in instance 8885)
gcloud beta emulators bigtable start
executing: /usr/local/caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/bigtable-emulator/cbtemulator --host=localhost --port=8885
i trying connect emulator java test client, here provide:
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>); }
when execute test code get:
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
i using library: com.google.cloud.bigtable:bigtable-hbase-1.2:0.9.1
any idea of doing wrong ?
thanks !
you need 1 additional config property set:
conf.set(bigtableoptionsfactory.bigtable_use_plaintext_negotiation, true);
also, log message looks it's trying connect ipv6 address, don't think work. double-check host
valid ipv4 address.
the java client make easier in near future.
Comments
Post a Comment