Michael Blow has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/1126
Change subject: Add Helper Client To Interface With Cluster HTTP APIs ...................................................................... Add Helper Client To Interface With Cluster HTTP APIs - updated start / stop sample cluster scripts - align args4j versions with latest released - removed sample scripts from asterix-server jar Change-Id: Ib44cc3617c4ff6e995f26c1853bc9d78a1faacd7 --- A asterixdb/asterix-client-helper/pom.xml A asterixdb/asterix-client-helper/src/main/assembly/assembly.xml A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/ClusterHelper.java A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/Options.java A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ClientCommand.java A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/GetClusterStateCommand.java A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ShutdownCommand.java A asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/WaitForClusterCommand.java M asterixdb/asterix-events/pom.xml M asterixdb/asterix-installer/pom.xml M asterixdb/asterix-server/pom.xml M asterixdb/asterix-server/src/main/assembly/binary-assembly.xml M asterixdb/asterix-server/src/main/assembly/filter.properties D asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh D asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh R asterixdb/asterix-server/src/main/samples/local/conf/blue.conf R asterixdb/asterix-server/src/main/samples/local/conf/cc.conf M asterixdb/pom.xml M hyracks-fullstack/hyracks/pom.xml 19 files changed, 560 insertions(+), 135 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/26/1126/1 diff --git a/asterixdb/asterix-client-helper/pom.xml b/asterixdb/asterix-client-helper/pom.xml new file mode 100644 index 0000000..6521ee2 --- /dev/null +++ b/asterixdb/asterix-client-helper/pom.xml @@ -0,0 +1,88 @@ +<!-- + ! 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. + !--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>asterix-client-helper</artifactId> + <parent> + <groupId>org.apache.asterix</groupId> + <artifactId>apache-asterixdb</artifactId> + <version>0.8.9-SNAPSHOT</version> + </parent> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>appassembler-maven-plugin</artifactId> + <version>1.3</version> + <configuration> + <assembleDirectory> + ${project.build.directory}/appassembler + </assembleDirectory> + <repositoryLayout>flat</repositoryLayout> + <repositoryName>lib</repositoryName> + <useWildcardClassPath>false</useWildcardClassPath> + <programs> + <program> + <platforms> + <platform>unix</platform> + </platforms> + <name>asterixclusterhelper</name> + <mainClass>org.apache.asterix.helper.ClusterHelper</mainClass> + </program> + </programs> + <daemons/> + </configuration> + <executions> + <execution> + <goals> + <goal>assemble</goal> + <goal>generate-daemons</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <configuration> + <attach>true</attach> + <descriptor>src/main/assembly/assembly.xml</descriptor> + </configuration> + <phase>package</phase> + <goals> + <goal>single</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>args4j</groupId> + <artifactId>args4j</artifactId> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + </dependency> + </dependencies> +</project> diff --git a/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml new file mode 100644 index 0000000..2e4e133 --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/assembly/assembly.xml @@ -0,0 +1,38 @@ +<!-- + ! 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. + !--> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>assembly</id> + <formats> + <format>zip</format> + </formats> + <includeBaseDirectory>false</includeBaseDirectory> + <fileSets> + <fileSet> + <directory>target/appassembler/lib</directory> + <outputDirectory>lib</outputDirectory> + </fileSet> + <fileSet> + <directory>target/appassembler/bin</directory> + <outputDirectory>bin</outputDirectory> + <fileMode>0755</fileMode> + </fileSet> + </fileSets> +</assembly> diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/ClusterHelper.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/ClusterHelper.java new file mode 100644 index 0000000..fdda7ae --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/ClusterHelper.java @@ -0,0 +1,60 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper; + +import org.apache.asterix.helper.commands.ClientCommand; +import org.apache.asterix.helper.commands.GetClusterStateCommand; +import org.apache.asterix.helper.commands.ShutdownCommand; +import org.apache.asterix.helper.commands.WaitForClusterCommand; +import org.kohsuke.args4j.CmdLineException; +import org.kohsuke.args4j.CmdLineParser; + +public class ClusterHelper { + + @SuppressWarnings({ + "squid:S106", // use of System.err + "squid:S1166" // rethrow or log exception + }) + public static void main(String [] args) { + Options options = new Options(); + CmdLineParser parser = new CmdLineParser(options); + try { + parser.parseArgument(args); + } catch (CmdLineException e) { + System.err.println("ERROR: " + e.getMessage()); + System.err.println("\nUsage:"); + parser.setUsageWidth(120); + parser.printUsage(System.err); + System.err.flush(); + System.exit(1); + } + ClientCommand command = getCommand(options); + System.exit(command.execute()); + } + + protected static ClientCommand getCommand(Options options) { + switch (options.getCommand()) { + case GET_CLUSTER_STATE: + return new GetClusterStateCommand(options); + case WAIT_FOR_CLUSTER: + return new WaitForClusterCommand(options); + case SHUTDOWN_CLUSTER: + return new ShutdownCommand(options); + default: + throw new IllegalStateException("NYI: " + options.getCommand()); + } + } +} diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/Options.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/Options.java new file mode 100644 index 0000000..a073033 --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/Options.java @@ -0,0 +1,77 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper; + +import java.net.InetAddress; + +import org.kohsuke.args4j.Option; + +public class Options { + + enum Command { + GET_CLUSTER_STATE, + WAIT_FOR_CLUSTER, + SHUTDOWN_CLUSTER + } + + @Option(name = "-clusteraddress", metaVar = "<address>", + usage = "Hostname or IP Address of the Asterix cluster (default: localhost)") + String clusterAddress = InetAddress.getLoopbackAddress().getHostAddress(); + + @Option(name = "-clusterport", metaVar = "<port>", usage = "Port of the Asterix cluster (default: 19001)") + int clusterPort = 19001; + + @Option(name = "-command", metaVar = "<command>", required = true, + usage = "Command to execute:\n" + + " wait_for_cluster (error code 0 = UP, 1 = DOWN)\n" + + " get_cluster_state (error code 0 = UP, 1 = DOWN, 2 = UNKNOWN (i.e. port mismatch)\n" + + " shutdown_cluster") + Command command; + + @Option(name = "-path", metaVar = "<path>", + usage = "Path on host:port to check for cluster readiness (default: admin/cluster)") + String path="admin/cluster"; + + @Option(name = "-timeout", metaVar = "<secs>", usage = "Timeout for wait commands in seconds (default: forever)") + int timeoutSecs = -1; + + @Option(name = "-quiet", aliases = "-q", usage = "Suppress all normal output") + boolean quiet; + + public String getClusterAddress() { + return clusterAddress; + } + + public int getClusterPort() { + return clusterPort; + } + + public Command getCommand() { + return command; + } + + public int getTimeoutSecs() { + return timeoutSecs; + } + + public boolean isQuiet() { + return quiet; + } + + public String getPath() { + return path; + } +} diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ClientCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ClientCommand.java new file mode 100644 index 0000000..f0742cf --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ClientCommand.java @@ -0,0 +1,42 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper.commands; + +import java.util.logging.Level; + +import org.apache.asterix.helper.Options; + +public abstract class ClientCommand { + + protected final Options options; + + public ClientCommand(Options options) { + this.options = options; + } + + @SuppressWarnings("squid:S106") + protected void log(Level severity, String message) { + if (!options.isQuiet()) { + System.out.println(severity + ": " + message); + } + } + + protected void log(String message) { + log(Level.INFO, message); + } + + public abstract int execute(); +} diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/GetClusterStateCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/GetClusterStateCommand.java new file mode 100644 index 0000000..b2939d4 --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/GetClusterStateCommand.java @@ -0,0 +1,72 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper.commands; + +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.asterix.helper.Options; + +public class GetClusterStateCommand extends ClientCommand { + + public GetClusterStateCommand(Options options) { + super(options); + } + + private int tryConnect(URL clusterURL) { + try { + HttpURLConnection conn = (HttpURLConnection)clusterURL.openConnection(); + conn.setRequestMethod("GET"); + return conn.getResponseCode(); + + } catch (java.io.IOException e) { + return -1; + } + } + + private void logState(String state) { + final String hostPort = options.getClusterAddress() + ":" + options.getClusterPort(); + log("Cluster " + hostPort + " is " + state + "."); + } + + @Override + public int execute() { + final String hostPort = options.getClusterAddress() + ":" + options.getClusterPort(); + URL clusterURL; + try { + clusterURL = new URL("http://" + hostPort + "/" + options.getPath()); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } + log("Attempting to determine state of cluster " + hostPort + "..."); + int statusCode = tryConnect(clusterURL); + // TODO (mblow): interrogate result to determine cluster readiness, not rely on HTTP 200 + switch (statusCode) { + case HttpServletResponse.SC_OK: + logState("UP"); + return 0; + case -1: + logState("DOWN"); + return 1; + default: + logState("UNKNOWN"); + return 2; + } + } +} diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ShutdownCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ShutdownCommand.java new file mode 100644 index 0000000..492269d --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/ShutdownCommand.java @@ -0,0 +1,68 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper.commands; + +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.asterix.helper.Options; + +public class ShutdownCommand extends ClientCommand { + + public ShutdownCommand(Options options) { + super(options); + } + + private int tryConnect(URL clusterURL) { + try { + HttpURLConnection conn = (HttpURLConnection)clusterURL.openConnection(); + conn.setRequestMethod("POST"); + return conn.getResponseCode(); + + } catch (java.io.IOException e) { + return -1; + } + } + + @Override + public int execute() { + final String hostPort = options.getClusterAddress() + ":" + options.getClusterPort(); + URL clusterURL; + try { + clusterURL = new URL("http://" + hostPort + "/" + options.getPath()); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } + log("Attempting to shutdown cluster " + hostPort + "..."); + int statusCode = tryConnect(clusterURL); + // TODO (mblow): interrogate result to determine acceptance, not rely on HTTP 200 + switch (statusCode) { + case HttpServletResponse.SC_ACCEPTED: + log("Cluster " + hostPort + " accepted shutdown request."); + return 0; + case -1: + log("Cluster " + hostPort + " not reachable."); + return 1; + default: + log("Cluster " + hostPort + " shutdown request failed, with response code:" + statusCode); + } + return 1; + + } +} diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/WaitForClusterCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/WaitForClusterCommand.java new file mode 100644 index 0000000..1e6cc11 --- /dev/null +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/helper/commands/WaitForClusterCommand.java @@ -0,0 +1,78 @@ +/* + * Copyright 2016 Couchbase, Inc. + * + * Licensed 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.asterix.helper.commands; + +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.servlet.http.HttpServletResponse; + +import org.apache.asterix.helper.Options; + +public class WaitForClusterCommand extends ClientCommand { + + public WaitForClusterCommand(Options options) { + super(options); + } + + @SuppressWarnings("squid:S1166") // log or rethrow exception + private boolean tryConnect(URL clusterURL) { + try { + HttpURLConnection conn = (HttpURLConnection)clusterURL.openConnection(); + conn.setRequestMethod("GET"); + return conn.getResponseCode() == HttpServletResponse.SC_OK; + + } catch (java.io.IOException e) { + return false; + } + } + + @Override + @SuppressWarnings("squid:S2142") // interrupted exception + public int execute() { + final String hostPort = options.getClusterAddress() + ":" + options.getClusterPort(); + URL clusterURL; + try { + clusterURL = new URL("http://" + hostPort + "/" + options.getPath()); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } + log("Waiting " + + (options.getTimeoutSecs() > 0 ? "up to " + options.getTimeoutSecs() + " seconds " : "") + + "for cluster " + hostPort + " to be available."); + + long startTime = System.currentTimeMillis(); + while (true) { + if (tryConnect(clusterURL)) { + log("Cluster started."); + return 0; + } + if (options.getTimeoutSecs() >= 0 + && (startTime + (options.getTimeoutSecs() * 1000) < System.currentTimeMillis())) { + break; + } + try { + Thread.sleep(500); + } catch (InterruptedException e) { + return 22; + } + } + log("Cluster " + hostPort + " was not available before timeout of " + + options.getTimeoutSecs() + " seconds was exhausted."); + return 1; + } +} diff --git a/asterixdb/asterix-events/pom.xml b/asterixdb/asterix-events/pom.xml index 97bf78f..4bd66df 100644 --- a/asterixdb/asterix-events/pom.xml +++ b/asterixdb/asterix-events/pom.xml @@ -146,9 +146,6 @@ <dependency> <groupId>args4j</groupId> <artifactId>args4j</artifactId> - <version>2.0.12</version> - <type>jar</type> - <scope>compile</scope> </dependency> <dependency> <groupId>org.jvnet.jaxb2_commons</groupId> diff --git a/asterixdb/asterix-installer/pom.xml b/asterixdb/asterix-installer/pom.xml index c1de4a4..2b849c2 100644 --- a/asterixdb/asterix-installer/pom.xml +++ b/asterixdb/asterix-installer/pom.xml @@ -240,9 +240,6 @@ <dependency> <groupId>args4j</groupId> <artifactId>args4j</artifactId> - <version>2.0.12</version> - <type>jar</type> - <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.zookeeper</groupId> diff --git a/asterixdb/asterix-server/pom.xml b/asterixdb/asterix-server/pom.xml index 78e990f..28b3089 100644 --- a/asterixdb/asterix-server/pom.xml +++ b/asterixdb/asterix-server/pom.xml @@ -119,7 +119,6 @@ <goals> <goal>assemble</goal> <goal>generate-daemons</goal> - <goal>create-repository</goal> </goals> </execution> </executions> @@ -144,10 +143,11 @@ </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> - <version>2.2-beta-5</version> + <version>2.6</version> <executions> <execution> <configuration> + <attach>false</attach> <filters> <filter>${project.basedir}/src/main/assembly/filter.properties</filter> </filters> @@ -157,7 +157,7 @@ </configuration> <phase>package</phase> <goals> - <goal>attached</goal> + <goal>single</goal> </goals> </execution> </executions> @@ -237,5 +237,12 @@ <artifactId>appassembler-booter</artifactId> <version>1.3.1</version> </dependency> + <dependency> + <groupId>org.apache.asterix</groupId> + <artifactId>asterix-client-helper</artifactId> + <version>${project.version}</version> + <type>zip</type> + <classifier>assembly</classifier> + </dependency> </dependencies> </project> diff --git a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml index 4afde5f..0c82f41 100644 --- a/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml +++ b/asterixdb/asterix-server/src/main/assembly/binary-assembly.xml @@ -16,7 +16,9 @@ ! specific language governing permissions and limitations ! under the License. !--> -<assembly> +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>binary-assembly</id> <formats> <format>zip</format> @@ -40,21 +42,18 @@ </includes> </fileSet> <fileSet> - <directory>src/main/resources</directory> - <outputDirectory>.</outputDirectory> - <includes> - <include>samples/**</include> - </includes> + <directory>src/main/samples</directory> + <outputDirectory>samples</outputDirectory> <excludes> <exclude>**/*.sh</exclude> </excludes> <filtered>true</filtered> </fileSet> <fileSet> - <directory>src/main/resources</directory> - <outputDirectory>.</outputDirectory> + <directory>src/main/samples</directory> + <outputDirectory>samples</outputDirectory> <includes> - <include>samples/**/*.sh</include> + <include>**/*.sh</include> </includes> <filtered>true</filtered> <fileMode>0755</fileMode> @@ -83,4 +82,14 @@ <fileMode>0755</fileMode> </fileSet> </fileSets> + <dependencySets> + <dependencySet> + <useStrictFiltering>true</useStrictFiltering> + <unpack>true</unpack> + <outputDirectory>.</outputDirectory> + <includes> + <include>org.apache.asterix:asterix-client-helper:zip:assembly:*</include> + </includes> + </dependencySet> + </dependencySets> </assembly> diff --git a/asterixdb/asterix-server/src/main/assembly/filter.properties b/asterixdb/asterix-server/src/main/assembly/filter.properties index 301aeaf..e014033 100644 --- a/asterixdb/asterix-server/src/main/assembly/filter.properties +++ b/asterixdb/asterix-server/src/main/assembly/filter.properties @@ -1,5 +1,7 @@ NC_SERVICE_COMMAND=asterixncservice CC_COMMAND=asterixcc NC_COMMAND=asterixnc +HELPER_COMMAND=asterixclusterhelper LISTEN_PORT=19002 -SHUTDOWN_SERVLET_PATH=admin/shutdown +SHUTDOWN_PATH=admin/shutdown +STATUS_PATH=admin/cluster diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh deleted file mode 100755 index 932231f..0000000 --- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/start-sample-cluster.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# ---------------------------------------------------------------------------- -# Copyright 2001-2006 The Apache Software Foundation. -# -# Licensed 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. -# ---------------------------------------------------------------------------- -# -# Copyright (c) 2001-2006 The Apache Software Foundation. All rights -# reserved. - -if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then - JAVA_HOME=$(/usr/libexec/java_home) - export JAVA_HOME -fi - -[ -z "$JAVA_HOME" ] && { - echo "JAVA_HOME not set" - exit 1 -} -"$JAVA_HOME/bin/java" -version || { - echo "JAVA_HOME not valid" - exit 2 -} - -DIRNAME=$(dirname $0) -[ $(echo $DIRNAME | wc -l) -ne 1 ] && { - echo "Paths with spaces are not supported" - exit 3 -} - -CLUSTERDIR=$(cd $DIRNAME/..; echo $PWD) -INSTALLDIR=$(cd $CLUSTERDIR/../..; echo $PWD) -LOGSDIR=$CLUSTERDIR/logs - -echo "CLUSTERDIR=$CLUSTERDIR" -echo "INSTALLDIR=$INSTALLDIR" - -cd $CLUSTERDIR -mkdir -p $LOGSDIR - -( - echo "--------------------------" - date - echo "--------------------------" -) | tee -a $LOGSDIR/blue-service.log | tee -a $LOGSDIR/red-service.log >> $LOGSDIR/cc.log - -$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - -config-file $CLUSTERDIR/conf/blue.conf >> $LOGSDIR/blue-service.log 2>&1 & -$INSTALLDIR/bin/${NC_SERVICE_COMMAND} -logdir - >> $LOGSDIR/red-service.log 2>&1 & -$INSTALLDIR/bin/${CC_COMMAND} -config-file $CLUSTERDIR/conf/cc.conf >> $LOGSDIR/cc.log 2>&1 & - -echo -n "Waiting for cluster to start." -while [ 1 ]; do - curl -s -o /dev/null http://localhost:${LISTEN_PORT} && break - echo -n "." - sleep 1s -done -echo ".done" -echo -echo "See output in $LOGSDIR/" diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh b/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh deleted file mode 100755 index 9836cb3..0000000 --- a/asterixdb/asterix-server/src/main/resources/samples/local/bin/stop-sample-cluster.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# ---------------------------------------------------------------------------- -# Copyright 2001-2006 The Apache Software Foundation. -# -# Licensed 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. -# ---------------------------------------------------------------------------- -# -# Copyright (c) 2001-2006 The Apache Software Foundation. All rights -# reserved. - -if [ -z "$JAVA_HOME" -a -x /usr/libexec/java_home ]; then - JAVA_HOME=$(/usr/libexec/java_home) - export JAVA_HOME -fi - -[ -z "$JAVA_HOME" ] && { - echo "JAVA_HOME not set" - exit 1 -} -"$JAVA_HOME/bin/java" -version || { - echo "JAVA_HOME not valid" - exit 2 -} - -curl -X POST http://localhost:${LISTEN_PORT}/${SHUTDOWN_SERVLET_PATH} -$JAVA_HOME/bin/jps | awk '/NCService/ { print $1 }' | xargs kill -echo -echo -n "Waiting for CCDriver to terminate." -while [ -n "$($JAVA_HOME/bin/jps | awk '/CCDriver/')" ]; do - sleep 2s - echo -n . -done -echo ".done." diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf b/asterixdb/asterix-server/src/main/samples/local/conf/blue.conf similarity index 100% rename from asterixdb/asterix-server/src/main/resources/samples/local/conf/blue.conf rename to asterixdb/asterix-server/src/main/samples/local/conf/blue.conf diff --git a/asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf b/asterixdb/asterix-server/src/main/samples/local/conf/cc.conf similarity index 100% rename from asterixdb/asterix-server/src/main/resources/samples/local/conf/cc.conf rename to asterixdb/asterix-server/src/main/samples/local/conf/cc.conf diff --git a/asterixdb/pom.xml b/asterixdb/pom.xml index 7285a5a..6cbe20a 100644 --- a/asterixdb/pom.xml +++ b/asterixdb/pom.xml @@ -594,6 +594,7 @@ <module>asterix-experiments</module> <module>asterix-coverage</module> <module>asterix-active</module> + <module>asterix-client-helper</module> </modules> <repositories> @@ -788,6 +789,11 @@ <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> + <dependency> + <groupId>args4j</groupId> + <artifactId>args4j</artifactId> + <version>2.33</version> + </dependency> </dependencies> </dependencyManagement> </project> diff --git a/hyracks-fullstack/hyracks/pom.xml b/hyracks-fullstack/hyracks/pom.xml index 70dfa38..cb2d661 100644 --- a/hyracks-fullstack/hyracks/pom.xml +++ b/hyracks-fullstack/hyracks/pom.xml @@ -90,10 +90,6 @@ <id>hyracks-public</id> <url>http://obelix.ics.uci.edu/nexus/content/groups/hyracks-public/</url> </repository> - <repository> - <id>jboss-public</id> - <url>https://repository.jboss.org/nexus/content/groups/public/</url> - </repository> </repositories> <pluginRepositories> -- To view, visit https://asterix-gerrit.ics.uci.edu/1126 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib44cc3617c4ff6e995f26c1853bc9d78a1faacd7 Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <[email protected]>
