[HADOOP] 감속기에서 매퍼 카운터 값에 액세스하는 방법?
HADOOP감속기에서 매퍼 카운터 값에 액세스하는 방법?
내 감속기에서 myCounter.my 값에 액세스하려고합니다.
public static class Map extends Mapper<LongWritable, Text, ImmutableBytesWritable, ImmutableBytesWritable>
{
public static enum myCounter{my};
@Override
public void map(LongWritable key, Text value, Context context)
{
context.getCounter(myCounter.my).increment(1);
context.write( new ImmutableBytesWritable ( ),new ImmutableBytesWritable() );
}
}
public static class Reduce extends Reducer<ImmutableBytesWritable, ImmutableBytesWritable, Text, Text>
{
@Override
public void reduce(ImmutableBytesWritable key,Iterable<ImmutableBytesWritable> result,Context context)
{
}
}
감속기에서 매퍼 카운터에 액세스 (이전 API의 경우) 새 API에서 작동하도록 만드는 방법은 무엇입니까?
또는
매퍼 출력의 총 수를 알고 싶습니까? 더 좋은 방법이 있습니까? (저는 Reducer의 카운터에 액세스 할 수 없습니다 :
그룹 이름 -> org.apache.hadoop.mapred.Task $ 카운터 카운터 이름 -> MAP_OUTPUT_RECORDS)
감사
해결법
-
==============================
1.작업 개체를 통해 카운터에 액세스하여 새 API에서 작동하도록 만듭니다.
작업 개체를 통해 카운터에 액세스하여 새 API에서 작동하도록 만듭니다.
Configuration conf = context.getConfiguration(); Cluster cluster = new Cluster(conf); Job currentJob = cluster.getJob(context.getJobID()); long val=currentJob.getCounters().findCounter(myCounter.my).getValue();
-
==============================
2.동일한 코드를 사용하여 감속기의 카운터 값에 액세스 할 수 있습니다.
동일한 코드를 사용하여 감속기의 카운터 값에 액세스 할 수 있습니다.
Counter counter = context.getCounter( myCounter.my ); counter.getValue();
또한 보아라.
-
==============================
3.다음과 같이 액세스 할 수 있습니다.
다음과 같이 액세스 할 수 있습니다.
Map.myCounter.my // static fields you can access by it's class name.
from https://stackoverflow.com/questions/12577128/how-to-access-mapper-counter-value-in-a-reducer by cc-by-sa and MIT license
'HADOOP' 카테고리의 다른 글
[HADOOP] 원사 - 클러스터 모드에서 Spark 드라이버 (및 YARN 컨테이너)에 대한 장애 조치 프로세스가 어떻게 작동하는지에 대한 리소스 / 문서 (0) | 2019.07.22 |
---|---|
[HADOOP] java.lang.OutOfMemoryError : 큰 데이터 세트에 대해 새 원시 스레드를 만들 수 없습니다. (0) | 2019.07.22 |
[HADOOP] jobtracker.info 파일은 1 대신에 0 노드로만 복제 될 수있었습니다. (0) | 2019.07.22 |
[HADOOP] Phoenix는 음의 정수 값을 올바르게 표시하지 않습니다. (0) | 2019.07.22 |
[HADOOP] Hadoop 백업 및 복구 도구 및 지침 (0) | 2019.07.22 |