Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在MapReduce模式下,来自Jar文件而非Eclipse的PIG脚本统计信息始终为零(0)_Eclipse_Maven_Hadoop_Apache Pig - Fatal编程技术网

在MapReduce模式下,来自Jar文件而非Eclipse的PIG脚本统计信息始终为零(0)

在MapReduce模式下,来自Jar文件而非Eclipse的PIG脚本统计信息始终为零(0),eclipse,maven,hadoop,apache-pig,Eclipse,Maven,Hadoop,Apache Pig,我正在使用hadoop2.2和pig-0.12 我创建了Maven项目,用于使用MapReduce模式在JAVA应用程序中调用PIG脚本。我的代码在Eclipse中运行良好(它显示正确的统计数据) 但是,当我构建到JAR文件中时,执行相同的作业时,获取的统计信息总是显示为零,但生成的输出文件具有正确的结果 下面是我在终端窗口中运行PIG脚本应用程序时实际得到的响应 Input(s): Successfully read 0 records from: "/user/hdfs/input/100R

我正在使用hadoop2.2和pig-0.12

我创建了Maven项目,用于使用MapReduce模式在JAVA应用程序中调用PIG脚本。我的代码在Eclipse中运行良好(它显示正确的统计数据)

但是,当我构建到JAR文件中时,执行相同的作业时,获取的统计信息总是显示为零,但生成的输出文件具有正确的结果

下面是我在终端窗口中运行PIG脚本应用程序时实际得到的响应

Input(s):
Successfully read 0 records from: "/user/hdfs/input/100RecordsDataInput.csv"

Output(s):
Successfully stored 0 records in: "hdfs:/user/hdfs/out/980"

Counters:
Total records written : 0
Total bytes written : 0
Spillable Memory Manager spill count : 0
Total bags proactively spilled: 0
Total records proactively spilled: 0
我不知道我做错了什么

这是我的POM.xml文件

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <repositories>
        <repository>
            <id>cloudera</id>
            <url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
        </repository>
    </repositories>

    <groupId>PIGScript</groupId>
    <artifactId>PIGScript_Sample</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>PIGScript_Sample</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>      <!-- <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> 
            <version>1.0.0-cdh5.4.4</version> </dependency> <groupId>org.apache.hbase</groupId> 
            <artifactId>hbase-server</artifactId> <version>1.0.0-cdh5.4.4</version> </dependency> -->


        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.6.0-cdh5.4.4</version>
        </dependency>

        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-hdfs</artifactId>
            <version>2.6.0-cdh5.4.4</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.pig</groupId>
            <artifactId>pig</artifactId>
            <version>0.12.0-cdh5.4.4</version>
        </dependency>

        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr-runtime</artifactId>
            <version>3.5.2</version>
        </dependency>


        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.8.2</version>
        </dependency>

        <dependency>
            <groupId>dk.brics.automaton</groupId>
            <artifactId>automaton</artifactId>
            <version>1.11-8</version>
        </dependency>

        <dependency>
            <groupId>org.apache.pig</groupId>
            <artifactId>piggybank</artifactId>
            <version>0.12.0</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>PIGScript.PIGScript_Sample.PIGScript</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>PIGScript.PIGScript_Sample.PIGScript</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

4.0.0
克劳德拉
https://repository.cloudera.com/artifactory/cloudera-repos/
猪手稿
猪舍样本
0.0.1-快照
罐子
猪舍样本
http://maven.apache.org
UTF-8
org.apache.hadoop
hadoop客户端
2.6.0-cdh5.4.4
org.apache.hadoop
hadoop hdfs
2.6.0-cdh5.4.4
commons httpclient
commons httpclient
3.1
org.apache.pig
猪
0.12.0-cdh5.4.4
org.antlr
antlr运行时
3.5.2
乔达时间
乔达时间
2.8.2
dk.brics.automaton
自动机
1.11-8
org.apache.pig
养猪罐
0.12.0
朱尼特
朱尼特
4.11
测试
src/main/resources
org.apache.maven.plugins
maven编译器插件
2.0.2
1.8
1.8
org.apache.maven.plugins
maven jar插件
真的
解放党/
PIGScript.PIGScript_Sample.PIGScript
maven汇编插件
真的
PIGScript.PIGScript_Sample.PIGScript
带有依赖项的jar
这是正常的还是我错过了什么?请让我知道

更新:


我注意到,当我在Eclipse中执行作业时,History UI中提供了新的MapReduce条目(IPAddress:8088),但当我在JAR文件中执行相同类型的作业时,History UI中没有新条目。我在Google中看到,如果在本地模式下运行的PIG脚本不会产生统计数据,那么这是来自JAR文件的PIG脚本在本地模式下运行吗?如何确定作业是以本地模式还是MapReduce模式运行?

我已更改POM文件中的以下部分

 <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>PIGScript.PIGScript_Sample.PIGScript</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>

maven汇编插件
真的
PIGScript.PIGScript_Sample.PIGScript
带有依赖项的jar
使用新修改的插件

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

org.apache.maven.plugins
maven依赖插件
复制
安装
复制依赖项
${project.build.directory}/lib

使用了clean installmaven命令,现在一切正常,它显示了正确的统计数据,希望以前没有更新过一些依赖项jar文件。因此,只有它在本地模式下运行。我不是Hadoop it方面的专家,只是因为我的假设。

更新了更新部分中的新发现/问题