hadoop自带RandomWriter例子解析

别再傻傻分不清!5分钟搞懂倾斜摄影里‘地面分辨率’和‘模型精度’到底啥关系 本文深入解析倾斜摄影中‘地面分辨率’与‘模型精度’的关系,帮助读者快速理解两者的本质区别与内在关联。通过实战案例和公式计算,详细说明如何从航飞设计到精度验证全流程控制,避免常见认知误区,并针对不同应用场景提供精度需求建议。 阅读详情

步骤:

                   在eclipse中运行

                   右键--》run as -->run configuration

                   在Programs argument中添加:/user/hadoop/output(此处随你自己修改)

代码:

/**

 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.apache.hadoop.examples;


import java.io.IOException;
import java.util.Date;
import java.util.Random;


import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.BytesWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.mapred.ClusterStatus;
import org.apache.hadoop.mapred.FileOutputFormat;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.InputFormat;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobClient;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
import org.apache.hadoop.mapred.lib.IdentityReducer;
import org.apache.hadoop.util.GenericOptionsParser;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;


/**
 * This program uses map/reduce to just run a distributed job where there is no
 * interaction between the tasks and each task write a large unsorted random
 * binary sequence file of BytesWritable. In order for this program to generate
 * data for terasort with 10-byte keys and 90-byte values, have the following
 * config: <xmp> <?xml version="1.0"?> <?xml-stylesheet type="text/xsl"
 * href="configuration.xsl"?> <configuration> <property>
 * <name>test.randomwrite.min_key</name> <value>10</value> </property>
 * <property> <name>test.randomwrite.max_key</name> <value>10</value>
 * </property> <property> <name>test.randomwrite.min_value</name>
 * <value>90</value> </property> <property>
 * <name>test.randomwrite.max_value</name> <value>90</value> </property>
 * <property> <name>test.randomwrite.total_bytes</name>
 * <value>1099511627776</value> </property> </configuration></xmp>
 * 
 * Equivalently, {@link RandomWriter} also supports all the above options and
 * ones supported by {@link GenericOptionsParser} via the command-line.
 */
