気まぐれな備忘録(仮)

いちようSEしてるので、プログラミングの備忘録的なものを書いてます

なぜMapReduceでToolRunnerを使うのか

つい先日、気になったこと。

というのも、自分がMapReduceジョブを実装するときは、
直接Jobを実装するので事足りており、
ToolRunnerを使ったことがなかったから。


ということで、CDH3u3のソースコードを調べてみた。

org.apache.hadoop.util.ToolRunner

  public static int run(Tool tool, String[] args) 
    throws Exception{
    return run(tool.getConf(), tool, args);
  }
  public static int run(Configuration conf, Tool tool, String[] args) 
    throws Exception{
    if(conf == null) {
      conf = new Configuration();
    }
    GenericOptionsParser parser = new GenericOptionsParser(conf, args);
    //set the configuration back, so that Tool can configure itself
    tool.setConf(conf);
    
    //get the args w/o generic hadoop args
    String[] toolArgs = parser.getRemainingArgs();
    return tool.run(toolArgs);
  }

どうやら、ToolRunnerは
GenericOptionsParserを仕掛けてくれるだけらしい。

細かいこというと、
引数読み込んだ後のConfigurationの設定もしているが。


ToolRunnerを使用しない場合は、
GenericOptionsParserによるパースを自分で呼び出したうえで、
Jobオブジェクトを生成する必要がある。

これだけ聞くとToolRunner使う方が便利そうだが、
ToolRunnerを使う場合、
MapReduceジョブはToolインタフェースを実装する必要がある。

このToolインタフェースを実装するには、
ジョブを実行するrun()メソッド以外にも、
Toolインタフェースの親であるConfigurableのメソッド(getConfとsetConf)
も併せて実装する必要がある。
大したことではないが、手間はかかる。


結局のところ、どちらを使うべき、というものはないと思うが、
個人的には、ToolRunnerは使わず、
GenericOptionsParserを自前で呼び出す方が好み。

というのも、ToolRunnerを使う場合
誰も使用しないConfigurableのメソッド(getConfとsetConf)
を実装する必要があり、
個人的に、使わないメソッドを実装するのはイヤだから。


もちろん、ToolRunnerを使わない場合も注意点はある。

GenericOptionsParserにより、
引数の情報を読み込んだConfigurationオブジェクトを使って、
Jobを生成するようにする必要がある。


どっちのやり方でするにしても、面倒さは変わらない。。。

cdh3u3もeclipseにインポートしてみた

cdh3u3もリリースされた、ということで、
さっそく前回と同様にcdh3u3のソースコードeclipseにインポートしてみる。

まずは、ソースコードclouderaのページからDL.

今回の対象はこちら。なお、豚君のことについては触れてはいけない

  • hadoop-0.20.2-cdh3u3.tar.gz
  • hbase-0.90.4-cdh3u3.tar.gz
  • flume-0.9.4-cdh3u3.tar.gz
  • hive-0.7.1-cdh3u3.tar.gz

hadoop-0.20.2-cdh3u3.tar.gzを解凍するとわかるのだが、
今回はなんと解凍後の「hadoop-0.20.2-cdh3u3/.eclipse.templates」ディレクトリ直下に
eclipseプロジェクト用のテンプレートが既に用意してある!

せっかくなので、これを使用することにする。
上記ディレクトリ配下の「.project」と「.classpath」を
hadoop-0.20.2-cdh3u3」ディレクトリにコピーする。

「.classpath」の中身を見るとわかるのだが、
クラスパスのディレクトリ構成がivyを利用した構成になっている。
オイラはお古な人間なのでivyなんて使ったことねぇ、ということで、
「.classpath」の構成を以下のように編集した。

  1. 「build/ivy/lib/Hadoop/common」→「lib」に置換
  2. 51行目の「」を削除

上記が終わってから、eclipseに既存プロジェクトとしてインポートする。
すると、環境によっては以下のようなエラーが出力される。

これは、eclipseにクラスパス変数「ANT_HOME」を設定していないため発生する現象。
こいつを設定してあげると、Fullビルドするかい?と聞いてくるので、どんなに嫌でも「Yes」を選択する。

すると、、、antが走り出して、mvnが叩かれる。


オイラの環境はmaven入れてないんだって。。。orz


ということで、やっぱあきらめて、ビルドパスを自力で構築することに。。。

以下はeclipseプロジェクトおよびclasspathの設定。
これを使えば、楽にeclipseにインポートできる。

hadoop-0.20.2-cdh3u3
「.project」

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>hadoop-0.20.2-cdh3u3</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
      <triggers>full,incremental,</triggers>
      <arguments>
        <dictionary>
          <key>LaunchConfigHandle</key>
          <value>&lt;project&gt;/.externalToolBuilders/Hadoop_Ant_Builder.launch</value>
        </dictionary>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>

