Giter Site home page Giter Site logo

Comments (6)

fredrikhgrelland avatar fredrikhgrelland commented on July 24, 2024 1

@zhenik does #33 close this?

from data-mesh.

fredrikhgrelland avatar fredrikhgrelland commented on July 24, 2024

@zhenik Suggestion: Let us add a "ready" endpoint to the container ( like metastore and hiveserver.) It could take env-inputs and only exit 0 if it is able to contact over thrift. This could be used as a prestart container for metastore etc.

from data-mesh.

zhenik avatar zhenik commented on July 24, 2024

There are two options how to run queries using beeline:

  1. flag -f stands for file
  2. flag -e stands for query

Seems like flag -f just ignore connection failure, when -e does not.

Last experiment with flag -e

task "waitfor-hive-server-available" {
  // expand restart time, due hive-metastore and hive-server needs time to spin up
  restart {
    interval = "30m"
    attempts = 15
    delay    = "45s"
    mode     = "fail"
  }
  lifecycle {
    hook    = "prestart"
  }
  driver = "docker"
  config {
    image = "fredrikhgrelland/hive:3.1.0"
    // https://stackoverflow.com/a/60552766
    // flag `--force=false` (default false), explicit exit if query fail (exit code other than 0)
    command = "beeline --force=false -u \"jdbc:hive2://localhost:10000/default;auth=noSasl\" -n hive -p hive -e \"SHOW DATABASES\""
  }
  resources {
    cpu    = 200
    memory = 2048
  }
}

When NO connection with hive-server (exit:1)

Logs

.....
20/05/28 08:03:03 [main]: WARN jdbc.HiveConnection: Failed to connect to localhost:10000
Error: Could not open client transport with JDBC Uri: jdbc:hive2://localhost:10000/default;auth=noSasl: Could not establish connection to jdbc:hive2://localhost:10000/default;auth=noSasl: null (state=08S01,code=0)
Cannot run commands specified using -e. No current connection

When connection with hive-server (exit:2)

...
Connecting to jdbc:hive2://localhost:10000/default;auth=noSasl
Connected to: Apache Hive (version 3.1.0)
Driver: Hive JDBC (version 3.1.0)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Error: Error while compiling statement: FAILED: ParseException line 1:4 cannot recognize input near 'SHOW' '<EOF>' '<EOF>' in ddl statement (state=42000,code=40000)
Error: Error while compiling statement: FAILED: ParseException line 1:0 cannot recognize input near 'DATABASES' '<EOF>' '<EOF>' (state=42000,code=40000)
Closing: 0: jdbc:hive2://localhost:10000/default;auth=noSasl
tail: can't open '/tmp/root/hive.log': No such file or directory
Connecting to jdbc:hive2://localhost:10000/default;auth=noSasl

from data-mesh.

zhenik avatar zhenik commented on July 24, 2024

Screenshots

1
2

from data-mesh.

zhenik avatar zhenik commented on July 24, 2024

From hive-server flag -e works fine

3

from data-mesh.

zhenik avatar zhenik commented on July 24, 2024

yes.

from data-mesh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.