Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "scylla-jmx"]
branch = master
url = [email protected]:scylladb/scylla-jmx.git
path = scylla-jmx
35 changes: 34 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
<property name="build.lib" value="${basedir}/lib"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.scylla-jmx-parent" value="${basedir}/scylla-jmx/scylla-jmx-parent/"/>
<property name="build.scylla-apiclient" value="${basedir}/scylla-jmx/scylla-apiclient/target"/>
<property name="build.dir.lib" value="${basedir}/build/lib"/>
<property name="build.test.dir" value="${build.dir}/test"/>
<property name="build.classes" value="${build.dir}/classes"/>
Expand Down Expand Up @@ -166,6 +168,11 @@
<exclude name="**/*-sources.jar"/>
<exclude name="**/ant-*.jar"/>
</fileset>
<fileset dir="${build.scylla-apiclient}">
<include name="**/scylla-apiclient*.jar" />
<exclude name="**/*-sources.jar"/>
<exclude name="**/ant-*.jar"/>
</fileset>
</path>

<macrodef name="create-javadoc">
Expand Down Expand Up @@ -453,6 +460,19 @@
<dependency groupId="com.github.ben-manes.caffeine" artifactId="caffeine" version="2.2.6" />
<dependency groupId="org.jctools" artifactId="jctools-core" version="1.2.1"/>
<dependency groupId="org.ow2.asm" artifactId="asm" version="5.0.4" />

<dependency groupId="org.glassfish.jersey.core" artifactId="jersey-common" version="2.22.1" />
<dependency groupId="javax.ws.rs" artifactId="javax.ws.rs-api" version="2.0.1" />
<dependency groupId="javax.ws.rs" artifactId="jsr311-api" version="1.1.1" />
<dependency groupId="org.glassfish.jersey.core" artifactId="jersey-client" version="2.22.1" />
<dependency groupId="org.glassfish" artifactId="javax.json" version="1.0.4" />
<dependency groupId="javax.activation" artifactId="activation" version="1.1" />
<dependency groupId="com.google.guava" artifactId="guava" version="18.0" />
<dependency groupId="com.google.collections" artifactId="google-collections" version="1.0" />
<dependency groupId="javax.activation" artifactId="activation" version="1.1" />
<dependency groupId="javax.annotation" artifactId="javax.annotation-api" version="1.2" />
<dependency groupId="org.glassfish.jersey.bundles.repackaged" artifactId="jersey-guava" version="2.22.1" />

</dependencyManagement>
<developer id="adelapena" name="Andres de la Peña"/>
<developer id="alakshman" name="Avinash Lakshman"/>
Expand Down Expand Up @@ -816,7 +836,7 @@
depends="maven-ant-tasks-retrieve-build,build-project" description="Compile Cassandra classes"/>
<target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>

<target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
<target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java,mvn-scylla-apiclient-jar"
name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<!-- Order matters! -->
Expand Down Expand Up @@ -1054,6 +1074,17 @@
</jar>
</target>

<target name="mvn-scylla-apiclient-jar">
<artifact:mvn mavenVersion="${maven.version}" pom="${build.scylla-jmx-parent}/pom.xml">
<arg value="-pl"/>
<arg value=":scylla-apiclient"/>
<arg value="package"/>
</artifact:mvn>
<copy todir="${build.lib}">
<fileset dir="${build.scylla-apiclient}" includes="*.jar"/>
</copy>
</target>