「.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/core"/>
  <classpathentry kind="src" path="src/hdfs"/>
  <classpathentry kind="src" path="src/mapred"/>
  <classpathentry kind="src" path="src/tools"/>
  <classpathentry kind="src" path="src/examples"/>
  <classpathentry kind="src" path="src/contrib/streaming/src/java"/>
  <classpathentry kind="src" path="src/contrib/data_join/src/java"/>
  <classpathentry kind="src" path="src/contrib/data_join/src/examples"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/>
  <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
  <classpathentry kind="lib" path="lib/hsqldb-1.8.0.10.jar"/>
  <classpathentry kind="lib" path="lib/kfs-0.2.2.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1/jsp-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1/jsp-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-daemon-1.0.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-el-1.0.jar"/>
  <classpathentry kind="lib" path="lib/jasper-compiler-5.5.12.jar"/>
  <classpathentry kind="lib" path="lib/jasper-runtime-5.5.12.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-net-1.4.1.jar"/>
  <classpathentry kind="lib" path="lib/guava-r09-jarjar.jar"/>
  <classpathentry kind="lib" path="lib/jets3t-0.6.1.jar"/>
  <classpathentry kind="lib" path="lib/junit-4.5.jar"/>
  <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
  <classpathentry kind="lib" path="lib/mockito-all-1.8.2.jar"/>
  <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/>
  <classpathentry kind="lib" path="lib/jetty-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-util-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/jackson-core-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/core-3.1.1.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-api-1.4.3.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-log4j12-1.4.3.jar"/>
  <classpathentry kind="lib" path="lib/xmlenc-0.52.jar"/>
  <classpathentry kind="lib" path="lib/aspectjrt-1.6.5.jar"/>
  <classpathentry kind="lib" path="lib/aspectjtools-1.6.5.jar"/>
  <classpathentry kind="lib" path="src/test/lib/ftplet-api-1.0.0-SNAPSHOT.jar"/>
  <classpathentry kind="lib" path="src/test/lib/ftpserver-core-1.0.0-SNAPSHOT.jar"/>
  <classpathentry kind="lib" path="src/test/lib/ftpserver-server-1.0.0-SNAPSHOT.jar"/>
  <classpathentry kind="lib" path="src/test/lib/mina-core-2.0.0-M2-20080407.124109-12.jar"/>
  <classpathentry kind="output" path="build/eclipse-classes"/>
</classpath>


■hbase-0.90.4-cdh3u3
こちらは特にライブラリを追加することなく、mainならコンパイルできた。
馬君イイヤツ

「.project」

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>hbase-0.90.4-cdh3u3</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>

「.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/main/java"/>
  <classpathentry kind="src" path="src/examples/mapreduce"/>
  <classpathentry kind="lib" path="lib/activation-1.1.jar"/>
  <classpathentry kind="lib" path="lib/asm-3.1.jar"/>
  <classpathentry kind="lib" path="lib/avro-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/avro-ipc-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
  <classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-el-1.0.jar"/>
  <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-lang-2.5.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-net-1.4.1.jar"/>
  <classpathentry kind="lib" path="lib/core-3.1.1.jar"/>
  <classpathentry kind="lib" path="lib/guava-r06.jar"/>
  <classpathentry kind="lib" path="lib/guava-r09-jarjar.jar"/>
  <classpathentry kind="lib" path="lib/hadoop-core-0.20.2-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/jackson-core-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-jaxrs-1.5.5.jar"/>
  <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-xc-1.5.5.jar"/>
  <classpathentry kind="lib" path="lib/jamon-runtime-2.3.1.jar"/>
  <classpathentry kind="lib" path="lib/jasper-compiler-5.5.23.jar"/>
  <classpathentry kind="lib" path="lib/jasper-runtime-5.5.23.jar"/>
  <classpathentry kind="lib" path="lib/jaxb-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jaxb-impl-2.1.12.jar"/>
  <classpathentry kind="lib" path="lib/jersey-core-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jersey-json-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jersey-server-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jettison-1.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-6.1.26.jar"/>
  <classpathentry kind="lib" path="lib/jetty-util-6.1.26.jar"/>
  <classpathentry kind="lib" path="lib/jruby-complete-1.6.0.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/jsp-api-2.1-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/jsp-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar"/>
  <classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/>
  <classpathentry kind="lib" path="lib/netty-3.2.4.Final.jar"/>
  <classpathentry kind="lib" path="lib/protobuf-java-2.3.0.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-api-1.5.8.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-log4j12-1.5.8.jar"/>
  <classpathentry kind="lib" path="lib/snappy-java-1.0.3.2.jar"/>
  <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
  <classpathentry kind="lib" path="lib/thrift-0.2.0.jar"/>
  <classpathentry kind="lib" path="lib/velocity-1.5.jar"/>
  <classpathentry kind="lib" path="lib/xmlenc-0.52.jar"/>
  <classpathentry kind="lib" path="lib/zookeeper-3.3.4-cdh3u3.jar"/>
  <classpathentry kind="lib" path="hbase-0.90.4-cdh3u3.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="build/eclipse-classes"/>
</classpath>


■flume-0.9.4-cdh3u3
hbase-sink-pluginのビルドを通すには、hbase-0.90.4-cdh3u3.jarが必要。
それ以外ならmainなら追加のライブラリなしでコンパイルできる。
スバラシイ
以下、hbase-0.90.4-cdh3u3.jarをlibディレクトリ配下にコピーした構成。

