我正在嘗試使用 AirflowBashOperator任務將一些資料插入到 Hbase 表中。我嘗試首先呼叫 hbase shell,然后將一些資料插入到我的表中:
logg_data_to_hbase = BashOperator(
task_id='data_to_hbase',
dag=test_dag,
bash_command="hbase shell && put 'tablename', 'rowname','columnvalue', 1000")
我收到一條錯誤訊息,提示錯誤 - Bash 命令失敗。
[2022-01-06 11:01:17,077] {bash_operator.py:100} INFO - 臨時腳本位置:/tmp/airflowtmpcKRT8C/data_to_hbaseY7y25j
[2022-01-06 11:01:17,077] {bash_operator.py:110} INFO - 運行命令:hbase shell && put 'tablename', 'rowname','columnvalue', 1000
[2022-01-06 11:01:17,091] {bash_operator.py:119} 資訊 - 輸出:
[2022-01-06 11:01:28,659] {bash_operator.py:123} INFO - /tmp/airflowtmpcKRT8C/data_to_hbaseY7y25j:第 1 行:put:找不到命令
[2022-01-06 11:01:28,660] {bash_operator.py:127} INFO - 命令退出并回傳代碼 127
[2022-01-06 11:01:28,672] {models.py:1788} 錯誤 - Bash 命令失敗
回溯(最后一次呼叫):檔案“/opt/python-2.7.16-AF-1.10.2-XXX/lib/python2.7/site-packages/airflow/models.py”,第 1652 行,在 _run_raw_task 結果中= task_copy.execute(context=context) 檔案“/opt/python-2.7.16-AF-1.10.2-XXX/lib/python2.7/site-packages/airflow/operators/bash_operator.py”,第 131 行,在執行 raise AirflowException("Bash command failed") AirflowException: Bash command failed
為了執行 put-command,我需要更改什么?
uj5u.com熱心網友回復:
最后一行需要更改。
bash_command = "echo \"put 'tablename', 'rowname','columnvalue', '1000'\" | hbase shell"
這樣的put命令得到執行中hbase shell的幫助下|。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/407362.html
標籤:
上一篇:在多值變數的每個單詞中添加文本
