本文整理汇总了Java中org.apache.cassandra.tools.NodeProbe类的典型用法代码示例。如果您正苦于以下问题:Java NodeProbe类的具体用法?Java NodeProbe怎么用?Java NodeProbe使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeProbe类属于org.apache.cassandra.tools包,在下文中一共展示了NodeProbe类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connectProbe
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
private NodeProbe connectProbe() {
while (true) {
try {
NodeProbe nodeProbe = new NodeProbe("127.0.0.1", task.getConfig().getJmxPort());
logger.info("Node probe is successfully connected to the Cassandra Daemon: port {}",
task.getConfig().getJmxPort());
return nodeProbe;
} catch (Exception ex) {
logger.info("Connection to server failed backing off for 500 ms");
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
}
}
}
示例2: getCassandraStatus
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
private static CassandraStatus getCassandraStatus(final NodeProbe probe) {
return CassandraStatus.create(
CassandraMode.valueOf(
probe.getOperationMode()
), probe.isJoined(),
probe.isThriftServerRunning(),
probe.isNativeTransportRunning(),
probe.isInitialized(),
probe.isGossipRunning(),
probe.getLocalHostId(),
probe.getEndpoint(),
probe.getTokens().size(),
probe.getDataCenter(),
probe.getRack(),
probe.getReleaseVersion());
}
示例3: getNodeProbe
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
public NodeProbe getNodeProbe()
{
try
{
return jmxUsername != null && jmxPassword != null
? new NodeProbe(hostName, jmxPort, jmxUsername, jmxPassword)
: new NodeProbe(hostName, jmxPort);
}
catch (Exception e)
{
JVMStabilityInspector.inspectThrowable(e);
err.printf("WARNING: Could not connect to the JMX on %s:%d - some information won't be shown.%n%n", hostName, jmxPort);
}
return null;
}
示例4: call
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
public GcStats call() throws Exception
{
final List<Future<GcStats>> futures = new ArrayList<>();
for (final NodeProbe probe : probes)
{
futures.add(TPE.submit(new Callable<GcStats>()
{
public GcStats call() throws Exception
{
final double[] stats = probe.getAndResetGCStats();
return new GcStats(stats[5], stats[4], stats[1], stats[2], stats[3]);
}
}));
}
List<GcStats> results = new ArrayList<>();
for (Future<GcStats> future : futures)
results.add(future.get());
return GcStats.aggregate(results);
}
示例5: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
switch (removeOperation)
{
case "status":
System.out.println("RemovalStatus: " + probe.getRemovalStatus());
break;
case "force":
System.out.println("RemovalStatus: " + probe.getRemovalStatus());
probe.forceRemoveCompletion();
break;
default:
probe.removeNode(removeOperation);
break;
}
}
示例6: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.forceKeyspaceCompaction(splitOutput, keyspace, tableNames);
} catch (Exception e)
{
throw new RuntimeException("Error occurred during compaction", e);
}
}
}
示例7: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.forceKeyspaceFlush(keyspace, tableNames);
} catch (Exception e)
{
throw new RuntimeException("Error occurred during flushing", e);
}
}
}
示例8: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.verify(System.out, extendedVerify, keyspace, tableNames);
} catch (Exception e)
{
throw new RuntimeException("Error occurred during verifying", e);
}
}
}
示例9: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.enableAutoCompaction(keyspace, tableNames);
} catch (IOException e)
{
throw new RuntimeException("Error occurred during enabling auto-compaction", e);
}
}
}
示例10: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.upgradeSSTables(System.out, keyspace, !includeAll, jobs, tableNames);
}
catch (Exception e)
{
throw new RuntimeException("Error occurred during enabling auto-compaction", e);
}
}
}
示例11: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
System.out.printf("%-25s%10s%10s%15s%10s%18s%n", "Pool Name", "Active", "Pending", "Completed", "Blocked", "All time blocked");
Multimap<String, String> threadPools = probe.getThreadPools();
for (Map.Entry<String, String> tpool : threadPools.entries())
{
System.out.printf("%-25s%10s%10s%15s%10s%18s%n",
tpool.getValue(),
probe.getThreadPoolMetric(tpool.getKey(), tpool.getValue(), "ActiveTasks"),
probe.getThreadPoolMetric(tpool.getKey(), tpool.getValue(), "PendingTasks"),
probe.getThreadPoolMetric(tpool.getKey(), tpool.getValue(), "CompletedTasks"),
probe.getThreadPoolMetric(tpool.getKey(), tpool.getValue(), "CurrentlyBlockedTasks"),
probe.getThreadPoolMetric(tpool.getKey(), tpool.getValue(), "TotalBlockedTasks"));
}
System.out.printf("%n%-20s%10s%n", "Message type", "Dropped");
for (Map.Entry<String, Integer> entry : probe.getDroppedMessages().entrySet())
System.out.printf("%-20s%10s%n", entry.getKey(), entry.getValue());
}
示例12: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe);
String[] tablenames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
try
{
probe.disableAutoCompaction(keyspace, tablenames);
} catch (IOException e)
{
throw new RuntimeException("Error occurred during disabling auto-compaction", e);
}
}
}
示例13: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
List<String> keyspaces = parseOptionalKeyspace(args, probe, KeyspaceSet.NON_LOCAL_STRATEGY);
String[] tableNames = parseOptionalTables(args);
for (String keyspace : keyspaces)
{
if (Schema.isSystemKeyspace(keyspace))
continue;
try
{
probe.forceKeyspaceCleanup(System.out, jobs, keyspace, tableNames);
}
catch (Exception e)
{
throw new RuntimeException("Error occurred during cleanup", e);
}
}
}
示例14: getOffHeapMemoryUsed
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
/**
* Returns the total off heap memory used in MB.
* @return the total off heap memory used in MB.
*/
private static double getOffHeapMemoryUsed(NodeProbe probe)
{
long offHeapMemUsedInBytes = 0;
// get a list of column family stores
Iterator<Map.Entry<String, ColumnFamilyStoreMBean>> cfamilies = probe.getColumnFamilyStoreMBeanProxies();
while (cfamilies.hasNext())
{
Entry<String, ColumnFamilyStoreMBean> entry = cfamilies.next();
String keyspaceName = entry.getKey();
String cfName = entry.getValue().getColumnFamilyName();
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "MemtableOffHeapSize");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "BloomFilterOffHeapMemoryUsed");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "IndexSummaryOffHeapMemoryUsed");
offHeapMemUsedInBytes += (Long) probe.getColumnFamilyMetric(keyspaceName, cfName, "CompressionMetadataOffHeapMemoryUsed");
}
return offHeapMemUsedInBytes / (1024d * 1024);
}
示例15: execute
import org.apache.cassandra.tools.NodeProbe; //导入依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
// display cluster name, snitch and partitioner
System.out.println("Cluster Information:");
System.out.println("\tName: " + probe.getClusterName());
System.out.println("\tSnitch: " + probe.getEndpointSnitchInfoProxy().getSnitchName());
System.out.println("\tPartitioner: " + probe.getPartitioner());
// display schema version for each node
System.out.println("\tSchema versions:");
Map<String, List<String>> schemaVersions = probe.getSpProxy().getSchemaVersions();
for (String version : schemaVersions.keySet())
{
System.out.println(format("\t\t%s: %s%n", version, schemaVersions.get(version)));
}
}