環境:centos6.5; mysql Ver 14.14 Distrib 5.1.73,
主要參考這個文檔……
https://blog.csdn.net/kk185800961/article/details/78431484
遇到的大坑:
[root@hadoopdn-04 ~]# /usr/local/python27/bin/airflow webserver -p 8080
[2017-04-21 13:56:19,229] {_init_.py:57} INFO - Using executor SequentialExecutor
____________ _____________
____ |_( )________ _/_ /________ __
____ /| |_ /__ __/ /_ __ /_ __ _ | /| / /
___ ___ | / _ / _ _/ _ / / // /_ |/ |/ /
// |// // // // __/__/|_//usr/local/python27/lib/python2.7/site-packages/flask/exthook.py:71: ExtDeprecationWarning: Importing flask.ext.cache is deprecated, use flask_cache instead.
.format(x=modname), ExtDeprecationWarning
[2017-04-21 13:56:20,230] [3013]{models.py:167}
INFO - Filling up the DagBag from /root/airflow/dags
Running the Gunicorn Server with:
Workers: 4 sync
Host: 0.0.0.0:8080
Timeout: 120
Logfiles: - -
=================================================================
Traceback (most recent call last):
File "/usr/local/python27/bin/airflow", line 28, in <module>
args.func(args)
File "/usr/local/python27/lib/python2.7/site-packages/airflow/bin/cli.py", line 791, in webserver
gunicorn_master_proc = subprocess.Popen(run_args)
File "/usr/local/python27/lib/python2.7/subprocess.py", line 711, in _init_
errread, errwrite)
File "/usr/local/python27/lib/python2.7/subprocess.py", line 1308, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
The solution is , PATH variable must be updated to have all the dependencies of airflow
即:確認/etc/profile裏的配置,然後source /etc/profile
本來以爲我的是這個問題,折騰了一天後現並不是!!終於……
solution post:
https://www.cnblogs.com/lwglinux/p/7100400.html
找到了解決方法……現在的airflow真是太不友好了,只說找不到文件找不到文件,不說找不到那個文件啊……
又一個因爲版本問題的坑
[root@hadoop-07 bin]# ./airflow initdb
[2018-07-26 15:14:33,354] {__init__.py:57} INFO - Using executor SequentialExecutor
DB: mysql://******
[2018-07-26 15:14:34,553] {db.py:287} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade f2ca10b85618 -> 4addfa1236f1, Add fractional seconds to mysql tables
Traceback (most recent call last):
……………………
File "/usr/local/python/lib/python2.7/site-packages/airflow/migrations/versions/4addfa1236f1_add_fractional_seconds_to_mysql_tables.py", line 36, in upgrade
op.alter_column(table_name='dag', column_name='last_scheduler_run', type_=mysql.DATETIME(fsp=6))…………
File "/usr/local/python/lib/python2.7/site-packages/alembic/ddl/mysql.py", line 67, in alter_column
else existing_autoincrement
File "/usr/local/python/lib/python2.7/site-packages/alembic/ddl/impl.py", line 118, in _exec
return conn.execute(construct, *multiparams, **params)
………………
File "/usr/local/python/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
self.errorhandler(self, exc, value)
File "/usr/local/python/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
sqlalchemy.exc.ProgrammingError: (_mysql_exceptions.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NULL' at line 1") [SQL: u'ALTER TABLE dag MODIFY last_scheduler_run DATETIME(6) NULL'] (Background on this error at: http://sqlalche.me/e/f405)
solution post:
https://www.phpyuan.com/article/1519.html
需要變更
airflow/migrations/versions/4addfa1236f1_add_fractional_seconds_to_mysql_tables.py
將 mysql.DATETIME(fsp=6)
全部改爲 mysql.DATETIME()
或將mysql升級到5.7或以上的版本。