Making some fixes so that the minicluster will run correctly in this project.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/4deec494 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/4deec494 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/4deec494 Branch: refs/heads/apache-blur-0.2 Commit: 4deec49455814ed9c57645bdde82d2dec6dc7d9c Parents: e9e6e00 Author: Aaron McCurry <[email protected]> Authored: Wed May 21 08:02:38 2014 -0400 Committer: Aaron McCurry <[email protected]> Committed: Wed May 21 08:02:38 2014 -0400 ---------------------------------------------------------------------- contrib/blur-console/pom.xml | 27 +++++++-- .../org/apache/blur/console/RunMiniCluster.java | 63 ++++++++++++++++++++ 2 files changed, 84 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4deec494/contrib/blur-console/pom.xml ---------------------------------------------------------------------- diff --git a/contrib/blur-console/pom.xml b/contrib/blur-console/pom.xml index e3f22d5..9104811 100644 --- a/contrib/blur-console/pom.xml +++ b/contrib/blur-console/pom.xml @@ -85,12 +85,6 @@ <type>test-jar</type> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-test</artifactId> - <version>1.2.1</version> - <scope>test</scope> - </dependency> </dependencies> <build> @@ -178,6 +172,14 @@ <properties> <projectVersion>${project.parent.version}-hadoop1</projectVersion> </properties> + <dependencies> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-test</artifactId> + <version>${hadoop.version}</version> + <scope>test</scope> + </dependency> + </dependencies> </profile> <profile> <id>hadoop-2.2</id> @@ -189,6 +191,19 @@ <properties> <projectVersion>${project.parent.version}-hadoop2</projectVersion> </properties> + <dependencies> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-client</artifactId> + <version>${hadoop.version}</version> + </dependency> + <dependency> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-minicluster</artifactId> + <version>${hadoop.version}</version> + <scope>test</scope> + </dependency> + </dependencies> </profile> <profile> <id>grunt</id> http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4deec494/contrib/blur-console/src/test/java/org/apache/blur/console/RunMiniCluster.java ---------------------------------------------------------------------- diff --git a/contrib/blur-console/src/test/java/org/apache/blur/console/RunMiniCluster.java b/contrib/blur-console/src/test/java/org/apache/blur/console/RunMiniCluster.java new file mode 100644 index 0000000..172dffd --- /dev/null +++ b/contrib/blur-console/src/test/java/org/apache/blur/console/RunMiniCluster.java @@ -0,0 +1,63 @@ +/** + * 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.blur.console; + +import java.io.File; +import java.io.IOException; + +import org.apache.blur.MiniCluster; +import org.apache.blur.utils.GCWatcher; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.LocalFileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.permission.FsAction; +import org.apache.hadoop.fs.permission.FsPermission; + +public class RunMiniCluster { + + private static final File TMPDIR = new File(System.getProperty("blur.tmp.dir", "./target/mini-cluster")); + + public static void main(String[] args) throws IOException { + GCWatcher.init(0.60); + LocalFileSystem localFS = FileSystem.getLocal(new Configuration()); + File testDirectory = new File(TMPDIR, "blur-cluster-test").getAbsoluteFile(); + testDirectory.mkdirs(); + + Path directory = new Path(testDirectory.getPath()); + FsPermission dirPermissions = localFS.getFileStatus(directory).getPermission(); + FsAction userAction = dirPermissions.getUserAction(); + FsAction groupAction = dirPermissions.getGroupAction(); + FsAction otherAction = dirPermissions.getOtherAction(); + + StringBuilder builder = new StringBuilder(); + builder.append(userAction.ordinal()); + builder.append(groupAction.ordinal()); + builder.append(otherAction.ordinal()); + String dirPermissionNum = builder.toString(); + System.setProperty("dfs.datanode.data.dir.perm", dirPermissionNum); + testDirectory.delete(); + MiniCluster miniCluster = new MiniCluster(); + miniCluster.startBlurCluster(new File(testDirectory, "cluster").getAbsolutePath(), 2, 3, true); + + System.out.println("ZK Connection String = [" + miniCluster.getZkConnectionString() + "]"); + System.out.println("Controller Connection String = [" + miniCluster.getControllerConnectionStr() + "]"); + System.out.println("HDFS URI = [" + miniCluster.getFileSystemUri() + "]"); + + } + +}
