HBASE-14517 Show regionserver's version in master status page (Liu Shaohui)
This commit is contained in:
parent
2e8e32f746
commit
445dbd8a0e
|
@ -3128,8 +3128,8 @@ public final class ProtobufUtil {
|
|||
*
|
||||
* @return the converted protocol buffer VersionInfo
|
||||
*/
|
||||
public static RPCProtos.VersionInfo getVersionInfo() {
|
||||
RPCProtos.VersionInfo.Builder builder = RPCProtos.VersionInfo.newBuilder();
|
||||
public static HBaseProtos.VersionInfo getVersionInfo() {
|
||||
HBaseProtos.VersionInfo.Builder builder = HBaseProtos.VersionInfo.newBuilder();
|
||||
builder.setVersion(VersionInfo.getVersion());
|
||||
builder.setUrl(VersionInfo.getUrl());
|
||||
builder.setRevision(VersionInfo.getRevision());
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -231,9 +231,20 @@ message NamespaceDescriptor {
|
|||
repeated NameStringPair configuration = 2;
|
||||
}
|
||||
|
||||
// Rpc client version info proto. Included in ConnectionHeader on connection setup
|
||||
message VersionInfo {
|
||||
required string version = 1;
|
||||
required string url = 2;
|
||||
required string revision = 3;
|
||||
required string user = 4;
|
||||
required string date = 5;
|
||||
required string src_checksum = 6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Description of the region server info
|
||||
*/
|
||||
message RegionServerInfo {
|
||||
optional int32 infoPort = 1;
|
||||
optional VersionInfo version_info = 2;
|
||||
}
|
||||
|
|
|
@ -78,16 +78,6 @@ message UserInformation {
|
|||
optional string real_user = 2;
|
||||
}
|
||||
|
||||
// Rpc client version info proto. Included in ConnectionHeader on connection setup
|
||||
message VersionInfo {
|
||||
required string version = 1;
|
||||
required string url = 2;
|
||||
required string revision = 3;
|
||||
required string user = 4;
|
||||
required string date = 5;
|
||||
required string src_checksum = 6;
|
||||
}
|
||||
|
||||
// This is sent on connection setup after the connection preamble is sent.
|
||||
message ConnectionHeader {
|
||||
optional UserInformation user_info = 1;
|
||||
|
|
|
@ -25,17 +25,10 @@ HMaster master;
|
|||
|
||||
<%import>
|
||||
java.util.*;
|
||||
org.apache.hadoop.util.StringUtils;
|
||||
org.apache.hadoop.hbase.util.Bytes;
|
||||
org.apache.hadoop.hbase.util.JvmVersion;
|
||||
org.apache.hadoop.hbase.util.FSUtils;
|
||||
org.apache.hadoop.hbase.master.HMaster;
|
||||
org.apache.hadoop.hbase.HConstants;
|
||||
org.apache.hadoop.hbase.ServerLoad;
|
||||
org.apache.hadoop.hbase.ServerName;
|
||||
org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
org.apache.hadoop.hbase.HTableDescriptor;
|
||||
org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
org.apache.hadoop.hbase.util.VersionInfo;
|
||||
</%import>
|
||||
|
||||
|
||||
|
@ -83,15 +76,23 @@ Arrays.sort(serverNames);
|
|||
<tr>
|
||||
<th>ServerName</th>
|
||||
<th>Start time</th>
|
||||
<th>Version</th>
|
||||
<th>Requests Per Second</th>
|
||||
<th>Num. Regions</th>
|
||||
</tr>
|
||||
<%java>
|
||||
int totalRegions = 0;
|
||||
int totalRequests = 0;
|
||||
int inconsistentNodeNum = 0;
|
||||
String masterVersion = VersionInfo.getVersion();
|
||||
for (ServerName serverName: serverNames) {
|
||||
|
||||
ServerLoad sl = master.getServerManager().getLoad(serverName);
|
||||
String version = master.getRegionServerVersion(serverName);
|
||||
if (!masterVersion.equals(version)) {
|
||||
inconsistentNodeNum ++;
|
||||
}
|
||||
|
||||
double requestsPerSecond = 0.0;
|
||||
int numRegionsOnline = 0;
|
||||
|
||||
|
@ -107,6 +108,7 @@ Arrays.sort(serverNames);
|
|||
<tr>
|
||||
<td><& serverNameLink; serverName=serverName; serverLoad = sl; &></td>
|
||||
<td><% new Date(startcode) %></td>
|
||||
<td><% version %></td>
|
||||
<td><% String.format("%.0f", requestsPerSecond) %></td>
|
||||
<td><% numRegionsOnline %></td>
|
||||
</tr>
|
||||
|
@ -115,6 +117,11 @@ Arrays.sort(serverNames);
|
|||
</%java>
|
||||
<tr><td>Total:<% servers.size() %></td>
|
||||
<td></td>
|
||||
<%if inconsistentNodeNum > 0%>
|
||||
<td style="color:red;"><% inconsistentNodeNum %> nodes with inconsistent version</td>
|
||||
<%else>
|
||||
<td></td>
|
||||
</%if>
|
||||
<td><% totalRequests %></td>
|
||||
<td><% totalRegions %></td>
|
||||
</tr>
|
||||
|
@ -285,7 +292,7 @@ if (sl.getTotalCompactingKVs() > 0) {
|
|||
String url = "//" + serverName.getHostname() + ":" + infoPort + "/rs-status";
|
||||
</%java>
|
||||
|
||||
<%if (infoPort > 0) %>
|
||||
<%if infoPort > 0%>
|
||||
<a href="<% url %>"><% serverName.getServerName() %></a>
|
||||
<%else>
|
||||
<% serverName.getServerName() %>
|
||||
|
|
|
@ -19,9 +19,9 @@ package org.apache.hadoop.hbase.ipc;
|
|||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.VersionInfo;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo;
|
||||
|
||||
public interface RpcCallContext extends Delayable {
|
||||
/**
|
||||
|
|
|
@ -85,13 +85,13 @@ import org.apache.hadoop.hbase.io.ByteBufferOutputStream;
|
|||
import org.apache.hadoop.hbase.io.BoundedByteBufferPool;
|
||||
import org.apache.hadoop.hbase.monitoring.MonitoredRPCHandler;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.VersionInfo;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.CellBlockMeta;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ConnectionHeader;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ExceptionResponse;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.RequestHeader;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.ResponseHeader;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.UserInformation;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo;
|
||||
import org.apache.hadoop.hbase.regionserver.HRegionServer;
|
||||
import org.apache.hadoop.hbase.security.AccessDeniedException;
|
||||
import org.apache.hadoop.hbase.security.AuthMethod;
|
||||
|
|
|
@ -2107,6 +2107,14 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
|||
return info.getInfoPort();
|
||||
}
|
||||
|
||||
public String getRegionServerVersion(final ServerName sn) {
|
||||
RegionServerInfo info = this.regionServerTracker.getRegionServerInfo(sn);
|
||||
if (info != null && info.hasVersionInfo()) {
|
||||
return info.getVersionInfo().getVersion();
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array of coprocessor SimpleNames.
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
|
|||
import org.apache.hadoop.hbase.ipc.RpcServer;
|
||||
import org.apache.hadoop.hbase.ipc.RpcCallContext;
|
||||
import org.apache.hadoop.hbase.procedure2.Procedure;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.VersionInfo;
|
||||
|
||||
/**
|
||||
* Latch used by the Master to have the prepare() sync behaviour for old
|
||||
|
|
|
@ -1412,6 +1412,7 @@ public class HRegionServer extends HasThread implements
|
|||
private void createMyEphemeralNode() throws KeeperException, IOException {
|
||||
RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder();
|
||||
rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1);
|
||||
rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo());
|
||||
byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray());
|
||||
ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper,
|
||||
getMyEphemeralNodePath(), data);
|
||||
|
|
Loading…
Reference in New Issue