在远程集群上获取 pig 脚本的结果
Getting results of a pig script on a remote cluster
有没有一种方法可以直接在远程集群上获取 pig 脚本 运行 的结果,而无需存储它们并单独检索它们?
因此您可以使用猪参数 运行 您的脚本。例如:
example.pig
A = LOAD '$PATH_TO_FOLDER_WITH_DATA' AS (f1:int, f2:int, f3:int);
--# Do Something With Your Data, and get output
C = STORE ouput INTO '$OUTPUT_PATH'
然后你可以 运行 像这样的脚本:
pig -p "/path/to/local/file" -p "/path/to/the/output" example.pig
所以要在 BASH 中实现自动化:
storelocal.sh
#!/bin/bash
pig -p '$PATH_TO_FILES' -p '$PATH_TO_HDFS_OUT' example.pig
hdfs dfs -getmerge '$PATH_TO_HDFS_OUT' '$PATH_TO_LOCAL'
你可以运行它./storelocal.sh /path/to/local/file /path/to/the/local/output
有没有一种方法可以直接在远程集群上获取 pig 脚本 运行 的结果,而无需存储它们并单独检索它们?
因此您可以使用猪参数 运行 您的脚本。例如:
example.pig
A = LOAD '$PATH_TO_FOLDER_WITH_DATA' AS (f1:int, f2:int, f3:int);
--# Do Something With Your Data, and get output
C = STORE ouput INTO '$OUTPUT_PATH'
然后你可以 运行 像这样的脚本:
pig -p "/path/to/local/file" -p "/path/to/the/output" example.pig
所以要在 BASH 中实现自动化:
storelocal.sh
#!/bin/bash
pig -p '$PATH_TO_FILES' -p '$PATH_TO_HDFS_OUT' example.pig
hdfs dfs -getmerge '$PATH_TO_HDFS_OUT' '$PATH_TO_LOCAL'
你可以运行它./storelocal.sh /path/to/local/file /path/to/the/local/output