How to set up hadoop distributed cache using spring data

107 Views Asked by At

I'm new to spring data and trying to distribute all the spring data dependencies through distributed cache. But it's not working and no useful resources are found.

My configuration inside application-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>

I'm trying to distribute spring-data-hadoop jar to each nodes. But so far it's not working. Is it way to do so ? Any help will be appreciated

1

There are 1 best solutions below

0
user3459215 On

You can add that in job configuration.

<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 is location of project.