Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
vongosling committed Sep 18, 2016
1 parent ff707ca commit c9bc70a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 697 deletions.
5 changes: 0 additions & 5 deletions rocketmq-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,5 @@
<artifactId>github-api</artifactId>
<version>1.59</version>
</dependency>
<dependency>
<groupId>com.taobao.tlog</groupId>
<artifactId>tlog-client</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
defaultMQAdminExt.start();

defaultMQAdminExt.updateBrokerConfig(brokerAddr, properties);
System.out.printf("update broker config success, %s%n", brokerAddr);
System.out.printf("update broker config success, %s\n", brokerAddr);
return;

} else if (commandLine.hasOption('c')) {
Expand All @@ -97,8 +97,12 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
Set<String> masterSet =
CommandUtil.fetchMasterAddrByClusterName(defaultMQAdminExt, clusterName);
for (String brokerAddr : masterSet) {
defaultMQAdminExt.updateBrokerConfig(brokerAddr, properties);
System.out.printf("update broker config success, %s%n", brokerAddr);
try {
defaultMQAdminExt.updateBrokerConfig(brokerAddr, properties);
System.out.printf("update broker config success, %s\n", brokerAddr);
} catch (Exception e) {
e.printStackTrace();
}
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,17 @@ private void printClusterBaseInfo(final DefaultMQAdminExt defaultMQAdminExt) thr

ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo();

System.out.printf("%-16s %-22s %-4s %-22s %-16s %19s %19s %10s%n",//
System.out.printf("%-16s %-22s %-4s %-22s %-16s %19s %19s %10s %5s %6s%n",//
"#Cluster Name",//
"#Broker Name",//
"#BID",//
"#Addr",//
"#Version",//
"#InTPS(LOAD)",//
"#OutTPS(LOAD)",//
"#PCWait(ms)"//
"#PCWait(ms)",//
"#Hour",//
"#SPACE"//
);

Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator();
Expand All @@ -207,6 +209,8 @@ private void printClusterBaseInfo(final DefaultMQAdminExt defaultMQAdminExt) thr
String sendThreadPoolQueueHeadWaitTimeMills = "";
String pullThreadPoolQueueHeadWaitTimeMills = "";
String pageCacheLockTimeMills = "";
String earliestMessageTimeStamp = "";
String commitLogDiskRatio = "";
try {
KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue());
String putTps = kvTable.getTable().get("putTps");
Expand All @@ -220,6 +224,8 @@ private void printClusterBaseInfo(final DefaultMQAdminExt defaultMQAdminExt) thr
sendThreadPoolQueueHeadWaitTimeMills = kvTable.getTable().get("sendThreadPoolQueueHeadWaitTimeMills");
pullThreadPoolQueueHeadWaitTimeMills = kvTable.getTable().get("pullThreadPoolQueueHeadWaitTimeMills");
pageCacheLockTimeMills = kvTable.getTable().get("pageCacheLockTimeMills");
earliestMessageTimeStamp = kvTable.getTable().get("earliestMessageTimeStamp");
commitLogDiskRatio = kvTable.getTable().get("commitLogDiskRatio");

version = kvTable.getTable().get("brokerVersionDesc");
{
Expand All @@ -238,15 +244,29 @@ private void printClusterBaseInfo(final DefaultMQAdminExt defaultMQAdminExt) thr
} catch (Exception e) {
}

System.out.printf("%-16s %-22s %-4s %-22s %-16s %19s %19s %10s%n",//
double hour = 0.0;
double space = 0.0;

if (earliestMessageTimeStamp != null && earliestMessageTimeStamp.length() > 0) {
long mills = System.currentTimeMillis() - Long.valueOf(earliestMessageTimeStamp);
hour = mills / 1000.0 / 60.0 / 60.0;
}

if (commitLogDiskRatio != null && commitLogDiskRatio.length() > 0) {
space = Double.valueOf(commitLogDiskRatio);
}

System.out.printf("%-16s %-22s %-4s %-22s %-16s %19s %19s %10s %5s %6s%n",//
clusterName,//
brokerName,//
String.valueOf(next1.getKey()),//
next1.getKey().longValue(),//
next1.getValue(),//
version,//
String.format("%9.2f(%s,%sms)", in, sendThreadPoolQueueSize, sendThreadPoolQueueHeadWaitTimeMills),//
String.format("%9.2f(%s,%sms)", out, pullThreadPoolQueueSize, pullThreadPoolQueueHeadWaitTimeMills),//
pageCacheLockTimeMills
pageCacheLockTimeMills,//
String.format("%2.2f", hour),//
String.format("%.4f", space)//
);
}
}
Expand Down
Loading

0 comments on commit c9bc70a

Please sign in to comment.