public class RandomWriter extends Configured implements Tool {


/**
* User counters
*/
static enum Counters {
RECORDS_WRITTEN, BYTES_WRITTEN
}


/**
* A custom input format that creates virtual inputs of a single string for
* each map.
*/
static class RandomInputFormat extends Configured implements
InputFormat<Text, Text> {
/**
* Generate the requested number of file splits, with the filename set
* to the filename of the output file.
*/
public InputSplit[] getSplits(JobConf job, int numSplits)
throws IOException {
/**  设置输入分片的个数  在run方法中设在的Map数量只是建议性质的 Map的数量是由InputFormat的getSplits方法放回的数组个数决定的  所以在这里进行设置**/
JobClient client = new JobClient(job);
ClusterStatus cluster = client.getClusterStatus();
/** 如果属性不存在 则返回默认的值 **/
int numMapsPerHost = job.getInt("test.randomwriter.maps_per_host",
10);
long numBytesToWritePerMap = job.getLong(
"test.randomwrite.bytes_per_map", 1 * 1024 * 1024 * 1024);
if (numBytesToWritePerMap == 0) {
System.err
.println("Cannot have test.randomwrite.bytes_per_map set to 0");
}
long totalBytesToWrite = job
.getLong("test.randomwrite.total_bytes", numMapsPerHost
* numBytesToWritePerMap * cluster.getTaskTrackers());
int numMaps = (int) (totalBytesToWrite / numBytesToWritePerMap);
if (numMaps == 0 && totalBytesToWrite > 0) {
numMaps = 1;
}
System.out.println("numMaps-------" + numMaps);
InputSplit[] result = new InputSplit[numMaps];
Path outDir = FileOutputFormat.getOutputPath(job);
for (int i = 0; i < result.length; ++i) {
result[i] = new FileSplit(new Path(outDir, "dummy-split-" + i),
0, 1, (String[]) null);
}
return result;
}


/**
* Return a single record (filename, "") where the filename is taken
* from the file split.
*/
static class RandomRecordReader implements RecordReader<Text, Text> {
Path name;


public RandomRecordReader(Path p) {
name = p;
}


public boolean next(Text key, Text value) {
if (name != null) {
key.set(name.getName());
name = null;
return true;
}
return false;
}


public Text createKey() {
return new Text();
}


public Text createValue() {
return new Text();
}


public long getPos() {
return 0;
}


public void close() {
}


public float getProgress() {
return 0.0f;
}
}


public RecordReader<Text, Text> getRecordReader(InputSplit split,
JobConf job, Reporter reporter) throws IOException {
return new RandomRecordReader(((FileSplit) split).getPath());
}
}


static class Map extends MapReduceBase implements
Mapper<WritableComparable, Writable, BytesWritable, BytesWritable> {


private long numBytesToWrite;
private int minKeySize;
private int keySizeRange;
private int minValueSize;
private int valueSizeRange;
private Random random = new Random();
private BytesWritable randomKey = new BytesWritable();
private BytesWritable randomValue = new BytesWritable();


private void randomizeBytes(byte[] data, int offset, int length) {
for (int i = offset + length - 1; i >= offset; --i) {
data[i] = (byte) random.nextInt(256);
}
}


/**
* Given an output filename, write a bunch of random records to it.
*/
public void map(WritableComparable key, Writable value,
OutputCollector<BytesWritable, BytesWritable> output,
Reporter reporter) throws IOException {
int itemCount = 0;
while (numBytesToWrite > 0) {
int keyLength = minKeySize
+ (keySizeRange != 0 ? random.nextInt(keySizeRange) : 0);
randomKey.setSize(keyLength);
randomizeBytes(randomKey.getBytes(), 0, randomKey.getLength());
int valueLength = minValueSize
+ (valueSizeRange != 0 ? random.nextInt(valueSizeRange)
: 0);
randomValue.setSize(valueLength);
randomizeBytes(randomValue.getBytes(), 0,
randomValue.getLength());
output.collect(randomKey, randomValue);
numBytesToWrite -= keyLength + valueLength;
reporter.incrCounter(Counters.BYTES_WRITTEN, keyLength
+ valueLength);
reporter.incrCounter(Counters.RECORDS_WRITTEN, 1);
if (++itemCount % 200 == 0) {
reporter.setStatus("wrote record " + itemCount + ". "
+ numBytesToWrite + " bytes left.");
}
}
reporter.setStatus("done with " + itemCount + " records.");
}


/**
* Save the values out of the configuaration that we need to write the
* data.
*/
@Override

public void configure(JobConf job) {

                        /*当个Map写的字节数  变量读能见名知意**/

numBytesToWrite = job.getLong("test.randomwrite.bytes_per_map",
1 * 1024 * 1024 * 20);
minKeySize = job.getInt("test.randomwrite.min_key", 100);
keySizeRange = job.getInt("test.randomwrite.max_key", 1000)
- minKeySize;
minValueSize = job.getInt("test.randomwrite.min_value", 0);
valueSizeRange = job.getInt("test.randomwrite.max_value", 20000)
- minValueSize;
}


}


/**
* This is the main routine for launching a distributed random write job. It
* runs 10 maps/node and each node writes 1 gig of data to a DFS file. The
* reduce doesn't do anything.
* 
* @throws IOException
*/
public int run(String[] args) throws Exception {
if (args.length == 0) {
System.out.println("Usage: writer <out-dir>");
ToolRunner.printGenericCommandUsage(System.out);
return -1;
}


Path outDir = new Path(args[0]);
JobConf job = new JobConf(getConf());


job.setJarByClass(RandomWriter.class);
job.setJobName("random-writer");
FileOutputFormat.setOutputPath(job, outDir);


job.setOutputKeyClass(BytesWritable.class);

job.setOutputValueClass(BytesWritable.class);

                /* 此处设置输入类型*/

job.setInputFormat(RandomInputFormat.class);
job.setMapperClass(Map.class);

job.setReducerClass(IdentityReducer.class);

                /**设置输出类型 此处要修改的话 前面那个randomKey类型也需要修改 **/

job.setOutputFormat(SequenceFileOutputFormat.class);


JobClient client = new JobClient(job);
ClusterStatus cluster = client.getClusterStatus();
/** 如果属性不存在 则返回默认的值 **/
int numMapsPerHost = job.getInt("test.randomwriter.maps_per_host", 10);
long numBytesToWritePerMap = job.getLong(
"test.randomwrite.bytes_per_map", 1 * 1024 * 1024 * 1024);
if (numBytesToWritePerMap == 0) {
System.err
.println("Cannot have test.randomwrite.bytes_per_map set to 0");
return -2;
}
long totalBytesToWrite = job.getLong(
"test.randomwrite.total_bytes",
numMapsPerHost * numBytesToWritePerMap
* cluster.getTaskTrackers());
int numMaps = (int) (totalBytesToWrite / numBytesToWritePerMap);
if (numMaps == 0 && totalBytesToWrite > 0) {
numMaps = 1;
job.setLong("test.randomwrite.bytes_per_map", totalBytesToWrite);
}


job.setNumMapTasks(numMaps);/** 建议型的 **/
System.out.println("Running " + numMaps + " maps.");


// reducer NONE
job.setNumReduceTasks(0);


Date startTime = new Date();
System.out.println("Job started: " + startTime);
JobClient.runJob(job);
Date endTime = new Date();
System.out.println("Job ended: " + endTime);
System.out.println("The job took "
+ (endTime.getTime() - startTime.getTime()) / 1000
+ " seconds.");


return 0;
}


public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new RandomWriter(), args);
System.exit(res);
}


}


