Pracheta Gaware
Pracheta Gaware

Reputation: 31

Presto-CLI java.net.SocketException: Connection refused in GCP

I have created dataproc cluster using beta version of gcloud with optional component presto.

gcloud beta dataproc clusters create presto-test --optional-components=PRESTO --image-version=1.3-deb9

When I try to execute below command to access hive catalog it could successfully open the presto-cli.

./presto \
    --server presto-cluster-m-0:8080 \
    --socks-proxy localhost:1080 \
    --catalog hive \
    --schema default 

But I am getting below error while querying through presto-cli.

presto:default> show tables;

Error running command: java.net.SocketException: Connection refused (Connection refused)

Any help in this will be appreciated

Upvotes: 3

Views: 2325

Answers (2)

samsal77
samsal77

Reputation: 759

Im my case I got this error because I was running Trino on different port and ip than 8080 and localhost. It turns out the Trino CLI has its own server configuration that can be set using the following bash command : trino --server=http://<trinp-ip>:<port-number>

Once I did that the CLI started working as expected.

Thanks

Upvotes: 0

Jerry Ding
Jerry Ding

Reputation: 381

A couple of minor fixes to your connection settings may be necessary.

  • Presto runs on port 8060 when running as an optional component
  • Your cluster creation command did not create your cluster in HA mode, so the hostname of the master is just -m, not -m-0

Assuming your cluster is named presto-test, then the command should look like

./presto \
--server presto-test-m:8060 \
--socks-proxy localhost:1080 \
--catalog hive \
--schema default 

If that doesn't work, you might want to double check that the socks proxy and Presto are running correctly.

  1. Run curl -I -x socks5h://localhost:1080 presto-test-m:8088 - it should return HTTP 302. If you get a connection refused error or host not found error, your socks proxy is not working correctly.

  2. Run gcloud beta dataproc clusters describe presto-test and check that the following lines appear in the output

    softwareConfig:
      optionalComponents:
      - PRESTO
    
  3. Ssh into the master node of your Presto cluster and run which presto and sudo systemctl status presto to verify that Presto is installed and running.

There is a known issue where Presto may fail to be installed when specified as an optional component (in which case steps 2 and 3 above would show that Presto is not activated on the cluster). This should be fixed in the next Dataproc release - if you're running into this issue now, try using this command to create the cluster instead:

gcloud beta dataproc clusters create presto-test --properties dataproc:dataproc.components.activate=presto --image-version=1.3-deb9

Upvotes: 2

Related Questions