1. Installation and deployment:
1. Add below the airflow.cfg configuration file
[core]
plugins_folder = /home/{
USER_NAME}/airflow/plugins
Note: The front of the airflow directory is the absolute path of the directory where airflow is located
2. Under the airflow directory, create a new plugins directory
mkdir plugins
3. Download the installation package
wget https://github.com/teamclairvoyant/airflow-rest-api-plugin/archive/master.zip
4. Unzip the package
unzip master.zip
You can see a directory airflow-rest-api-plugin-master
Go to this directory
cd airflow-rest-api-plugin-master
5. You can see, as shown below
Move the plugins directory directly to the airflow directory, or copy the rest_api_plugin.py file and templates directory under the directory to the plugins directory created in step 2
mv rest_api_plugin.py /home/{
USER_NAME}/airflow/plugins
mv templates /home/{
USER_NAME}/airflow/plugins
6. Add the following after the configuration file airflow.cfg:
[rest_api_plugin]
# Logs global variables used in the REST API plugin when the plugin is loaded. Set to False by default to avoid too many logging messages.
# DEFAULT: False
log_loading = False
# Filters out loading messages from the standard out
# DEFAULT: True
filter_loading_messages_in_cli_response = True
# HTTP Header Name to be used for authenticating REST calls for the REST API Plugin
# DEFAULT: 'rest_api_plugin_http_token'
rest_api_plugin_http_token_header_name = rest_api_plugin_http_token
# HTTP Token to be used for authenticating REST calls for the REST API Plugin
# DEFAULT: None
# Comment this out to disable Authentication
rest_api_plugin_expected_http_token = changeme
Note: rest_api_plugin_expected_http_token can be replaced with a custom value
7. Restart the airflow webser service
2. Pit encountered:
1. The following error is reported when restarting:
Both share the same name "rest_api". Blueprints that are created
The display conflict
may be due to: check the
plugin directory to see if there are 2 copies (perhaps in some nested form), for example:
~/airflow/plugins/rest_api_plugin.py
~/airflow/plugins/plugins/rest_api_plugin.py
Scenario:
Put the decompressed airflow-rest-api-plugin-master directory under the airflow directory, instead of directly moving the plugins directory to the airflow directory, but choosing cp copy will also cause this problem.
Conclusion:
don’t let two All plugins directories are under the airflow directory, just remove or delete the useless ones from airflow
. 2. It displays when the zip archive is unzipped, and the unzip command is not found, just download and install it.
yum install -y zip unzip