How to Start Airflow Webserver: Simple Steps to Launch UI
To start the Airflow webserver, run the command
airflow webserver in your terminal. This launches the Airflow UI on the default port 8080, accessible via http://localhost:8080.Syntax
The basic command to start the Airflow webserver is:
airflow webserver: Starts the webserver process.--port <port_number>: Optional flag to specify a custom port (default is 8080).--daemon: Optional flag to run the webserver in the background.
bash
airflow webserver [--port 8080] [--daemon]Example
This example starts the Airflow webserver on the default port 8080 in the foreground. You can then open your browser and go to http://localhost:8080 to access the Airflow UI.
bash
airflow webserver
Output
Starting the Airflow webserver on port 8080
[2024-06-xx xx:xx:xx,xxx] {webserver.py:xxx} INFO - Starting gunicorn 20.x.x
[2024-06-xx xx:xx:xx,xxx] {webserver.py:xxx} INFO - Listening at: http://0.0.0.0:8080 (xxxx)
[2024-06-xx xx:xx:xx,xxx] {webserver.py:xxx} INFO - Using worker: sync
[2024-06-xx xx:xx:xx,xxx] {webserver.py:xxx} INFO - Booting worker with pid: xxxx
Common Pitfalls
Common mistakes when starting the Airflow webserver include:
- Not initializing the Airflow database with
airflow db initbefore starting the webserver. - Trying to start the webserver without activating the correct Python environment where Airflow is installed.
- Port 8080 already in use by another application, causing the webserver to fail to start.
- Running the webserver without starting the scheduler, which is needed to run workflows.
bash
Wrong: airflow webserver # Fails if DB not initialized or port busy Right: airflow db init airflow webserver --port 8080
Quick Reference
Summary tips for starting Airflow webserver:
- Always run
airflow db initonce before starting the webserver. - Use
--portto change the default port if needed. - Use
--daemonto run the webserver in the background. - Access the UI at
http://localhost:8080by default.
Key Takeaways
Run
airflow webserver to start the Airflow UI on port 8080 by default.Initialize the Airflow database first with
airflow db init to avoid errors.Use
--port to specify a different port if 8080 is busy.Run the webserver in the background with
--daemon if needed.Access the Airflow UI at
http://localhost:8080 after starting the webserver.