「.project」

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>hbase-0.90.4-cdh3u3</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>

「.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/main/java"/>
  <classpathentry kind="src" path="src/examples/mapreduce"/>
  <classpathentry kind="lib" path="lib/activation-1.1.jar"/>
  <classpathentry kind="lib" path="lib/asm-3.1.jar"/>
  <classpathentry kind="lib" path="lib/avro-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/avro-ipc-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
  <classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-el-1.0.jar"/>
  <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-lang-2.5.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-net-1.4.1.jar"/>
  <classpathentry kind="lib" path="lib/core-3.1.1.jar"/>
  <classpathentry kind="lib" path="lib/guava-r06.jar"/>
  <classpathentry kind="lib" path="lib/guava-r09-jarjar.jar"/>
  <classpathentry kind="lib" path="lib/hadoop-core-0.20.2-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/jackson-core-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-jaxrs-1.5.5.jar"/>
  <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-xc-1.5.5.jar"/>
  <classpathentry kind="lib" path="lib/jamon-runtime-2.3.1.jar"/>
  <classpathentry kind="lib" path="lib/jasper-compiler-5.5.23.jar"/>
  <classpathentry kind="lib" path="lib/jasper-runtime-5.5.23.jar"/>
  <classpathentry kind="lib" path="lib/jaxb-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jaxb-impl-2.1.12.jar"/>
  <classpathentry kind="lib" path="lib/jersey-core-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jersey-json-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jersey-server-1.4.jar"/>
  <classpathentry kind="lib" path="lib/jettison-1.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-6.1.26.jar"/>
  <classpathentry kind="lib" path="lib/jetty-util-6.1.26.jar"/>
  <classpathentry kind="lib" path="lib/jruby-complete-1.6.0.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/jsp-api-2.1-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/jsp-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar"/>
  <classpathentry kind="lib" path="lib/log4j-1.2.16.jar"/>
  <classpathentry kind="lib" path="lib/netty-3.2.4.Final.jar"/>
  <classpathentry kind="lib" path="lib/protobuf-java-2.3.0.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-api-1.5.8.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-log4j12-1.5.8.jar"/>
  <classpathentry kind="lib" path="lib/snappy-java-1.0.3.2.jar"/>
  <classpathentry kind="lib" path="lib/stax-api-1.0.1.jar"/>
  <classpathentry kind="lib" path="lib/thrift-0.2.0.jar"/>
  <classpathentry kind="lib" path="lib/velocity-1.5.jar"/>
  <classpathentry kind="lib" path="lib/xmlenc-0.52.jar"/>
  <classpathentry kind="lib" path="lib/zookeeper-3.3.4-cdh3u3.jar"/>
  <classpathentry kind="lib" path="hbase-0.90.4-cdh3u3.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="build/eclipse-classes"/>
</classpath>


■hive-0.7.1-cdh3u3

マスコットの姿かたちのせいで嫌われているのか、よくわからんが、
コイツはやたらとライブラリが不足している。

まさかhadoopのjarすら含まれないとは思わなかった。。。

必要なjarは以下の通りで、これらは「hadoop-0.20.2-cdh3u3」からコピってくる。
コピり先はlibディレクトリ配下とする。

  • hadoop-core-0.20.2-cdh3u3.jar
  • hadoop-tools-0.20.2-cdh3u3.jar
  • servlet-api-2.5-6.1.14.jar
  • jetty-6.1.26.cloudera.1.jar
  • jetty-util-6.1.26.cloudera.1.jar

なお、これでもいくつかのmainのクラスはコンパイルエラーになったので、
ライブラリを探すのが面倒くさかったのでひとまずビルド対象外とした。

おそるべし、象面蜂め。。

「.project」

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>hive-0.7.1-cdh3u3</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>

