Rules
Use YarnClient. createYarnClient() to create a client
Do not directly use the protocol interface ClientRMProxy.createRMProxy(config,ApplicationClientProtocol.class) to create a client.
The Application Master uses the asynchronous interface AMRMClientAsync.createAMRMClientAsync() to interact with the ResourceManager
Do not directly use the protocol interface ClientRMProxy.createRMProxy(config,ApplicationMasterProtocol.class) to create a client used by the Application Master to interact with the ResourceManager.
The Application Master uses the asynchronous interface AMRMClientAsync.createAMRMClientAsync() to interact with the NodeMabager
Do not directly use the ContainerManagementProtocolProxy interface to create a client used by the Application Master to interact with the NodeManager.
Multithread security login mode
If multiple threads are performing login operations, the relogin mode must be used for the subsequent logins of all threads after the first successful login of an application.
login example code:
private Boolean login(Configuration conf){
boolean flag = false;
UserGroupInformation.setConfiguration(conf);
try {
UserGroupInformation.loginUserFromKeytab(conf.get(PRINCIPAL), conf.get(KEYTAB));
System.out.println("UserGroupInformation.isLoginKeytabBased(): " +UserGroupInformation.isLoginKeytabBased());
flag = true;
} catch (IOException e) {
e.printStackTrace();
}
return flag;
} relogin example code:
public Boolean relogin(){
boolean flag = false;
try {
UserGroupInformation.getLoginUser().reloginFromKeytab();
System.out.println("UserGroupInformation.isLoginKeytabBased(): " +UserGroupInformation.isLoginKeytabBased());
flag = true;
} catch (IOException e) {
e.printStackTrace();
}
return flag;
} Last Article: Application Scenarios
Next Article: Manager Management Development Guide
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.