skip to Main Content

I have set up three containers that are networked because I would like to use Hadoop and Hive with PostgreSQL. You can access Docker set up via https://github.com/jcool12/hadoop-docker/tree/main/hivepost so you can download the folders/ files to run it. The Hadoop container works, the PostgreSQL container works, but the Hive container, upon startup, presents this error:

Waiting for PostgreSQL to start...
/entrypoint.sh: line 4: pg_isready: command not found

The PostgreSQL container is running and looks fine, yet I’m still encountering this error:

/entrypoint.sh: line 4: pg_isready: command not found.

I have installed the PostgreSQL client in the /hive/Dockerfile and modified the entrypoint.sh, but nothing resolves the error. Could you please help me resolve this issue?

2

Answers


  1. Your existing setup actually seems to work for me. But perhaps you might consider moving the readiness check across to Docker Compose by updating your docker-compose.yml as follows:

    version: '3.8'
    
    services:    
      postgres:
        image: postgres:13
        environment:
          - POSTGRES_DB=hive
          - POSTGRES_USER=hiveuser
          - POSTGRES_PASSWORD=hivepassword
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -d hive -U hiveuser"]
          interval: 5s
          timeout: 5s
          retries: 5
    
      hive:
        build: ./hive
        depends_on:
          postgres:
            condition: service_healthy
    

    I have retained only the important bits for clarity.

    1. Add healthcheck to the postgres service, which uses pg_isready and will only mark the container as healthy when it is ready to accept connections.
    2. Add a condition to the depends_on for the hive service, so that it will only start once postgres has been marked as healthy.

    You can then remove the pg_isready command from the entrypoint.sh file.

    Login or Signup to reply.
  2. You can explore the official Hive docker images, they have ways to run Hive with Hadooop with Postgres out of the box

    https://hive.apache.org/development/quickstart/ search for POSTGRES_LOCAL_PATH here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search