输出:

Running 10 maps.
Job started: Wed Apr 10 22:41:10 CST 2013
13/04/10 22:41:10 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
numMaps-------10
13/04/10 22:41:11 INFO mapred.JobClient: Running job: job_local_0001
13/04/10 22:41:11 INFO util.ProcessTree: setsid exited with exit code 0
13/04/10 22:41:11 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@28bd68
13/04/10 22:41:11 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:12 INFO mapred.JobClient:  map 0% reduce 0%
13/04/10 22:41:13 INFO mapred.Task: Task:attempt_local_0001_m_000000_0 is done. And is in the process of commiting
13/04/10 22:41:13 INFO mapred.LocalJobRunner: 
13/04/10 22:41:13 INFO mapred.Task: Task attempt_local_0001_m_000000_0 is allowed to commit now
13/04/10 22:41:14 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000000_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:14 INFO mapred.LocalJobRunner: done with 1987 records.
13/04/10 22:41:14 INFO mapred.Task: Task 'attempt_local_0001_m_000000_0' done.
13/04/10 22:41:14 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@209661
13/04/10 22:41:14 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:15 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:18 INFO mapred.Task: Task:attempt_local_0001_m_000001_0 is done. And is in the process of commiting
13/04/10 22:41:18 INFO mapred.LocalJobRunner: 
13/04/10 22:41:18 INFO mapred.Task: Task attempt_local_0001_m_000001_0 is allowed to commit now
13/04/10 22:41:18 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000001_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:19 INFO mapred.JobClient:  map 50% reduce 0%
13/04/10 22:41:20 INFO mapred.LocalJobRunner: done with 2038 records.
13/04/10 22:41:20 INFO mapred.LocalJobRunner: done with 2038 records.
13/04/10 22:41:20 INFO mapred.Task: Task 'attempt_local_0001_m_000001_0' done.
13/04/10 22:41:20 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@1f2b5c
13/04/10 22:41:20 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:21 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:22 INFO mapred.Task: Task:attempt_local_0001_m_000002_0 is done. And is in the process of commiting
13/04/10 22:41:22 INFO mapred.LocalJobRunner: 
13/04/10 22:41:22 INFO mapred.Task: Task attempt_local_0001_m_000002_0 is allowed to commit now
13/04/10 22:41:22 INFO mapred.JobClient:  map 66% reduce 0%
13/04/10 22:41:22 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000002_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:23 INFO mapred.LocalJobRunner: done with 1988 records.
13/04/10 22:41:23 INFO mapred.Task: Task 'attempt_local_0001_m_000002_0' done.
13/04/10 22:41:23 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@195804b
13/04/10 22:41:23 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:24 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:27 INFO mapred.Task: Task:attempt_local_0001_m_000003_0 is done. And is in the process of commiting
13/04/10 22:41:27 INFO mapred.LocalJobRunner: 
13/04/10 22:41:27 INFO mapred.Task: Task attempt_local_0001_m_000003_0 is allowed to commit now
13/04/10 22:41:27 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000003_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:28 INFO mapred.JobClient:  map 75% reduce 0%
13/04/10 22:41:29 INFO mapred.LocalJobRunner: done with 2003 records.
13/04/10 22:41:29 INFO mapred.LocalJobRunner: done with 2003 records.
13/04/10 22:41:29 INFO mapred.Task: Task 'attempt_local_0001_m_000003_0' done.
13/04/10 22:41:29 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@9ee241
13/04/10 22:41:29 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:30 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:32 INFO mapred.Task: Task:attempt_local_0001_m_000004_0 is done. And is in the process of commiting
13/04/10 22:41:32 INFO mapred.LocalJobRunner: 
13/04/10 22:41:32 INFO mapred.Task: Task attempt_local_0001_m_000004_0 is allowed to commit now
13/04/10 22:41:32 INFO mapred.JobClient:  map 80% reduce 0%
13/04/10 22:41:32 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000004_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:32 INFO mapred.LocalJobRunner: done with 1961 records.
13/04/10 22:41:32 INFO mapred.Task: Task 'attempt_local_0001_m_000004_0' done.
13/04/10 22:41:32 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@10ef227
13/04/10 22:41:32 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:33 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:34 INFO mapred.Task: Task:attempt_local_0001_m_000005_0 is done. And is in the process of commiting
13/04/10 22:41:34 INFO mapred.LocalJobRunner: 
13/04/10 22:41:34 INFO mapred.Task: Task attempt_local_0001_m_000005_0 is allowed to commit now
13/04/10 22:41:35 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000005_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:35 INFO mapred.JobClient:  map 83% reduce 0%
13/04/10 22:41:35 INFO mapred.LocalJobRunner: done with 1984 records.
13/04/10 22:41:35 INFO mapred.Task: Task 'attempt_local_0001_m_000005_0' done.
13/04/10 22:41:35 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@1b647b9
13/04/10 22:41:35 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:36 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:38 INFO mapred.Task: Task:attempt_local_0001_m_000006_0 is done. And is in the process of commiting
13/04/10 22:41:38 INFO mapred.LocalJobRunner: 
13/04/10 22:41:38 INFO mapred.Task: Task attempt_local_0001_m_000006_0 is allowed to commit now
13/04/10 22:41:38 INFO mapred.JobClient:  map 85% reduce 0%
13/04/10 22:41:38 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000006_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:38 INFO mapred.LocalJobRunner: done with 1980 records.
13/04/10 22:41:38 INFO mapred.Task: Task 'attempt_local_0001_m_000006_0' done.
13/04/10 22:41:38 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@730333
13/04/10 22:41:38 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:39 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:40 INFO mapred.Task: Task:attempt_local_0001_m_000007_0 is done. And is in the process of commiting
13/04/10 22:41:40 INFO mapred.LocalJobRunner: 
13/04/10 22:41:40 INFO mapred.Task: Task attempt_local_0001_m_000007_0 is allowed to commit now
13/04/10 22:41:41 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000007_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:41 INFO mapred.JobClient:  map 87% reduce 0%
13/04/10 22:41:41 INFO mapred.LocalJobRunner: done with 1992 records.
13/04/10 22:41:41 INFO mapred.Task: Task 'attempt_local_0001_m_000007_0' done.
13/04/10 22:41:41 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@890800
13/04/10 22:41:41 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:42 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:45 INFO mapred.Task: Task:attempt_local_0001_m_000008_0 is done. And is in the process of commiting
13/04/10 22:41:45 INFO mapred.LocalJobRunner: 
13/04/10 22:41:45 INFO mapred.Task: Task attempt_local_0001_m_000008_0 is allowed to commit now
13/04/10 22:41:46 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000008_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:46 INFO mapred.JobClient:  map 88% reduce 0%
13/04/10 22:41:47 INFO mapred.LocalJobRunner: done with 1999 records.
13/04/10 22:41:47 INFO mapred.LocalJobRunner: done with 1999 records.
13/04/10 22:41:47 INFO mapred.Task: Task 'attempt_local_0001_m_000008_0' done.
13/04/10 22:41:47 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@36f7a0
13/04/10 22:41:47 INFO mapred.MapTask: numReduceTasks: 0
13/04/10 22:41:48 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:49 INFO mapred.Task: Task:attempt_local_0001_m_000009_0 is done. And is in the process of commiting
13/04/10 22:41:50 INFO mapred.LocalJobRunner: 
13/04/10 22:41:50 INFO mapred.Task: Task attempt_local_0001_m_000009_0 is allowed to commit now
13/04/10 22:41:50 INFO mapred.FileOutputCommitter: Saved output of task 'attempt_local_0001_m_000009_0' to hdfs://localhost:49002/user/hadoop/output
13/04/10 22:41:50 INFO mapred.JobClient:  map 89% reduce 0%
13/04/10 22:41:50 INFO mapred.LocalJobRunner: done with 2025 records.
13/04/10 22:41:50 INFO mapred.Task: Task 'attempt_local_0001_m_000009_0' done.
13/04/10 22:41:51 INFO mapred.JobClient:  map 100% reduce 0%
13/04/10 22:41:51 INFO mapred.JobClient: Job complete: job_local_0001
13/04/10 22:41:51 INFO mapred.JobClient: Counters: 16
13/04/10 22:41:51 INFO mapred.JobClient:   File Input Format Counters 
13/04/10 22:41:51 INFO mapred.JobClient:     Bytes Read=0
13/04/10 22:41:51 INFO mapred.JobClient:   File Output Format Counters 
13/04/10 22:41:51 INFO mapred.JobClient:     Bytes Written=210459071
13/04/10 22:41:51 INFO mapred.JobClient:   org.apache.hadoop.examples.RandomWriter$Counters
13/04/10 22:41:51 INFO mapred.JobClient:     BYTES_WRITTEN=209767059
13/04/10 22:41:51 INFO mapred.JobClient:     RECORDS_WRITTEN=19957
13/04/10 22:41:51 INFO mapred.JobClient:   FileSystemCounters
13/04/10 22:41:51 INFO mapred.JobClient:     FILE_BYTES_READ=2382785
13/04/10 22:41:51 INFO mapred.JobClient:     FILE_BYTES_WRITTEN=2782330
13/04/10 22:41:51 INFO mapred.JobClient:     HDFS_BYTES_WRITTEN=1157478956
13/04/10 22:41:51 INFO mapred.JobClient:   Map-Reduce Framework
13/04/10 22:41:51 INFO mapred.JobClient:     Map input records=10
13/04/10 22:41:51 INFO mapred.JobClient:     Physical memory (bytes) snapshot=0
13/04/10 22:41:51 INFO mapred.JobClient:     Spilled Records=0
13/04/10 22:41:51 INFO mapred.JobClient:     CPU time spent (ms)=0
13/04/10 22:41:51 INFO mapred.JobClient:     Total committed heap usage (bytes)=356450304
13/04/10 22:41:51 INFO mapred.JobClient:     Virtual memory (bytes) snapshot=0
13/04/10 22:41:51 INFO mapred.JobClient:     Map input bytes=0
13/04/10 22:41:51 INFO mapred.JobClient:     Map output records=19957
13/04/10 22:41:51 INFO mapred.JobClient:     SPLIT_RAW_BYTES=1080
Job ended: Wed Apr 10 22:41:51 CST 2013
The job took 41 seconds.