「.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/common/src/java"/>
  <classpathentry kind="src" path="src/cli/src/java"/>
  <classpathentry kind="src" path="src/hwi/src/java"/>
  <classpathentry kind="src" path="src/jdbc/src/java"/>
  <classpathentry kind="src" path="src/hbase-handler/src/java"/>
  <classpathentry kind="src" path="src/contrib/src/java"/>
  <classpathentry kind="src" path="src/metastore/src/java"/>
  <classpathentry kind="src" path="src/metastore/src/model"/>
  <classpathentry kind="src" path="src/metastore/src/gen/thrift/gen-javabean"/>
  <classpathentry kind="src" path="src/ql/src/java"/>
  <classpathentry kind="src" path="src/ql/src/gen/thrift/gen-javabean"/>
  <classpathentry kind="src" path="src/serde/src/java"/>
  <classpathentry kind="src" path="src/serde/src/gen-java/org/apache/hadoop/hive/serde/test"/>
  <classpathentry kind="src" path="src/serde/src/gen/protobuf/gen-java"/>
  <classpathentry kind="src" path="src/serde/src/gen/thrift/gen-javabean"/>
  <classpathentry kind="src" path="src/service/src/java"/>
  <classpathentry kind="src" path="src/service/src/gen/thrift/gen-javabean"/>
  <classpathentry kind="src" path="src/shims/src/common/java"/>
  <classpathentry kind="lib" path="examples/files/TestSerDe.jar"/>
  <classpathentry kind="lib" path="lib/ant-contrib-1.0b3.jar"/>
  <classpathentry kind="lib" path="lib/antlr-runtime-3.0.1.jar"/>
  <classpathentry kind="lib" path="lib/asm-3.1.jar"/>
  <classpathentry kind="lib" path="lib/avro-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/avro-ipc-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/avro-mapred-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
  <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
  <classpathentry kind="lib" path="lib/commons-collections-3.2.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-dbcp-1.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-lang-2.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-pool-1.5.4.jar"/>
  <classpathentry kind="lib" path="lib/datanucleus-connectionpool-2.0.3.jar"/>
  <classpathentry kind="lib" path="lib/datanucleus-core-2.0.3.jar"/>
  <classpathentry kind="lib" path="lib/datanucleus-enhancer-2.0.3.jar"/>
  <classpathentry kind="lib" path="lib/datanucleus-rdbms-2.0.3.jar"/>
  <classpathentry kind="lib" path="lib/derby.jar"/>
  <classpathentry kind="lib" path="lib/guava-r06.jar"/>
  <classpathentry kind="lib" path="lib/haivvreo-1.0.7-cdh-2.jar"/>
  <classpathentry kind="lib" path="lib/hbase-0.90.4-cdh3u3-tests.jar"/>
  <classpathentry kind="lib" path="lib/hbase-0.90.4-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-anttasks-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-cli-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-common-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-contrib-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-exec-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-hbase-handler-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-hwi-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-jdbc-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-metastore-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-serde-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-service-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/hive-shims-0.7.1-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/jackson-core-asl-1.7.3.jar"/>
  <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.7.3.jar"/>
  <classpathentry kind="lib" path="lib/jdo2-api-2.3-ec.jar"/>
  <classpathentry kind="lib" path="lib/jline-0.9.94.jar"/>
  <classpathentry kind="lib" path="lib/json.jar"/>
  <classpathentry kind="lib" path="lib/junit-3.8.1.jar"/>
  <classpathentry kind="lib" path="lib/libfb303.jar"/>
  <classpathentry kind="lib" path="lib/libthrift.jar"/>
  <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-api-1.6.1.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-log4j12-1.6.1.jar"/>
  <classpathentry kind="lib" path="lib/snappy-java-1.0.3.2.jar"/>
  <classpathentry kind="lib" path="lib/stringtemplate-3.1b1.jar"/>
  <classpathentry kind="lib" path="lib/thrift-0.5.0.jar"/>
  <classpathentry kind="lib" path="lib/thrift-fb303-0.5.0.jar"/>
  <classpathentry kind="lib" path="lib/velocity-1.5.jar"/>
  <classpathentry kind="lib" path="lib/zookeeper-3.3.1.jar"/>
  <classpathentry kind="lib" path="src/cli/lib/jline-0.9.94.jar"/>
  <classpathentry kind="lib" path="src/data/files/TestSerDe.jar"/>
  <classpathentry kind="lib" path="src/lib/asm-3.1.jar"/>
  <classpathentry kind="lib" path="src/lib/commons-codec-1.3.jar"/>
  <classpathentry kind="lib" path="src/lib/commons-collections-3.2.1.jar"/>
  <classpathentry kind="lib" path="src/lib/commons-lang-2.4.jar"/>
  <classpathentry kind="lib" path="src/lib/commons-logging-1.0.4.jar"/>
  <classpathentry kind="lib" path="src/lib/commons-logging-api-1.0.4.jar"/>
  <classpathentry kind="lib" path="src/lib/derby.jar"/>
  <classpathentry kind="lib" path="src/lib/json.jar"/>
  <classpathentry kind="lib" path="src/lib/log4j-1.2.15.jar"/>
  <classpathentry kind="lib" path="src/lib/thrift-0.5.0.jar"/>
  <classpathentry kind="lib" path="src/lib/thrift-fb303-0.5.0.jar"/>
  <classpathentry kind="lib" path="src/lib/velocity-1.5.jar"/>
  <classpathentry kind="lib" path="src/ql/lib/antlr-2.7.7.jar"/>
  <classpathentry kind="lib" path="src/ql/lib/antlr-3.0.1.jar"/>
  <classpathentry kind="lib" path="src/ql/lib/antlr-runtime-3.0.1.jar"/>
  <classpathentry kind="lib" path="src/ql/lib/stringtemplate-3.1b1.jar"/>
  <classpathentry kind="lib" path="src/testlibs/ant-contrib-1.0b3.jar"/>
  <classpathentry kind="lib" path="src/testlibs/junit-3.8.1.jar"/>
  <classpathentry kind="lib" path="lib/hadoop-core-0.20.2-cdh3u3.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/jetty-util-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/hadoop-tools-0.20.2-cdh3u3.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="build/eclipse-classes"/>
</classpath>

象面蜂に苦戦して、こんな時間になったので、今日はこの辺で引き上げる。

hadoop-0.20.2-cdh3u2をeclipseにインポートする

今、このエントリーを書いている時点で「CDH3u2」でぐぐると、
検索結果の1ページ目にこのブログがヒットして、
妙にテンションがあがっているkajitilunaです。

