2016-04-15 69 views
0

我是新來的spring數據並試圖通過分佈式緩存分發所有spring數據依賴關係。但它不起作用,沒有找到有用的資源。如何使用彈簧數據設置hadoop分佈式緩存

我裏面應用程序的context.xml配置: -

<?xml version="1.0" encoding="UTF-8"?> 
<beans:beans xmlns="http://www.springframework.org/schema/hadoop" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:beans="http://www.springframework.org/schema/beans" 
     xmlns:hdp="http://www.springframework.org/schema/hadoop" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 
    http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd"> 
    <hdp:configuration> 
     fs.defaultFS=${hdp.fs} 
    </hdp:configuration> 

    <hdp:job id="wordcountJob" 
     input-path="${wc.input.path}" 
     output-path="${wc.output.path}" 
     mapper="${wc.mapper}" 
     reducer="${wc.reducer}"/> 


    <hdp:cache create-symlink="true"> 
    <hdp:classpath value="/user/hadoop/DistributedCache/spring-data-hadoop-2.3.0.RELEASE.jar" /> 
    </hdp:cache> 

    <hdp:job-runner id="runner" job-ref="wordcountJob" run-at-startup="true"/> 
    <context:property-placeholder location="hadoop-configs.properties"/> 
</beans:beans> 

我試圖彈簧數據的hadoop的jar分發到每個節點。但到目前爲止它不工作。是否這樣做?任何幫助將不勝感激

回答

0

你可以添加,在作業配置。

<hdp:job id="MaxTempJob" 
    input-path="${input.path}" 
    output-path="${output.path}" 
    jar-by-class="com.chanchal.MaxTemperature" 
    mapper="com.chanchal.MaxTemperatureMapper" 
    map-key="org.apache.hadoop.io.LongWritable" 
    map-value="org.apache.hadoop.io.Text" 
    libs="/lib/spring-data-hadoop-2.3.0.RELEASE.jar" 
/> 

lib是項目的位置。