如何使用spring数据建立hadoop分布式缓存

n1bvdmb6  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(343)

我不熟悉spring数据,并且尝试通过分布式缓存分发所有spring数据依赖项。但它不起作用,也找不到有用的资源。
application-context.xml中的我的配置:-

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans:beans xmlns="http://www.springframework.org/schema/hadoop"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:beans="http://www.springframework.org/schema/beans"
  5. xmlns:hdp="http://www.springframework.org/schema/hadoop"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  9. http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">
  10. <hdp:configuration>
  11. fs.defaultFS=${hdp.fs}
  12. </hdp:configuration>
  13. <hdp:job id="wordcountJob"
  14. input-path="${wc.input.path}"
  15. output-path="${wc.output.path}"
  16. mapper="${wc.mapper}"
  17. reducer="${wc.reducer}"/>
  18. <hdp:cache create-symlink="true">
  19. <hdp:classpath value="/user/hadoop/DistributedCache/spring-data-hadoop-2.3.0.RELEASE.jar" />
  20. </hdp:cache>
  21. <hdp:job-runner id="runner" job-ref="wordcountJob" run-at-startup="true"/>
  22. <context:property-placeholder location="hadoop-configs.properties"/>
  23. </beans:beans>

我试图将spring数据hadoopjar分发到每个节点。但到目前为止还不起作用。是这样做的吗?任何帮助都将不胜感激

dz6r00yl

dz6r00yl1#

你可以在作业配置中添加它。

  1. <hdp:job id="MaxTempJob"
  2. input-path="${input.path}"
  3. output-path="${output.path}"
  4. jar-by-class="com.chanchal.MaxTemperature"
  5. mapper="com.chanchal.MaxTemperatureMapper"
  6. map-key="org.apache.hadoop.io.LongWritable"
  7. map-value="org.apache.hadoop.io.Text"
  8. libs="/lib/spring-data-hadoop-2.3.0.RELEASE.jar"
  9. />
  10. ``` `lib` 是项目的位置。

相关问题