当前位置: 首页 > 工具软件 > dumb-init > 使用案例 >

Airflow docker init数据库启动搞错

米俊喆
2023-12-01
airflow-init_1       | ERROR! Maximum number of retries (20) reached.
airflow-init_1       | 
airflow-init_1       | Last check result:
airflow-init_1       | $ airflow db check
airflow-init_1       | Unable to load the config, contains a configuration error.
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/usr/local/lib/python3.9/pathlib.py", line 1323, in mkdir
airflow-init_1       |     self._accessor.mkdir(self, mode)
airflow-init_1       | FileNotFoundError: [Errno 2] No such file or directory: '/opt/airflow/logs/scheduler/2022-10-17'
airflow-init_1       | 
airflow-init_1       | During handling of the above exception, another exception occurred:
airflow-init_1       | 
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/usr/local/lib/python3.9/logging/config.py", line 564, in configure
airflow-init_1       |     handler = self.configure_handler(handlers[name])
airflow-init_1       |   File "/usr/local/lib/python3.9/logging/config.py", line 745, in configure_handler
airflow-init_1       |     result = factory(**kwargs)
airflow-init_1       |   File "/home/airflow/.local/lib/python3.9/site-packages/airflow/utils/log/file_processor_handler.py", line 46, in __init__
airflow-init_1       |     Path(self._get_log_directory()).mkdir(parents=True, exist_ok=True)
airflow-init_1       |   File "/usr/local/lib/python3.9/pathlib.py", line 1327, in mkdir
airflow-init_1       |     self.parent.mkdir(parents=True, exist_ok=True)
airflow-init_1       |   File "/usr/local/lib/python3.9/pathlib.py", line 1323, in mkdir
airflow-init_1       |     self._accessor.mkdir(self, mode)
airflow-init_1       | PermissionError: [Errno 13] Permission denied: '/opt/airflow/logs/scheduler'
airflow-init_1       | 
airflow-init_1       | The above exception was the direct cause of the following exception:
airflow-init_1       | 
airflow-init_1       | Traceback (most recent call last):
airflow-init_1       |   File "/home/airflow/.local/bin/airflow", line 5, in <module>
airflow-init_1       |     from airflow.__main__ import main
airflow-init_1       |   File "/home/airflow/.local/lib/python3.9/site-packages/airflow/__init__.py", line 46, in <module>
airflow-init_1       |     settings.initialize()
airflow-init_1       |   File "/home/airflow/.local/lib/python3.9/site-packages/airflow/settings.py", line 444, in initialize
airflow-init_1       |     LOGGING_CLASS_PATH = configure_logging()
airflow-init_1       |   File "/home/airflow/.local/lib/python3.9/site-packages/airflow/logging_config.py", line 73, in configure_logging
airflow-init_1       |     raise e
airflow-init_1       |   File "/home/airflow/.local/lib/python3.9/site-packages/airflow/logging_config.py", line 68, in configure_logging
airflow-init_1       |     dictConfig(logging_config)
airflow-init_1       |   File "/usr/local/lib/python3.9/logging/config.py", line 809, in dictConfig
airflow-init_1       |     dictConfigClass(config).configure()
airflow-init_1       |   File "/usr/local/lib/python3.9/logging/config.py", line 571, in configure
airflow-init_1       |     raise ValueError('Unable to configure handler '
airflow-init_1       | ValueError: Unable to configure handler 'processor'
在使用官方docker-compose文件进行初始化时出现错误,下面命令:
docker-compose up airflow-init

看报错可以得知是权限错误,所以需要将本地对应的volume设置权限为可写入,故对本地所关联的volume设置权限为

   service_name:
     ...
     volumes:
      - /home/user/airflow_logs:/opt/airflow/logs

这时执行下列命令

 sudo chmod u=rwx,g=rwx,o=rwx /home/user/airflow_logs
此时执行命令即为正确。
 类似资料: