Reputation: 13
I'm trying to set up airflow instance using docker-compose in an Ubuntu EC2 Instance. After airflow initialization the process is not moving forward. I'm struggling to fix it. I use the below docker compose file: https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml. When I try to run the same docker compose file in my windows desktop it is working fine. I am not able to figure out why it is not working on my EC2 instance.
Currently this the log output I see
$sudo docker-compose up
Creating network "airflow_default" with the default driver
Creating airflow_redis_1 ... done
Creating airflow_postgres_1 ... done
Creating airflow_flower_1 ... done
Creating airflow_airflow-worker_1 ... done
Creating airflow_airflow-init_1 ... done
Creating airflow_airflow-scheduler_1 ... done
Creating airflow_airflow-webserver_1 ... done
Attaching to airflow_postgres_1, airflow_redis_1, airflow_airflow-init_1, airflow_airflow-worker_1, airflow_flower_1, airflow_airflow-scheduler_1, airflow_airflow-webserver_1
postgres_1 |
postgres_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
postgres_1 |
postgres_1 | 2021-08-09 12:07:35.635 UTC [1] LOG: starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgres_1 | 2021-08-09 12:07:35.635 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
postgres_1 | 2021-08-09 12:07:35.635 UTC [1] LOG: listening on IPv6 address "::", port 5432
postgres_1 | 2021-08-09 12:07:35.641 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
postgres_1 | 2021-08-09 12:07:35.648 UTC [25] LOG: database system was shut down at 2021-08-09 12:07:24 UTC
postgres_1 | 2021-08-09 12:07:35.654 UTC [1] LOG: database system is ready to accept connections
redis_1 | 1:C 09 Aug 2021 12:07:35.620 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 09 Aug 2021 12:07:35.620 # Redis version=6.2.5, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 09 Aug 2021 12:07:35.620 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 09 Aug 2021 12:07:35.621 * Increased maximum number of open files to 10032 (it was originally set to 1024).
redis_1 | 1:M 09 Aug 2021 12:07:35.621 * monotonic clock: POSIX clock_gettime
redis_1 | 1:M 09 Aug 2021 12:07:35.621 * Running mode=standalone, port=6379.
redis_1 | 1:M 09 Aug 2021 12:07:35.621 # Server initialized
redis_1 | 1:M 09 Aug 2021 12:07:35.622 * Ready to accept connections
airflow-init_1 | BACKEND=postgresql+psycopg2
airflow-init_1 | DB_HOST=postgres
airflow-init_1 | DB_PORT=5432
airflow-init_1 |
airflow-worker_1 | BACKEND=postgresql+psycopg2
airflow-worker_1 | DB_HOST=postgres
airflow-worker_1 | DB_PORT=5432
airflow-worker_1 |
airflow-worker_1 | BACKEND=postgresql+psycopg2
airflow-worker_1 | DB_HOST=postgres
airflow-worker_1 | DB_PORT=5432
airflow-worker_1 |
airflow-scheduler_1 | BACKEND=postgresql+psycopg2
airflow-scheduler_1 | DB_HOST=postgres
airflow-scheduler_1 | DB_PORT=5432
airflow-scheduler_1 |
airflow-scheduler_1 | BACKEND=postgresql+psycopg2
airflow-scheduler_1 | DB_HOST=postgres
airflow-scheduler_1 | DB_PORT=5432
airflow-webserver_1 | BACKEND=postgresql+psycopg2
airflow-webserver_1 | DB_HOST=postgres
airflow-webserver_1 | DB_PORT=5432
airflow-scheduler_1 |
flower_1 | BACKEND=postgresql+psycopg2
flower_1 | DB_HOST=postgres
flower_1 | DB_PORT=5432
airflow-webserver_1 |
flower_1 |
flower_1 | BACKEND=postgresql+psycopg2
flower_1 | DB_HOST=postgres
flower_1 | DB_PORT=5432
flower_1 |
airflow-init_1 | DB: postgresql+psycopg2://airflow:***@postgres/airflow
airflow-init_1 | [2021-08-09 12:07:55,129] {db.py:692} INFO - Creating tables
airflow-init_1 | INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
airflow-init_1 | INFO [alembic.runtime.migration] Will assume transactional DDL.
airflow-scheduler_1 | ____________ _____________
airflow-scheduler_1 | ____ |__( )_________ __/__ /________ __
airflow-scheduler_1 | ____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / /
airflow-scheduler_1 | ___ ___ | / _ / _ __/ _ / / /_/ /_ |/ |/ /
airflow-scheduler_1 | _/_/ |_/_/ /_/ /_/ /_/ \____/____/|__/
airflow-scheduler_1 | [2021-08-09 12:08:00,630] {scheduler_job.py:1266} INFO - Starting the scheduler
airflow-scheduler_1 | [2021-08-09 12:08:00,630] {scheduler_job.py:1271} INFO - Processing each file at most -1 times
flower_1 | [2021-08-09 12:08:00,991] {command.py:137} INFO - Visit me at http://0.0.0.0:5555
flower_1 | [2021-08-09 12:08:01,111] {command.py:142} INFO - Broker: redis://redis:6379/0
flower_1 | [2021-08-09 12:08:01,125] {command.py:145} INFO - Registered tasks:
flower_1 | ['airflow.executors.celery_executor.execute_command',
flower_1 | 'celery.accumulate',
flower_1 | 'celery.backend_cleanup',
flower_1 | 'celery.chain',
flower_1 | 'celery.chord',
flower_1 | 'celery.chord_unlock',
flower_1 | 'celery.chunks',
flower_1 | 'celery.group',
flower_1 | 'celery.map',
flower_1 | 'celery.starmap']
flower_1 | [2021-08-09 12:08:01,218] {mixins.py:229} INFO - Connected to redis://redis:6379/0
airflow-scheduler_1 | [2021-08-09 12:08:02,350] {dag_processing.py:254} INFO - Launched DagFileProcessorManager with pid: 32
airflow-scheduler_1 | [2021-08-09 12:08:02,382] {scheduler_job.py:1835} INFO - Resetting orphaned tasks for active dag runs
airflow-scheduler_1 | [2021-08-09 12:08:02,411] {settings.py:51} INFO - Configured default timezone Timezone('UTC')
flower_1 | [2021-08-09 12:08:02,690] {inspector.py:42} WARNING - Inspect method reserved failed
flower_1 | [2021-08-09 12:08:02,691] {inspector.py:42} WARNING - Inspect method revoked failed
flower_1 | [2021-08-09 12:08:02,691] {inspector.py:42} WARNING - Inspect method active failed
flower_1 | [2021-08-09 12:08:02,692] {inspector.py:42} WARNING - Inspect method scheduled failed
flower_1 | [2021-08-09 12:08:02,692] {inspector.py:42} WARNING - Inspect method registered failed
flower_1 | [2021-08-09 12:08:02,693] {inspector.py:42} WARNING - Inspect method conf failed
flower_1 | [2021-08-09 12:08:02,697] {inspector.py:42} WARNING - Inspect method stats failed
flower_1 | [2021-08-09 12:08:02,698] {inspector.py:42} WARNING - Inspect method active_queues failed
airflow-worker_1 | * Serving Flask app "airflow.utils.serve_logs" (lazy loading)
airflow-worker_1 | * Environment: production
airflow-worker_1 | WARNING: This is a development server. Do not use it in a production deployment.
airflow-worker_1 | Use a production WSGI server instead.
airflow-worker_1 | * Debug mode: off
airflow-worker_1 | [2021-08-09 12:08:02,859] {_internal.py:113} INFO - * Running on http://0.0.0.0:8793/ (Press CTRL+C to quit)
airflow-worker_1 | /home/airflow/.local/lib/python3.6/site-packages/celery/platforms.py:801 RuntimeWarning: You're running the worker with superuser privileges: this is
airflow-worker_1 | absolutely not recommended!
airflow-worker_1 |
airflow-worker_1 | Please specify a different user using the --uid option.
airflow-worker_1 |
airflow-worker_1 | User information: uid=1000 euid=1000 gid=0 egid=0
airflow-worker_1 |
airflow-init_1 | Upgrades done
airflow-worker_1 | [2021-08-09 12:08:09,448: INFO/MainProcess] Connected to redis://redis:6379/0
airflow-worker_1 | [2021-08-09 12:08:09,459: INFO/MainProcess] mingle: searching for neighbors
airflow-webserver_1 | ____________ _____________
airflow-webserver_1 | ____ |__( )_________ __/__ /________ __
airflow-webserver_1 | ____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / /
airflow-webserver_1 | ___ ___ | / _ / _ __/ _ / / /_/ /_ |/ |/ /
airflow-webserver_1 | _/_/ |_/_/ /_/ /_/ /_/ \____/____/|__/
airflow-webserver_1 | [2021-08-09 12:08:09,518] {dagbag.py:496} INFO - Filling up the DagBag from /dev/null
airflow-worker_1 | [2021-08-09 12:08:10,482: INFO/MainProcess] mingle: all alone
airflow-worker_1 | [2021-08-09 12:08:10,508: INFO/MainProcess] celery@5fd1ec8b7299 ready.
airflow-worker_1 | [2021-08-09 12:08:11,145: INFO/MainProcess] Events of group {task} enabled by remote.
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [36] [INFO] Starting gunicorn 20.1.0
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [36] [INFO] Listening at: http://0.0.0.0:8080 (36)
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [36] [INFO] Using worker: sync
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [40] [INFO] Booting worker with pid: 40
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [41] [INFO] Booting worker with pid: 41
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [42] [INFO] Booting worker with pid: 42
airflow-webserver_1 | [2021-08-09 12:08:13 +0000] [43] [INFO] Booting worker with pid: 43
airflow-init_1 | airflow already exist in the db
airflow-init_1 | 2.1.2
airflow_airflow-init_1 exited with code 0
It hungs up and never exits.
I have tried increasing the RAM and CPU but that didn't solve the issue. I am fairly new to docker and airflow.
Upvotes: 0
Views: 4838
Reputation: 20097
This is all as expected. This is how docker-compose up
works. When you run docker-compose up airflow will continue running in foreground unless you specify --detach
flag https://docs.docker.com/compose/reference/up/
If you don't it will run in foreground and continue outputting logs from all the containers which you started with the right prefix.
What you see as exiting
is the "init" process (which is absolutely expected). The fact that it exited with 0
exit code is a good sign actually (which means that the init process did it job and completed successfully).
So it looks you have a running installation of airflow and it should work for you.
If you used the process described in https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html, you should be able to connect to http://0.0.0.0:8080, login with airflow/airflow and you should be able to run DAGs (At least there are no errors in the output you provided).
Upvotes: 2