hadoop アドベントカレンダー 2011 1日目 CDH hadoop/hive/hbase を eclipse プロジェクトとしてインポートする」にて、
cdhのソースをeclipseにインポートする方法が紹介されていますが、
何気にこっそりmavenをたたいているので、
環境によっては失敗すると思います。

なので、mavenを叩かずに、
コンパイルエラー起こさずにインポートする方法をメモしておきます。
(というか、オイラの環境でナゼかmvnがエラー起こしていたので、その際のメモ)

とはいっても、やっていることは、
インポートした後にコンパイルエラーのディレクトリを
ぽちぽちexcludeしているだけダケドナー

さて、用意するものはコチラ

  • eclipse本体(アタリマエダ)
  • hadoop-0.20.2-cdh3u2.tar.gz(コレナクシテ、ナニヲいんぽーとスルツモリダ)
  • Lhaz(Lhaplusだと解凍時にエラー発生していたので、多分コレが無難)

hadoop-0.20.2-cdh3u2.tar.gz」のDL元は上記リンクを参照してください。

1.
上記ファイルを取得したら、さっそく解凍してください。
解凍後のディレクトリ「hadoop-0.20.2-cdh3u2」を好きなところに配置してください。

2.
このままeclipseにインポートしていいのですが、
そうするとGUIからぽちぽちexclude&ビルドの連続になって
時間がかかるので、必要なファイルを予め作成してから、インポートすることにします。

以下のファイル「.project」と「.classpath」を作成して、
上記の「hadoop-0.20.2-cdh3u2」ディレクトリ直下に配置してください。
なお、これらのファイルの内容はこちら。

「.project」

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
  <name>hadoop-0.20.2-cdh3u2</name>
  <comment></comment>
  <projects>
  </projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.jdt.core.javabuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
  </natures>
</projectDescription>

「.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry excluding="org/apache/hadoop/record/compiler/ant/" kind="src" path="src/core"/>
  <classpathentry kind="src" path="src/hdfs"/>
  <classpathentry kind="src" path="src/mapred"/>
  <classpathentry kind="src" path="src/contrib/capacity-scheduler/src/java"/>
  <classpathentry kind="src" path="src/contrib/data_join/src/examples"/>
  <classpathentry kind="src" path="src/contrib/data_join/src/java"/>
  <classpathentry excluding="org/apache/hadoop/eclipse/" kind="src" path="src/contrib/eclipse-plugin/src/java"/>
  <classpathentry kind="src" path="src/contrib/failmon/src/java"/>
  <classpathentry kind="src" path="src/contrib/fairscheduler/src/java"/>
  <classpathentry kind="src" path="src/contrib/gridmix/src/java"/>
  <classpathentry kind="src" path="src/contrib/hdfsproxy/src/java"/>
  <classpathentry kind="src" path="src/contrib/index/src/java"/>
  <classpathentry kind="src" path="src/contrib/mrunit/src/java"/>
  <classpathentry kind="src" path="src/contrib/streaming/src/java"/>
  <classpathentry kind="src" path="src/contrib/thriftfs/gen-java"/>
  <classpathentry kind="src" path="src/contrib/thriftfs/src/java"/>
  <classpathentry kind="src" path="src/contrib/vaidya/src/java"/>
  <classpathentry kind="src" path="src/examples"/>
  <classpathentry kind="src" path="src/tools"/>
  <classpathentry kind="lib" path="contrib/capacity-scheduler/hadoop-capacity-scheduler-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/capacity-scheduler/lib/jackson-core-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/capacity-scheduler/lib/jackson-mapper-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/datajoin/hadoop-datajoin-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/failmon/hadoop-failmon-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/fairscheduler/hadoop-fairscheduler-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/gridmix/hadoop-gridmix-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/gridmix/lib/jackson-core-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/gridmix/lib/jackson-mapper-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/hdfsproxy/hdfsproxy-2.0.jar"/>
  <classpathentry kind="lib" path="contrib/index/hadoop-index-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/index/lib/lucene-core-2.3.1.jar"/>
  <classpathentry kind="lib" path="contrib/mrunit/hadoop-mrunit-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/streaming/hadoop-streaming-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/streaming/lib/jackson-core-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/streaming/lib/jackson-mapper-asl-1.0.1.jar"/>
  <classpathentry kind="lib" path="contrib/thriftfs/hadoop-thriftfs-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="contrib/vaidya/hadoop-vaidya-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="hadoop-ant-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="hadoop-core-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="hadoop-examples-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="hadoop-test-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="hadoop-tools-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="ivy/ivy-2.0.0-rc2.jar"/>
  <classpathentry kind="lib" path="lib/ant-contrib-1.0b3.jar"/>
  <classpathentry kind="lib" path="lib/aspectjrt-1.6.5.jar"/>
  <classpathentry kind="lib" path="lib/aspectjtools-1.6.5.jar"/>
  <classpathentry kind="lib" path="lib/commons-cli-1.2.jar"/>
  <classpathentry kind="lib" path="lib/commons-codec-1.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-daemon-1.0.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-el-1.0.jar"/>
  <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-logging-api-1.0.4.jar"/>
  <classpathentry kind="lib" path="lib/commons-net-1.4.1.jar"/>
  <classpathentry kind="lib" path="lib/core-3.1.1.jar"/>
  <classpathentry kind="lib" path="lib/hadoop-fairscheduler-0.20.2-cdh3u2.jar"/>
  <classpathentry kind="lib" path="lib/hsqldb-1.8.0.10.jar"/>
  <classpathentry kind="lib" path="lib/jackson-core-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jackson-mapper-asl-1.5.2.jar"/>
  <classpathentry kind="lib" path="lib/jasper-compiler-5.5.12.jar"/>
  <classpathentry kind="lib" path="lib/jasper-runtime-5.5.12.jar"/>
  <classpathentry kind="lib" path="lib/jets3t-0.6.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-servlet-tester-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/jetty-util-6.1.26.cloudera.1.jar"/>
  <classpathentry kind="lib" path="lib/jsch-0.1.42.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1/jsp-2.1.jar"/>
  <classpathentry kind="lib" path="lib/jsp-2.1/jsp-api-2.1.jar"/>
  <classpathentry kind="lib" path="lib/junit-4.5.jar"/>
  <classpathentry kind="lib" path="lib/kfs-0.2.2.jar"/>
  <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
  <classpathentry kind="lib" path="lib/mockito-all-1.8.2.jar"/>
  <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-20081211.jar"/>
  <classpathentry kind="lib" path="lib/servlet-api-2.5-6.1.14.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-api-1.4.3.jar"/>
  <classpathentry kind="lib" path="lib/slf4j-log4j12-1.4.3.jar"/>
  <classpathentry kind="lib" path="lib/xmlenc-0.52.jar"/>
  <classpathentry kind="lib" path="src/contrib/cloud/lib/pyAntTasks-1.3.jar"/>
  <classpathentry kind="lib" path="src/contrib/thriftfs/lib/hadoopthriftapi.jar"/>
  <classpathentry kind="lib" path="src/contrib/thriftfs/lib/libthrift.jar"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="target/classes"/>
