You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cm...@apache.org on 2014/10/07 20:56:39 UTC
git commit: HDFS-7186. Document the "hadoop trace" command. (Masatake
Iwasaki via Colin P. McCabe)
Repository: hadoop
Updated Branches:
refs/heads/trunk 2e789eb22 -> 9196db9a0
HDFS-7186. Document the "hadoop trace" command. (Masatake Iwasaki via Colin P. McCabe)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9196db9a
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9196db9a
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9196db9a
Branch: refs/heads/trunk
Commit: 9196db9a080b96b9022c424d70f59811e67570a6
Parents: 2e789eb
Author: Colin Patrick Mccabe <cm...@cloudera.com>
Authored: Tue Oct 7 11:55:49 2014 -0700
Committer: Colin Patrick Mccabe <cm...@cloudera.com>
Committed: Tue Oct 7 11:56:30 2014 -0700
----------------------------------------------------------------------
hadoop-common-project/hadoop-common/CHANGES.txt | 3 +
.../hadoop-common/src/site/apt/Tracing.apt.vm | 75 ++++++++++++++++----
2 files changed, 66 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/9196db9a/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index c36d497..64edcb7 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -350,6 +350,9 @@ Release 2.7.0 - UNRELEASED
HADOOP-11156. DelegateToFileSystem should implement
getFsStatus(final Path f). (Zhihai Xu via wang)
+ HDFS-7186. Document the "hadoop trace" command. (Masatake Iwasaki via Colin
+ P. McCabe)
+
OPTIMIZATIONS
BUG FIXES
http://git-wip-us.apache.org/repos/asf/hadoop/blob/9196db9a/hadoop-common-project/hadoop-common/src/site/apt/Tracing.apt.vm
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/site/apt/Tracing.apt.vm b/hadoop-common-project/hadoop-common/src/site/apt/Tracing.apt.vm
index f777dd2..31c2516 100644
--- a/hadoop-common-project/hadoop-common/src/site/apt/Tracing.apt.vm
+++ b/hadoop-common-project/hadoop-common/src/site/apt/Tracing.apt.vm
@@ -46,21 +46,32 @@ public void receiveSpan(Span span);
+----
<property>
- <name>hadoop.trace.spanreceiver.classes</name>
+ <name>hadoop.htrace.spanreceiver.classes</name>
<value>org.htrace.impl.LocalFileSpanReceiver</value>
</property>
<property>
- <name>hadoop.local-file-span-receiver.path</name>
+ <name>hadoop.htrace.local-file-span-receiver.path</name>
<value>/var/log/hadoop/htrace.out</value>
</property>
+----
+ You can omit package name prefix if you use span receiver bundled with HTrace.
+
++----
+ <property>
+ <name>hadoop.htrace.spanreceiver.classes</name>
+ <value>LocalFileSpanReceiver</value>
+ </property>
++----
+
+
+
** Setting up ZipkinSpanReceiver
Instead of implementing SpanReceiver by yourself,
you can use <<<ZipkinSpanReceiver>>> which uses
{{{https://github.com/twitter/zipkin}Zipkin}}
- for collecting and dispalying tracing data.
+ for collecting and displaying tracing data.
In order to use <<<ZipkinSpanReceiver>>>,
you need to download and setup {{{https://github.com/twitter/zipkin}Zipkin}} first.
@@ -82,22 +93,63 @@ public void receiveSpan(Span span);
+----
<property>
- <name>hadoop.trace.spanreceiver.classes</name>
- <value>org.htrace.impl.ZipkinSpanReceiver</value>
+ <name>hadoop.htrace.spanreceiver.classes</name>
+ <value>ZipkinSpanReceiver</value>
</property>
<property>
- <name>hadoop.zipkin.collector-hostname</name>
+ <name>hadoop.htrace.zipkin.collector-hostname</name>
<value>192.168.1.2</value>
</property>
<property>
- <name>hadoop.zipkin.collector-port</name>
+ <name>hadoop.htrace.zipkin.collector-port</name>
<value>9410</value>
</property>
+----
-** Turning on tracing by HTrace API
- In order to turn on Dapper-like tracing,
+** Dynamic update of tracing configuration
+
+ You can use <<<hadoop trace>>> command to see and update the tracing configuration of each servers.
+ You must specify IPC server address of namenode or datanode by <<<-host>>> option.
+ You need to run the command against all servers if you want to update the configuration of all servers.
+
+ <<<hadoop trace -list>>> shows list of loaded span receivers associated with the id.
+
++----
+ $ hadoop trace -list -host 192.168.56.2:9000
+ ID CLASS
+ 1 org.htrace.impl.LocalFileSpanReceiver
+
+ $ hadoop trace -list -host 192.168.56.2:50020
+ ID CLASS
+ 1 org.htrace.impl.LocalFileSpanReceiver
++----
+
+ <<<hadoop trace -remove>>> removes span receiver from server.
+ <<<-remove>>> options takes id of span receiver as argument.
+
++----
+ $ hadoop trace -remove 1 -host 192.168.56.2:9000
+ Removed trace span receiver 1
++----
+
+ <<<hadoop trace -add>>> adds span receiver to server.
+ You need to specify the class name of span receiver as argument of <<<-class>>> option.
+ You can specify the configuration associated with span receiver by <<<-Ckey=value>>> options.
+
++----
+ $ hadoop trace -add -class LocalFileSpanReceiver -Chadoop.htrace.local-file-span-receiver.path=/tmp/htrace.out -host 192.168.56.2:9000
+ Added trace span receiver 2 with configuration hadoop.htrace.local-file-span-receiver.path = /tmp/htrace.out
+
+ $ hadoop trace -list -host 192.168.56.2:9000
+ ID CLASS
+ 2 org.htrace.impl.LocalFileSpanReceiver
++----
+
+
+** Starting tracing spans by HTrace API
+
+ In order to trace,
you will need to wrap the traced logic with <<tracing span>> as shown below.
When there is running tracing spans,
the tracing information is propagated to servers along with RPC requests.
@@ -133,7 +185,6 @@ import org.htrace.TraceScope;
+----
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FsShell;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.tracing.SpanReceiverHost;
import org.apache.hadoop.util.ToolRunner;
import org.htrace.Sampler;
@@ -146,8 +197,8 @@ public class TracingFsShell {
FsShell shell = new FsShell();
conf.setQuietMode(false);
shell.setConf(conf);
+ SpanReceiverHost.getInstance(conf);
int res = 0;
- SpanReceiverHost.init(new HdfsConfiguration());
TraceScope ts = null;
try {
ts = Trace.startSpan("FsShell", Sampler.ALWAYS);
@@ -165,5 +216,5 @@ public class TracingFsShell {
+----
$ javac -cp `hadoop classpath` TracingFsShell.java
-$ HADOOP_CLASSPATH=. hdfs TracingFsShell -put sample.txt /tmp/
+$ java -cp .:`hadoop classpath` TracingFsShell -ls /
+----