绿标短网址app.10086.cn/xxxxx移动短网址缩短接口网址api调用php方式解析 绿标短网址app.10086.cn/xxxxx 移动网缩短接口网址api调用php方式解析 app.10086.cn是移动网站的接口,可以制作移动网等第三方官方网站域名的任意生成接口,由于是认证企业,可以再抖音 微信 qq等第三方渠道正常打开不拦截提示,第三方网址,头条文章等,效果非常号,这里记录下api接口,纯技术php生成,具体规则可以去抖音的开放平台去申请对应接口 。这里用我php模拟抓包获取方式 GET http://www.app10086cn.cn/?i=app.10068.cnHTTP/1.1 阅读详情

相关推荐

Unidbg逆向阿里系App签名:从环境补全到算法还原实战

在移动安全与协议分析领域,理解应用层签名机制是核心挑战之一。签名算法作为保障通信安全与身份验证的关键技术,其原理通常涉及哈希、加密及密钥协商等基础密码学概念。在Android平台,核心签名逻辑常被加固并隐藏于Native层SO库中,以对抗动态调试与静态分析,这为安全研究和协议兼容带来了技术障碍。Unidbg作为一种基于模拟执行的逆向工程工具,通过模拟ARM指令集和系统调用,允许研究者在脱离真机环境的情况下,可控地执行和调试SO文件,为解决此类问题提供了创新思路。其技术价值在于实现了对加固代码的确定性分析与算

