スクリプト気流

気流-1脚本:
* / 2 * * * * / binに/ shを/hongfeng/script/rsynce_airflow_log.sh>を/ dev / null 2>&1
* / 4 * * * * / binに/ SH / hongfeng /スクリプト/ monitor_scheduler。 SH>を/ dev / null 2>&1

1 /的rsync_airflow_log.shログイン
--exclude「dag_processor_manager --exclude 'scheduler_failover' 'スケジューラ' /ルート/気流/ログ/ /ルート/気流/ログ/ --exclude:rsyncの-azuq -e sshを[email protected]
rsyncを-azuq -e sshを[email protected]:/ルート/気流/ログ/ /ルート/気流/ログ/ --exclude 'スケジューラー' --exclude 'scheduler_failover' --exclude 'dag_processor_manager'
rsyncを-azuq -e SSH [email protected]:/ルート/気流/ログ/ /ルート/気流/ログ/ --exclude 'スケジューラー' --exclude 'scheduler_failover' --exclude 'dag_processor_manager'

2 / monitor_scheduler.sh
#!/ binに/ shを

日付= $(日付+%Y-%M-%のd-%H:%M)

FILE_PATH = /ルート/気流/ scheduler.log
CHECK_TIME = 150
file_old_stat = "`のstat $ {file_pathに} | grepをSize`"
睡眠$ {} CHECK_TIME
file_new_stat = "`のstat $ {file_pathに} | grepをSize`"
`[[場合エコー$ {file_old_stat} `` ==エコー$ {file_new_stat} `]]。その後
/データ/ venv / binに/アクティブ&& supervisorctl再起動airflow_scheduler &&非アクティブ化
エコー"#$ {日付}、スケジューラサービスを再起動" >> / tmp / testディレクトリ/ scheduler_hung.log
Fiの

3 / status_check.sh
ansible気流-mシェル-a」。/データ/ venv / binに/アクティベート&& supervisorctl状態

4 / deploy_git_airflow.sh
ansible気流シェル-a -m 'CD /ルート/気流/ DAGの&& Gitのプル'
5 /エンタープライズマイクロチャネルのアラーム(G:\ドキュメント\開発\パイソン)。
* / 2 * * * *(/データ/ venv / binに/アクティブ&&のpython /root/airflow/airflow_health_monitor.py &&非アクティブ化)>> /root/airflow/airflow_health.log 2>&1&

おすすめ

転載: www.cnblogs.com/hongfeng2019/p/12191966.html