</classpath>

上記の設定は、classファイルを「target/classes」に出力する設定になっている。
嫌なら、「kind="output"」に設定するpathの値を修正すること。


そいや、書いてから気付いたけど、
Windowsだと画面から「.project」や「.classpath」、「.txt」のような、
ファイル拡張子の前に何もないファイルは作成できないのだった。。

でも、こうすれば上記のようなファイルも作成できる。

  1. どこでもいいので、右クリックから「新規作成 > テキストファイル」を選択する。
  2. ファイル名は何でもよい。ここでは例として「aaa.txt」とする。
  3. コマンドプロンプトを開き、「aaa.txt」を作成したディレクトリに移動する。
  4. 「.project」というファイル名を作る場合「move aaa.txt .project」を実行する。

こうすれば、「aaa.txt」のファイル名が「.project」に変わるので、
後はテキストエディタで編集すればよい。


3.
上記のファイルの準備が完了すれば、eclipseにインポートする。
eclipseを起動したら、メニューから「File > Import」を選択する。
Importダイアログでは、
「General > Existing Projects into Workspace」を選択して「Next」を押下。

次のダイアログでは、
「Select root directory」で「hadoop-0.20.2-cdh3u2」を指定し、
Projectsにディレクトリと同一名のProjectが表示されたのを確認したら「Finish」を押下。

インポート後、ビルドが完了すると、
コンパイルエラーなしでインポートが完了している、、、はず

ちなみに、今回の設定では、testコードは基本的にビルドパスから外しています。
testコードも合わせて見たい!という人は、、、このエントリーは無視して、mavenたたきな


4.
その他、hbaseやhive、flumeもほぼ同様のことをすればインポートできます。
が、ここに載せるのが面倒くさくなったので、後日、気が向いたときにでも。

mvnを動かさない場合のインポートで注意することは、、
hbase → 特になし。hadoopと同じ流れでできる
flume → hbaseのjarをもってくる必要がある。影響するのは、hbasepluginのところ
hive → 意外とメンドイ。Servlet-APIが必要なはず。


ひとまずこんなカンジで。もう寝ます。

CDH3u2で初めてHiveを使ってみる(初心者向け?)

というわけで、
CDH3u2で初めてHiveを使おうとしたら、
環境まわり(というかほとんどpermission denied)で
何度かはまったので、整理しておく。

なお、CDH3u2自体のインストールは、、忘れた。
このくらいならば、ぐぐればたくさんヒットする。

以下、前提条件として、hdfsユーザで操作を行うものとする。

CDH3u2のhiveをインストールすれば、
hiveコマンドのパスなど、自動で通してくれるので、
後は環境まわりを整理すればよい。

とりあえず、hiveコマンドを実行すると、以下のようなエラーが出力される。

-bash-4.1$ hive
Hive history file=/tmp/hdfs/hive_job_log_hdfs_201112070248_1529599074.txt
Exception in thread "main" java.io.FileNotFoundException: /usr/lib/hadoop-0.20/.hivehistory (Permission denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
        at java.io.FileWriter.<init>(FileWriter.java:73)
        at jline.History.setHistoryFile(History.java:45)
        at jline.History.<init>(History.java:37)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:505)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:186)

