1

I want to connect to Google Cloud Bigtable which running on Docker:

docker run --rm -it -p 8086:8086 -v ~/.config/:/root/.config \
bigtruedata/gcloud-bigtable-emulator

It starts without any problems:

[bigtable] Cloud Bigtable emulator running on 127.0.0.1:8086

~/.config it is my default credentials that I configured in this way:

gcloud auth application-default login

I used Java-code from official sample HelloWorld. Also, I changed connection configuration like this:

Configuration conf = BigtableConfiguration.configure("projectId", "instanceId");

conf.set(BigtableOptionsFactory.BIGTABLE_HOST_KEY, "127.0.0.1");
conf.set(BigtableOptionsFactory.BIGTABLE_PORT_KEY, "8086");
conf.set(BigtableOptionsFactory.BIGTABLE_USE_PLAINTEXT_NEGOTIATION, "true");

try (Connection connection = BigtableConfiguration.connect(conf)) {
    ...

And I set BIGTABLE_EMULATOR_HOST=127.0.0.1:8086 environment variable in a configuration for my app in IntelliJ Idea.

But when I run my Java app, it gets stuck on admin.createTable(descriptor); and shows this log:

... 16:42:44.697 [grpc-default-executor-0] DEBUG com.google.bigtable.repackaged.io.grpc.netty.shaded.io.netty.util.Recycler - -Dio.netty.recycler.ratio: 8

After some time it shows log about BigtableClientMetrics and then throws an exception:

java.net.NoRouteToHostException: No route to host

I get the same problem when trying to run Google Cloud Bigtable with my own Dockerfile.


When I run Google Cloud Bigtable with this command:

gcloud beta emulators bigtable start

my app completed successfully.

So, how to solve this problem?

UPDATE:

Now I have this exception:

io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason

and before this another exception is thrown:

java.io.IOException: Connection reset by peer

Daria Pydorenko
  • 1,754
  • 2
  • 18
  • 45
  • 1
    Have a look at [this question](https://stackoverflow.com/questions/8658118/when-is-java-io-ioexceptionconnection-reset-by-peer-thrown), they explain with many cases when the `Connection reset by peer` error appears. – arudzinska Jun 25 '18 at 10:35
  • 1
    Hi Daria, do you know if you opened the network in the docker container to access that port? Sometimes containers will not allow all connections by default, both in the docker level and the image level (i.e.: iptables). – Justin Sep 20 '19 at 18:50

0 Answers0