weixin_42525738的博客 937

Hadoop集群测试

hadoop集群

ZYF2190003497的博客 863

GT-suite v2016的下载和安装

1 写在前面 GT-suite 是一款用来做内燃机仿真的软件。在安装过程中遇到很多问题,网上的安装教程也大都抄来抄去,试着安装了几遍都没有成功。最终在贴吧一个老哥的帖子里找到了解决办法,但是老哥的帖子也不是很详细,所以做了这个详细版本的教程。 GT-suite v2016安装包: 链接:https://pan.baidu.com/s/1JZPgJ8_-J-L8rV84-eHedQ 提取码:uj...

kisssshot的博客 2万+

hadoop实例 RandomWriter

参考文献:http://www.hadooper.cn/dct/page/65778 1.概述 RandomWriter(随机写)例子利用 Map/Reduce把 数据随机的写到dfs中。每个map输入单个文件名,然后随机写BytesWritable的键和值到DFS顺序文件。map没有产生任何输出,所以reduce没有执行。产生的数据是可以配置的。配置变量如下 名...

weixin_34344677的博客 199

【100%通过率】华为od统一考试B卷【需要打开多少监视器】JAVA&Go 实现

某长方形停车场,每个车位上方都有对应监控器,当且仅当在当前车位或者前后左右四个方向任意一个车位范围停车时,监控器才需要打开:给出某一时刻停车场的停车分布,请统计最少需要打开多少个监控器

