星火赢了';t在纱线簇模式下运行final`saveAsNewAPIHadoopFile`方法

星火赢了';t在纱线簇模式下运行final`saveAsNewAPIHadoopFile`方法,hadoop,apache-spark,hdfs,rdd,Hadoop,Apache Spark,Hdfs,Rdd,我编写了一个Spark应用程序,它读取一些CSV文件(~5-10GB),转换数据并将数据转换为HFiles。数据从HDFS中读取并保存到HDFS中 当我在warn-client模式下运行应用程序时,一切似乎都很正常 但是,当我尝试将其作为纱线集群应用程序运行时,该过程似乎没有在我的已转换并准备好保存的RDD上运行最终的saveAsNewAPIHadoopFile操作 以下是我的Spark UI的快照,您可以看到所有其他作业都已处理: 以及相应的阶段: 下面是我的应用程序的最后一步,其中调用了

我编写了一个Spark应用程序,它读取一些CSV文件(~5-10GB),转换数据并将数据转换为HFiles。数据从HDFS中读取并保存到HDFS中

当我在
warn-client
模式下运行应用程序时,一切似乎都很正常

但是,当我尝试将其作为
纱线集群
应用程序运行时,该过程似乎没有在我的已转换并准备好保存的RDD上运行最终的
saveAsNewAPIHadoopFile
操作

以下是我的Spark UI的快照,您可以看到所有其他作业都已处理:

以及相应的阶段:

下面是我的应用程序的最后一步,其中调用了
saveAsNewAPIHadoopFile
方法:

JavaPairRDD<ImmutableBytesWritable, KeyValue> cells = ...

try {
    Connection c = HBaseKerberos.createHBaseConnectionKerberized("userpricipal", "/etc/security/keytabs/user.keytab");
    Configuration baseConf = c.getConfiguration();
    baseConf.set("hbase.zookeeper.quorum", HBASE_HOST);
    baseConf.set("zookeeper.znode.parent", "/hbase-secure");

    Job job = Job.getInstance(baseConf, "Test Bulk Load");
    HTable table = new HTable(baseConf, "map_data");        

    HBaseAdmin admin = new HBaseAdmin(baseConf);        
    HFileOutputFormat2.configureIncrementalLoad(job, table);            
    Configuration conf = job.getConfiguration();        

    cells.saveAsNewAPIHadoopFile(outputPath, ImmutableBytesWritable.class, KeyValue.class, HFileOutputFormat2.class, conf);
    System.out.println("Finished!!!!!");
} catch (IOException e) {
    e.printStackTrace();
    System.out.println(e.getMessage());
} 
javapairdd单元格=。。。
试一试{
连接c=HBaseKerberos.createHBaseConnectionKerberized(“userpricipal”,“etc/security/keytab/user.keytab”);
配置baseConf=c.getConfiguration();
baseConf.set(“hbase.zookeeper.quorum”,hbase\u主机);
baseConf.set(“zookeeper.znode.parent”,“/hbase-secure”);
Job Job=Job.getInstance(baseConf,“测试批量加载”);
HTable table=新的HTable(baseConf,“映射数据”);
HBaseAdmin admin=新的HBaseAdmin(baseConf);
HFileOutputFormat2.configureIncrementalLoad(作业、表);
Configuration=job.getConfiguration();
saveAsNewAPIHadoopFile(outputPath、ImmutableBytesWritable.class、KeyValue.class、HFileOutputFormat2.class、conf);
System.out.println(“完成!!!”;
}捕获(IOE异常){
e、 printStackTrace();
System.out.println(e.getMessage());
} 
我通过spark submit--master Thread--部署模式集群--类sparkhbase.BulkLoadAsKeyValue3--驱动核心8--驱动内存11g--执行核心4--执行内存9g/home/myuser/app.jar运行应用程序

当我查看HDFS的输出目录时,它仍然是空的!我正在HDP2.5平台中使用Spark 1.6.3


所以我这里有两个问题:这种行为是从哪里来的(可能是记忆问题)?纱线客户机和纱线集群模式之间有什么区别(我还不了解,文档也不清楚)?谢谢你的帮助

这项工作似乎还没有开始。在开始作业之前,请检查可用资源。我认为现有资源是不够的。因此,尽量减少配置中的驱动程序和执行程序内存、驱动程序和执行程序内核。 在这里,您可以阅读如何为执行者和驱动者计算资源的适当价值:

作业在客户端模式下运行,因为在客户端模式下,驱动器可以使用节点上的所有可用资源。但在集群模式下,资源是有限的

群集模式和客户端模式之间的差异:
客户:

群集:

Driver runs on one of the cluster's Worker nodes. The worker is chosen by the Master leader
Driver runs as a dedicated, standalone process inside the Worker.
Driver programs takes up at least 1 core and a dedicated amount of memory from one of the workers (this can be configured).
Driver program can be monitored from the Master node using the --supervise flag and be reset in case it dies.
When working in Cluster mode, all JARs related to the execution of your application need to be publicly available to all the workers. This means you can either manually place them in a shared place or in a folder for each of the workers.

我发现,这个问题与Kerberos问题有关!从我的Hadoop Namenode以
Thread client
模式运行应用程序时,驱动程序正在该节点上运行,我的Kerberos服务器也在该节点上运行。因此,文件
/etc/security/keytab/user.keytab
中使用的
userpricipal
在此机器上存在

纱线集群
中运行应用程序时,驱动程序进程会在我的一个Hadoop节点上随机启动。由于我在创建密钥文件后忘记将其复制到其他节点,驱动程序进程当然无法在该本地位置找到密钥表文件

因此,为了能够在Kerberized Hadoop集群中使用Spark(甚至在
纱线集群
模式下),您必须将运行
Spark submit
命令的用户所需的keytab文件复制到集群所有节点上的对应路径

scp /etc/security/keytabs/user.keytab user@workernode:/etc/security/keytabs/user.keytab

因此,您应该能够在集群的每个节点上创建一个
kinit-kt/etc/security/keytab/user.keytab user

但是Spark UI显示其他作业和阶段,我可以通过x/y进度条跟踪它们的状态,我的纱线资源管理器界面也显示了运行期间保留的资源。感谢您对集群和客户端模式的解释,非常好理解!请提供您作业处于运行状态的Thread UI的快照。您看到作业日志了吗?这似乎是Kerberos/身份验证问题!我会在周末去试一下,到时候再回复
scp /etc/security/keytabs/user.keytab user@workernode:/etc/security/keytabs/user.keytab