HDFS-12466. Ozone: KSM: Make ozone.ksm.address as mandatory property for client. Contributed by Nandakumar.
This commit is contained in:
parent
8ddf75da17
commit
3b290fe3bf
@ -158,7 +158,6 @@ private static ClientProtocol getProtocolClass(ClientType clientType)
|
|||||||
return ctor.newInstance(getConfiguration());
|
return ctor.newInstance(getConfiguration());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
final String message = "Couldn't create protocol " + protocolClass;
|
final String message = "Couldn't create protocol " + protocolClass;
|
||||||
LOG.warn(message, e);
|
|
||||||
if (e.getCause() instanceof IOException) {
|
if (e.getCause() instanceof IOException) {
|
||||||
throw (IOException) e.getCause();
|
throw (IOException) e.getCause();
|
||||||
} else {
|
} else {
|
||||||
|
@ -321,6 +321,32 @@ public static InetSocketAddress getKsmAddress(
|
|||||||
port.or(OZONE_KSM_PORT_DEFAULT));
|
port.or(OZONE_KSM_PORT_DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the socket address that should be used by clients to connect
|
||||||
|
* to KSM.
|
||||||
|
* @param conf
|
||||||
|
* @return Target InetSocketAddress for the KSM service endpoint.
|
||||||
|
*/
|
||||||
|
public static InetSocketAddress getKsmAddressForClients(
|
||||||
|
Configuration conf) {
|
||||||
|
final Optional<String> host = getHostNameFromConfigKeys(conf,
|
||||||
|
OZONE_KSM_ADDRESS_KEY);
|
||||||
|
|
||||||
|
if (!host.isPresent()) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
OZONE_KSM_ADDRESS_KEY + " must be defined. See" +
|
||||||
|
" https://wiki.apache.org/hadoop/Ozone#Configuration for" +
|
||||||
|
" details on configuring Ozone.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no port number is specified then we'll just try the defaultBindPort.
|
||||||
|
final Optional<Integer> port = getPortNumberFromConfigKeys(conf,
|
||||||
|
OZONE_KSM_ADDRESS_KEY);
|
||||||
|
|
||||||
|
return NetUtils.createSocketAddr(
|
||||||
|
host.get() + ":" + port.or(OZONE_KSM_PORT_DEFAULT));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the socket address that is used by CBlock Service.
|
* Retrieve the socket address that is used by CBlock Service.
|
||||||
* @param conf
|
* @param conf
|
||||||
|
@ -106,6 +106,19 @@ public RpcClient(Configuration conf) throws IOException {
|
|||||||
this.groupRights = conf.getEnum(KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS,
|
this.groupRights = conf.getEnum(KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS,
|
||||||
KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS_DEFAULT);
|
KSMConfigKeys.OZONE_KSM_GROUP_RIGHTS_DEFAULT);
|
||||||
|
|
||||||
|
long ksmVersion =
|
||||||
|
RPC.getProtocolVersion(KeySpaceManagerProtocolPB.class);
|
||||||
|
InetSocketAddress ksmAddress = OzoneClientUtils
|
||||||
|
.getKsmAddressForClients(conf);
|
||||||
|
RPC.setProtocolEngine(conf, KeySpaceManagerProtocolPB.class,
|
||||||
|
ProtobufRpcEngine.class);
|
||||||
|
this.keySpaceManagerClient =
|
||||||
|
new KeySpaceManagerProtocolClientSideTranslatorPB(
|
||||||
|
RPC.getProxy(KeySpaceManagerProtocolPB.class, ksmVersion,
|
||||||
|
ksmAddress, UserGroupInformation.getCurrentUser(), conf,
|
||||||
|
NetUtils.getDefaultSocketFactory(conf),
|
||||||
|
Client.getRpcTimeout(conf)));
|
||||||
|
|
||||||
long scmVersion =
|
long scmVersion =
|
||||||
RPC.getProtocolVersion(StorageContainerLocationProtocolPB.class);
|
RPC.getProtocolVersion(StorageContainerLocationProtocolPB.class);
|
||||||
InetSocketAddress scmAddress =
|
InetSocketAddress scmAddress =
|
||||||
@ -119,18 +132,6 @@ public RpcClient(Configuration conf) throws IOException {
|
|||||||
NetUtils.getDefaultSocketFactory(conf),
|
NetUtils.getDefaultSocketFactory(conf),
|
||||||
Client.getRpcTimeout(conf)));
|
Client.getRpcTimeout(conf)));
|
||||||
|
|
||||||
long ksmVersion =
|
|
||||||
RPC.getProtocolVersion(KeySpaceManagerProtocolPB.class);
|
|
||||||
InetSocketAddress ksmAddress = OzoneClientUtils.getKsmAddress(conf);
|
|
||||||
RPC.setProtocolEngine(conf, KeySpaceManagerProtocolPB.class,
|
|
||||||
ProtobufRpcEngine.class);
|
|
||||||
this.keySpaceManagerClient =
|
|
||||||
new KeySpaceManagerProtocolClientSideTranslatorPB(
|
|
||||||
RPC.getProxy(KeySpaceManagerProtocolPB.class, ksmVersion,
|
|
||||||
ksmAddress, UserGroupInformation.getCurrentUser(), conf,
|
|
||||||
NetUtils.getDefaultSocketFactory(conf),
|
|
||||||
Client.getRpcTimeout(conf)));
|
|
||||||
|
|
||||||
this.xceiverClientManager = new XceiverClientManager(conf);
|
this.xceiverClientManager = new XceiverClientManager(conf);
|
||||||
|
|
||||||
int configuredChunkSize = conf.getInt(
|
int configuredChunkSize = conf.getInt(
|
||||||
|
@ -529,7 +529,7 @@
|
|||||||
|
|
||||||
<property>
|
<property>
|
||||||
<name>ozone.ksm.address</name>
|
<name>ozone.ksm.address</name>
|
||||||
<value>0.0.0.0</value>
|
<value></value>
|
||||||
<description>
|
<description>
|
||||||
The address of the Ozone KSM service.
|
The address of the Ozone KSM service.
|
||||||
</description>
|
</description>
|
||||||
|
Loading…
Reference in New Issue
Block a user