Connecting Trino through Oozie
job.properties
and workflow.xml
to connect Trino through Oozie.-
Navigate to
/usr/lib/oozie/
. -
Extract
oozie-examples.tar.gz
:sudo tar -xvf oozie-examples.tar.gz cp examples ~/
-
Update
examples/apps/shell/job.properties
andworkflow.xml
with correctnamenode
and resource manager URL to run SQL.Example: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
Example:
<!-- 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>
- Copy the examples directory to HDFS.
-
Run the Oozie job:
oozie job -oozie -config job.properties -run