「/usr/lib/hadoop-0.20/.hivehistory」のアクセス権限がないよ、
と怒られている訳だが、
もちろんhiveを初めて動かすので、「.hivehistory」なるファイルなど存在しない。

しかも、

-bash-4.1$ ll /usr/lib | grep hadoop-0.20
drwxr-xr-x   9 root root    4096 127 02:49 2011 hadoop-0.20

なことで、hdfsユーザじゃあ「/usr/lib/hadoop-0.20/」配下にファイルを作成できない。

なので、ひとまずrootユーザになって、このファイルをカキコできるように設定する。

[root@master conf]# touch /usr/lib/hadoop-0.20/.hivehistory
[root@master conf]# chmod 775 /usr/lib/hadoop-0.20/.hivehistory
[root@master conf]# ll /usr/lib/hadoop-0.20/.hivehistory
-rwxrwxr-x 1 root root 0 127 02:49 2011 /usr/lib/hadoop-0.20/.hivehistory
[root@master conf]# chown hdfs:hadoop /usr/lib/hadoop-0.20/.hivehistory

上記設定が終われば、改めてhdfsユーザになってhiveコマンドを実行する。

-bash-4.1$ hive
Hive history file=/tmp/hdfs/hive_job_log_hdfs_201112070250_1706396861.txt
hive>

無事にhiveコンソールが起動した。

ためしに、何もないのは分かっているものの、テーブル一覧を表示してみる。

hive> show tables;
2011-12-06 17:50:30.812 GMT Thread[main,5,main] java.io.FileNotFoundException: derby.log (Permission denied)
----------------------------------------------------------------
2011-12-06 17:50:31.212 GMT:
 Booting Derby version The Apache Software Foundation - Apache Derby - 10.4.2.0 - (689064): instance a816c00e-0134-147f-8d9f-000000948598
on database directory /var/lib/hive/metastore/metastore_db

Database Class Loader started - derby.database.classpath=''
OK
Time taken: 4.65 seconds

「/usr/lib/hive/conf/hive-site.xml」の設定もそのままなので、
DBのディレクトリは初期値「 /var/lib/hive/metastore/metastore_db」のままとのこと。

え?そんなことより、

2011-12-06 17:50:30.812 GMT Thread[main,5,main] java.io.FileNotFoundException: derby.log (Permission denied)

の方を気にしろって??

ひとまず、現在hiveコマンドを実行しているディレクトリは
「/usr/lib/hadoop-0.20」なので、ここに上記ファイルを作成する。

[root@master hive]# touch derby.log
[root@master hive]# chmod 777 derby.log
[root@master hive]# chown hdfs:hadoop derby.log
[root@master hive]# mv derby.log /usr/lib/hadoop-0.20/

上記設定後、改めてhiveコマンドを実行する。

-bash-4.1$ hive
Hive history file=/tmp/hdfs/hive_job_log_hdfs_201112070330_264158222.txt
hive> show tables;
OK
Time taken: 3.093 seconds

ってなカンジでエラーはでなくなった。


ただ、これが正しい設定なのかは、何とも言い難いが。。。

TortoiseSVN1.7になって.svnの扱いが変わった

最近、客先の環境で作業をするようになったので、
TortoisesSvnをDownloadあんどInstallした。

はじめは何も気にすることなく使っていたが、
突然、何か違和感があることに気付いた。

「.svn」ディレクトリがないぞ。。。


そう、TortoiseSVNでCheckoutしたディレクトリ配下なので、
いつもなら「.svn」という管理用の隠しディレクトリが存在するのに、
それが何故か存在しない。

はじめは、うっかりExplolerの設定で
隠しファイルを非表示のままかと思ったが、
設定を確認したところ、そうでもなかった。


ちょっとググってみると、以下のブログに行き当たった。

http://d.hatena.ne.jp/lino/20111014/1318597181

どうやら、これはTortoiseSVN1.7からの
WC-NG(Working Copy Next Generation)という新機能らしく、
ルートのみに「.svn」が存在するらしい。

オレの利用ケースからすると、これはヒジョーに使いづらい。。。

ここから自分勝手な推測になるのだが、
ルートの「.svn」にルート配下のデータを全て所持しているようで、
初回のチェックアウトに時間がかかる。

どういうことかというと、
自分はSVNからCheckoutするときは
いつもSVNのルートからUpdate depthを
「Immediate children, including folders」に指定して、
必要なところだけ、「Fully recursive」にしている。

たとえば、リポジトリのディレクトリ構成が以下の場合を考える。
よくある標準的な構成である。

SVN_ROOT
├ branch
├ tags
├ trunk
└ work


TortoiseSVN1.6までだと、
SVN_ROOTにて「Immediate children, including folders」でチェックアウトすると、
branch, tags, trunk, workのディレクトリのみをチェックアウトするので、
1秒もかからない。

しかし、TortoiseSVN1.7だと、
例え「Immediate children, including folders」でチェックアウトしても
たったの4つのディレクトリをチェックアウトするだけなのに、
その配下のデータを全てリポジトリからDownloadしているようにみえる。