<!-- creates release tarballs -->
<target name="artifacts" depends="jar,javadoc,gen-doc"
description="Create Cassandra release artifacts">
Expand All @@ -1069,6 +1100,7 @@
<include name="${final.scylla-tools.name}.jar" />
<include name="${ant.project.name}-thrift-${version}.jar" />
</fileset>
<fileset dir="${build.scylla-apiclient}" includes="*.jar"/>
</copy>
<copy todir="${dist.dir}/javadoc">
<fileset dir="${javadoc.dir}"/>
Expand Down Expand Up @@ -1216,6 +1248,7 @@
<include name="commons*.jar"/>
</zipgroupfileset>
<zipgroupfileset dir="${build.lib}" includes="*.jar"/>
<zipgroupfileset dir="${build.scylla-apiclient}" includes="*.jar"/>
</jar>
<jar jarfile="${build.test.dir}/benchmarks.jar">
<manifest>
Expand Down
Binary file added lib/hk2-api-2.4.0-b31.jar
Binary file not shown.
Binary file added lib/hk2-locator-2.4.0-b31.jar
Binary file not shown.
Binary file added lib/hk2-utils-2.4.0-b31.jar
Binary file not shown.
Binary file added lib/javax.annotation-api-1.2.jar
Binary file not shown.
Binary file added lib/javax.inject-2.4.0-b31.jar
Binary file not shown.
Binary file added lib/javax.json-1.0.4.jar
Binary file not shown.
Binary file added lib/javax.json-api-1.0.jar
Binary file not shown.
Binary file added lib/javax.ws.rs-api-2.0.1.jar
Binary file not shown.
Binary file added lib/jersey-client-2.22.1.jar
Binary file not shown.
Binary file added lib/jersey-common-2.22.1.jar
Binary file not shown.
Binary file added lib/jersey-guava-2.22.1.jar
Binary file not shown.
Binary file added lib/jsr305-2.0.2.jar
Binary file not shown.
Binary file added lib/jsr311-api-1.1.1.jar
Binary file not shown.
Binary file added lib/scylla-apiclient-1.0.jar
Binary file not shown.
1 change: 1 addition & 0 deletions scylla-jmx
Submodule scylla-jmx added at 4303f0
37 changes: 33 additions & 4 deletions src/java/org/apache/cassandra/tools/NodeTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,19 @@ public class NodeTool

public static void main(String... args)
{
List<Class<? extends Runnable>> commands = asList(
boolean REST=true;
for (String arg:args) {
if (arg.startsWith("-r") || arg.startsWith("--protocol")) {
String[] param=arg.split("=");
if (param.length>1) {
if (!"rest".equals(param[1].toLowerCase())) {
System.out.println("Other than REST detected, falling back to jmx");
REST = false; }
}
}
}
List<Class<? extends Runnable>> commands = new ArrayList<>(asList(
Help.class,
Info.class,
Ring.class,
NetStats.class,
CfStats.class,
Expand Down Expand Up @@ -147,7 +157,9 @@ public static void main(String... args)
// Remove until proven otherwise: RefreshSizeEstimates.class
// Remove until proven otherwise: RelocateSSTables.class,
ViewBuildStatus.class
);
));

if (REST) { commands.add(RESTInfo.class); } else { commands.add(Info.class); }

Cli.CliBuilder<Runnable> builder = Cli.builder("nodetool");

Expand Down Expand Up @@ -230,12 +242,18 @@ public static class CommandFailedButNeedNoMoreOutput extends Error {};
public static abstract class NodeToolCmd implements Runnable
{

private final String REST = "rest";
private final String JMX = "jmx";

@Option(type = OptionType.GLOBAL, name = {"-h", "--host"}, description = "Node hostname or ip address")
private String host = "127.0.0.1";

@Option(type = OptionType.GLOBAL, name = {"-p", "--port"}, description = "Remote jmx agent port number")
private String port = "7199";

@Option(type = OptionType.GLOBAL, name = {"-o", "--restport"}, description = "Remote Scylla REST port number")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking short and long version should at least attempt to be similar

private String rport = "10000";

@Option(type = OptionType.GLOBAL, name = {"-u", "--username"}, description = "Remote jmx agent username")
private String username = EMPTY;

Expand All @@ -245,6 +263,9 @@ public static abstract class NodeToolCmd implements Runnable
@Option(type = OptionType.GLOBAL, name = {"-pwf", "--password-file"}, description = "Path to the JMX password file")
private String passwordFilePath = EMPTY;

@Option(type = OptionType.GLOBAL, name = {"-r", "--protocol"}, description = "Use rest(default, only for what is ported) or jmx(legacy) protocol")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking again, the -r is not a great short version of --protocol

private String protocol = REST;

@Override
public void run()
{
Expand Down Expand Up @@ -316,9 +337,17 @@ private NodeProbe connect()
try
{
if (username.isEmpty())
nodeClient = new NodeProbe(host, parseInt(port));
if (REST.equals(protocol)) {
nodeClient = new RESTNodeProbe(host, parseInt(port), parseInt(rport));
} else {
nodeClient = new NodeProbe(host, parseInt(port));
}
else
if (REST.equals(protocol)) {
nodeClient = new RESTNodeProbe(host, parseInt(port), parseInt(rport), username, password);
} else {
nodeClient = new NodeProbe(host, parseInt(port), username, password);
}
} catch (IOException | SecurityException e)
{
Throwable rootCause = Throwables.getRootCause(e);
Expand Down
Loading