MISAYAONE的博客 1万+

uniapp(全端兼容) - 超详细接入百度统计功能,给uniapp全平台各端项目引入添加百度统计的插件统计流量详细的步骤教程(提供最新的百度统计源代码,详细的示例代码复制粘贴即可快速搞定!)

uniapp h5 app 使用加入接入百度统计,uniapp百度统计,uniapp详细引入百度统计的教程,uniapp接入百度统计,uniapp如何实现加入百度的统计代码,uniapp怎么植入百度统计详细教程,uniapp如何对接百度统计,uniapp百度统计不生效怎么办,uniapp使用百度统计不生效常见问题,uniapp引入百度统计后没有生效,uniapp h5网页接入百度统计代码后没有统计无效,uniapp最新接入使用百度统计功能,uniapp增加百度统计代码,uniapp app如何接入百度统计,

✅ 精选推荐文章 1万+

Hadoop实例RandomWriter

RandomWriter(随机写)例子利用 Map/Reduce把 数据随机的写到dfs中。每个map输入单个文件名,然后随机写BytesWritable的键和值到DFS顺序文件。map没有产生任何输出,所以reduce没有执行。产生的数据是可以配置的。配置变量如下 名字 默认值 描述 test.randomwrite...

YUSDook的博客 769

《备考系统分析师》 - 专栏介绍和目录