なにせ、5分待ってもチェックアウトが終わらないからキャンセル、
という操作を3回も繰り返してしまった。。。オレはアホだ。


必要なディレクトリだけをCheckoutする、
というユーザにとっては何も困らないと思う。

自分は、同じリポジトリを複数のディレクトリからローカルにCheckoutすると
ローカルのディレクトリ構成がカオス化してしまうのを嫌って、
上記のように「Immediate children, including folders」と
「Fully recursive」を使い分けていた。

こうすることで、不要なディレクトリのデータをダウンロードすることなく、
ローカルのディレクトリ構成をリポジトリと合わせられた。


確かに、一度チェックアウトすれば、
SVN操作の時間は体感的に早くなった気がする。

しかし、それはいつも2〜3秒の操作が1〜2秒、という感覚。
そんな秒単位の時間なんて全く気にもならない。

むしろ、2〜3秒で終わっていたcheckoutという操作が
数10分〜数時間かかるようになった、というデメリットの方が目立つ。


構成管理がしっかりされているプロジェクトならマシとしても、
構成管理が計画的にされていないカオスなプロジェクトだったら、
上位ディレクトリでのチェックアウトに時間がかかってしまう。

末端のディレクトリを大量にチェックアウト、
または、リポジトリブラウザから直接データを取ってくる、
という無駄な作業ばかり増えてしまう。

特に、tagsなんて複数のバージョンが管理されているはずで、
ルートからCheckoutしようとすると、全バージョンのデータを
ローカルに落とすことになる。


昔の管理方法を選択する設定とか、ないのかしら??

Windows7でExcelをファイルごとに異なるウィンドウに表示する

Excelって昔からMDI形式が標準になっており、
複数のExcelファイルを開くと、
普通はひとつのExcelのウィンドウに複数のファイルが開かれる。

画面サイズが小さいノートPCだったらこれで別に困らないが、
デスクトップ、特にデュアルディスプレイだと、扱いづらい。

Excelをスタートメニューから起動することで
複数ウィンドウを立ち上げることができるので、
これにそれぞれドラッグ&ドロップすることで
複数のExcelファイルを複数ウィンドウで操作できる。

…というのを毎回操作するのは手間がかかるので、
XPを使っていた頃は、メニューからGUI操作で右クリックメニューを自由に追加できたので、
右クリックメニューにExcelのexeのリンクを追加して、
そこから複数のウィンドウを立ち上げていた。


が、Windows7になってから、XPにはあった上記のメニューがなくなった。
要はレジストリいじるしか、右クリックメニューをカスタマイズできなくなった。


ということで、Excelファイルの右クリックメニューから、
Excelファイル単位で異なるウィンドウで起動する項目を追加してみた。


詳細はここから。

まずは、元々のExcelの右クリックメニュー

レジストリエディタ(「ファイル名を指定して実行」でregeditを入力すると起動する)から、

HKEY_CLASSES_ROOT\Excel.Sheet.12.\shell

に新規にキーを作成する。

なお、ここのキーの名前は自由に指定できる。

このキーの値を修正する。

ここで指定する値が、右クリックメニューに表示されるものである。

設定した結果は以下の通り。

引き続き、上記で作成したキーの配下に新しくキーを作成する。

ただし、ここのキーの名前は「command」を指定しなければならない。

また、このcommandキーに対応する値は以下の形式を指定する。

"Excelのexeのファイルパス" "%1"

結果がこちら。

右クリックメニューはこんなカンジになる。

そして、こちらが複数ウィンドウでExcelを表示してみたやつ。


ちなみに、このままだと、Excel2010形式のみ有効となり、
Excel2003だと右クリックメニューが反映されないので、別途設定が必要となる。

それがこちら。

親が「Excel.Sheet.12」なのが2010形式であり、「Excel.Sheet.8」が2003形式だと思われる。


おまけ

上記の設定の逆のことをすれば、
右クリックメニューで表示される「印刷」や「読み取り専用で開く」を消すことができる。
これらの項目をこれまで一度も使用したことがないのだが、有用性がわからん。。。

Flume Masterが起動しない

久しぶりにFlumeを動かそうとしたら、Flume Masterが起動しない。。

 -bash-4.1$ flume master
 Master already running, pid=xxxx

どうやら、既にFlume Masterは起動しているよ、とのことだが、
psしてみたがFlumeのプロセスは存在しない。

起動スクリプト/usr/lib/flume/bin/flumeを調べてみると、
238行目〜244行目にこんな処理が記述されていた。

    238 elif [ "$CMD" = "master" ] ; then
    239   # only allow one master
    240   if [ -f $MASTERPID ] ; then
    241     PID=`cat $MASTERPID`
    242     echo "Master already running, pid=$PID"
    243     exit -1
    244   fi

エラーメッセージがそっくりで怪しい。。
ということで、${MASTERPID}なるファイルを調べてみる。

同じファイルの61行目に

     61 MASTERPID=${FLUME_PID_DIR:="/tmp"}/flumemaster.pid

とあったので、/tmp/flumemaster.pidを削除したら、今度はちゃんと起動した。

これは二重起動防止用の処理みたい。