我想達到什麼多個減速:線了Hadoop的Jobfactorybean,在單節點的Hadoop
我已經建立了包含Hadoop的任務處理一些較大的文件春季批處理作業。 要獲得多個Reducers運行的作業,我需要設置setNumOfReduceTasks減速器的數量。我試圖通過JobFactorybean來設置它。
我在classpath中bean的配置:/META-INF/spring/batch-common.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:property-placeholder location="classpath:batch.properties,classpath:hadoop.properties"
ignore-resource-not-found="true" ignore-unresolvable="true" />
<import resource="classpath:/META-INF/spring/batch-common.xml" />
<import resource="classpath:/META-INF/spring/hadoop-context.xml" />
<import resource="classpath:/META-INF/spring/sort-context.xml" />
</beans>
我:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="jobFactoryBean" class="org.springframework.data.hadoop.mapreduce.JobFactoryBean" p:numberReducers="5"/>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean" />
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher" p:jobRepository-ref="jobRepository" />
</beans>
XML是通過包括通過
獲取jUnit測試的豆JUnit測試將停止與錯誤:
No bean named '&jobFactoryBean' is defined
所以說:沒有加載JobFactoryBean,但其他人都正確,沒有一個錯誤加載。
沒有
JobFactoryBean jfb = ctx.getBean(JobFactoryBean.class);
項目測試運行線,但只有一個每個作業減速。
方法
ctx.getBean("jobFactoryBean");
返回一個Hadoop作業。我期望得到factoryBean那裏...
爲了測試它,我已經擴展了Reducer的構造函數來記錄Reducer的每個創建,以在生成一個通知時獲取通知。到目前爲止,我只在日誌中獲得一個條目。
我有一個2個虛擬機,每個虛擬機有2個分配內核和2個內存,我嘗試對包含Project Gutenberg多本書的75MB文件進行排序。
編輯:
我已經嘗試的另一件事是設置通過屬性Hadoop的作業減速器的數量,而不是結果。
<job id="search-jobSherlockOk" input-path="${sherlock.input.path}"
output-path="${sherlockOK.output.path}"
mapper="com.romediusweiss.hadoopSort.mapReduce.SortMapperWords"
reducer="com.romediusweiss.hadoopSort.mapReduce.SortBlockReducer"
partitioner="com.romediusweiss.hadoopSort.mapReduce.SortPartitioner"
number-reducers="2"
validate-paths="false" />
在MapReduce的site.xml中的設置是兩個節點上:
<property> <name>mapred.tasktracker.reduce.tasks.maximum</name> <value>10</value> </property>
......和爲什麼:
我想複製下面的博客文章的例子: http://www.philippeadjiman.com/blog/2009/12/20/hadoop-tutorial-series-issue-2-getting-started-with-customized-partitioning/
我需要在同一臺機器或一個完全分佈式環境中測試分區程序的行爲在不同的減速。第一種方法會更容易。
P.s .:具有較高聲望的用戶可以創建標籤「spring-data-hadoop」謝謝!
Hadoops作業提交界面非常易於使用,每個人都需要一個「工廠」並希望將作業注入到他們的bean中真是令人驚訝。 –
雖然我只是編碼部分,但架構決定是在另一個層面上做出的。 (Using Spring);-) +如果你能告訴我如何設置setNumOfReduceTasks屬性,而沒有Hadoop作業上的Spring配置,從Spring Batch開始,我會這樣做。 – romedius
@ThomasJungblut更新。我正在跟蹤這個問題。慢。 – romedius