Oozieを介したTrinoの接続

これは、Oozie job.propertiesおよびworkflow.xmlを編集して、Oozieを介してTrinoを接続する方法を示す例です。
  1. /usr/lib/oozie/にナビゲートします。
  2. 抽出oozie-examples.tar.gz:
    sudo tar -xvf oozie-examples.tar.gz
    cp examples ~/
  3. SQLを実行するには、examples/apps/shell/job.propertiesおよびworkflow.xmlを正しいnamenodeおよびリソース・マネージャURLで更新します。
    :
    bash-4.2$ cat job.properties
    #
    # Licensed to the Apache Software Foundation (ASF) under one
    # or more contributor license agreements.  See the NOTICE file
    # distributed with this work for additional information
    # regarding copyright ownership.  The ASF licenses this file
    # to you under the Apache License, Version 2.0 (the
    # "License"); you may not use this file except in compliance# with the License.  You may obtain a copy of the License at
    #
    #      http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #nameNode=hdfs://clustername-mn0.bmbdcsad1.bmbdcs.oraclevcn.com:8020
    resourceManager=clustername-mn0.bmbdcsad1.bmbdcs.oraclevcn.com:8050
    queueName=default
    examplesRoot=examples
    
    oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/shell

    :

    <!--
      Licensed to the Apache Software Foundation (ASF) under one
      or more contributor license agreements.  See the NOTICE file
      distributed with this work for additional information
      regarding copyright ownership.  The ASF licenses this file
      to you under the Apache License, Version 2.0 (the
      "License"); you may not use this file except in compliance
      with the License.  You may obtain a copy of the License at
     
          http://www.apache.org/licenses/LICENSE-2.0
    
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->
    <workflow-app xmlns="uri:oozie:workflow:1.0" name="shell-wf">
        <start to="trino-node"/>
        <action name="trino-node">
            <shell xmlns="uri:oozie:shell-action:1.0">
                <resource-manager>${resourceManager}</resource-manager>
                <name-node>${nameNode}</name-node>
                <exec>bash</exec>
                <argument>/usr/lib/trino/bin/trino-cli</argument>
                <argument>--server</argument>
                <argument>http://clustername-mn0.bmbdcsad1.bmbdcs.oraclevcn.com:8285</argument>
                <argument>--execute</argument>
                <argument>select 1</argument>
                <capture-output/>
            </shell>
            <ok to="check-output"/>
            <error to="fail"/>
        </action>
        <decision name="check-output">
            <switch>
                <case to="end">
                    ${wf:actionData('shell-node')['my_output'] eq '1'}
                </case>
                <default to="fail-output"/>
            </switch>
        </decision>
        <kill name="fail">
            <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill>
        <kill name="fail-output">
            <message>Incorrect output</message>
        </kill>
        <end name="end"/>
    </workflow-app>
  4. examplesディレクトリをHDFSにコピーします。
  5. Oozieジョブを実行します。
    oozie job -oozie -config job.properties -run