本专栏提供软考高级系统分析师全套备考资料,包含四大核心内容:1.详细考点梳理(覆盖基础知识、关键技术、案例实践三大模块16个章节);2.历年真题及解析(2009-2022年所有真题含综合知识、案例分析和论文);3.100+篇高质量论文范文;4.预测模拟题。早鸟价仅需9.9元,可节约80%资料搜集时间,帮助考生高效备考、顺利通过考试。专栏持续更新,有问题可随时联系作者。

数据知道的博客 1万+

RandomWriter代码注释

package org.apache.hadoop.examples; import java.io.IOException; import java.util.Date; import java.util.Random; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Conf...

liguangyuanyinli的博客 229

【深度学习新浪潮】近三年垂域大模型研究与产品进展全景洞察(2022-2025)

近三年来,垂域大模型完成了从技术探索到产业落地的关键跨越,在多个行业实现效率提升与价值创造。面对数据治理、技术适配、生态建设等挑战,未来需要通过技术创新、标准制定、人才培养等多维度发力,推动垂域大模型向更高效、更可靠、更普惠的方向发展。随着"人工智能+"行动的深入推进,垂域大模型将成为数字经济与实体经济深度融合的核心驱动力,为产业智能化升级注入持续动能。

专注:太空算力、AI infra、异构调度、大模型成本工程 786

YOLO系列算法改进 | C3k2改进篇 | 融合DEConv细节增强卷积模块 | 细节增强+多分支差分卷积融合,标准卷积的完美涨点替代! | TIP 2024

YOLO系列算法改进 | C3k2改进篇 | 融合DEConv细节增强卷积模块 | 细节增强+多分支差分卷积融合,标准卷积的完美涨点替代! | TIP 2024 (以YOLO26最新目标检测模型为基础,融合C3k2_DEConv创新模块进行改进)

2502_91881744的博客 310

【大数据之Hadoop】三十五、Hadoop综合调优之测试MapReduce计算性能(压测)

使用Sort程序评测MapReduce。(3)验证数据是否真正排好序了。

阿宁的博客 394

HTML5+CSS3+JS小实例:扇形展开折叠菜单

你肯定见过那种圆形浮动按钮(FAB),点一下弹出几个选项。大部分实现就是菜单项从底下往上"弹"出来,排成一列——能用,但没啥记忆点。后来我看到 Path 那个经典的扇形菜单,点一下,五个按钮像花瓣一样从中心散开,每个带不同的延迟和弹性曲线。当时就觉得:这才对嘛,交互就该有点"戏剧性"。今天拆一个纯手写版本,HTML + CSS + JS,不依赖任何库。六菜单项、扇形 144° 展开、弹性过渡、点击关闭、键盘可达——该有的都有。

艾恩小灰灰的博客 164

Hadoop集群搭建完毕后,如何测试是否正常工作?

最近,要在沙箱的环境装一个hadoop的集群,用来建索引所需,装hadoop已经没啥难的了,后面,散仙会把重要的配置信息,贴出来,本次装的hadoop版本是hadoop1.2的版本,如果不知道怎么装的,可以参考[url=http://qindongliang.iteye.com/blog/1964852]这篇文章[/url],安装的具体步骤,散仙在这里不在重述,重点在于hadoop-nd,hado...

三劫散仙 3443

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Hadoop性能测试

向HDFS集群写10个128M文件 hadoop jar /opt/module/hadoop-2-7-2/share/hadoop/mapreduce/hadoop-mapreduce-client-jobclient-2.7.2-tests.jar TestDFSIO -write -nrFiles 10 -fileSize 128MB 测试读 hadoop jar /opt/module/...

qq_29220057的博客 299

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

磁盘测试2

2.测试的定义   Write: 测试向一个新文件写入的性能。当一个新文件被写入时,不仅仅是那些文件中的数据需要被存储,还包括那些用于定位数据存储在存储介质的具体位置的额外信息。这些额外信息被称作“元数据”。它包括目录信息,所分配的空间和一些与该文件有关但又并非该文件所含数据的其他数据。拜这些额外信息所赐,Write的性能通常会比Re-write的性能低。   Re-write: 测试向一个已

cybertan的专栏 1906

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Hypertable工具之random_write_test、random_read_test、ht_write_test、csvalidate

1. random_write_test 命令: random_write_test  [options]   该命令用于测试hypertable的写入速度。它将产生随机数据插入到表RandomTest中,插入数据的value总长度为total-bytes。RandomTest表必须提前创建于namespace”/”下,并且只有一个名称为Field的CF。产生的row和value都是随机的AS

程序人生 2723

1.生产集群读写测试50g数据randomwriter

生产硬件规格 浪潮:20核,128G,10.98TB 浪潮:20核,128G,10.98TB 浪潮:20核,128G,10.98TB 浪潮:20核,128G,10.98TB 浪潮:20核,128G,10.98TB 引用1.测试集群 http://note.youdao.com/noteshare?id=3332b5f14230918c41f084a1524a7a03&sub=...

kk25114的博客 395

SSD存储知识(四)----性能指标

一文了解SSD存储常见性能指标

weixin_43590629的博客 7775

C++里面亲测有效的random write 一个文件的方法

  废话不多说了,确实要写得很正确才行,不然就会弄成overwrite的效果了,我用的是ofstream来实现的,主要要注意的就是要在模式里面指定好in和out和binary: string random_access_file = "I:/test_random.txt"; ofstream random_write_file(random_access_file.c_str...

weixin_30567471的博客 364

运行基准测试hadoop

hadoop的发行版本中附带了几个基准测试,可以用来验证hadoop以及评估hadoop的性能。以运行排序基准为例,首先我们使用hadoop作业randomwrite生成一些随机数,然后使用排序实例对它进行排序。 1.命令hadoop@master:/usr/hadoop$ hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples

scalad 1758

关于SSD与hard disk的性能对比(浅学)

** 关于SSD与hard disk的性能对比(浅学) 1.random read SSD的random read是可以较快的找到对应位置进行随机读操作,而hard disk则是需要有一个seek time ,这个seek time所需要的时间大概是10ms,而SSD所需时间大概是100us,所以SSD对于random read操作大概比hard disk快了100倍。 2.random write SSD的random write速度大概比random read慢上一倍,这是由于SSD的硬件特性所决定的。

CCQDDQ的博客 1518

hadoop基准测试

一、测试条件 集群完全安装配置后,应立即开始基准测试。基准测试时集群里不应该运行其他一切任务。 二、测试目标 1. 硬盘故障:新系统最常见的故障。可以通过运行高强度的IO基准测试程序集中测试。例如TestDFSIO 2. MapReduce的性能 三、测试方法 1、TestDFSIO基准测试HDFS 测试顺序应该是先写测试后读测试 写测试: 使用10个map任务写10个文件

鹏的空间 1594

random_WriteUp(pwnable.kr_random)C语言伪随机数

random_WriteUp(pwnable.kr_random)C语言伪随机数 本题考察的是伪随机数 伪随机数是用确定性的算法计算出来自[0,1]均匀分布的随机数序列。并不真正的随机,但具有类似于随机数的统计特征,如均匀性、独立性等。在计算伪随机数时,若使用的初值(种子)不变,那么伪随机数的数序也不变。伪随机数可以用计算机大量生成,在模拟研究中为了提高模拟效率,一般采用伪随机数...

Hvnt3r的博客 458

翻译:How to Benchmark a Hadoop Cluster

[b]How to Benchmark a Hadoop Cluster[/b] [b]如何检测你的Hadoop集群性能?[/b] 比较早的一篇文章了,有些可能翻译的不是很顺,比如Benchmark这个词就比较晕,姑且理解为性能吧,原文地址: [url]http://answers.oreilly.com/topic/460-how-to-benchmark-a-hadoop-clu...

wwwcomy的程序猿感悟 226
上一篇: 如何查看本机电脑flash的版本
下一篇: 基于指定数组大小的切割字符串(java字符串分割性能比较)
heipacker
博客等级 码龄17年 9粉丝 52原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值