HBASE-25930 Thrift does not support requests in Kerberos environment (#3326)

Co-authored-by: sunhaoning <sunhaoning@qianxin.com>
Signed-off-by: Istvan Toth <stoty@apache.org>
Signed-off-by: Balazs Meszaros <meszibalu@apache.org>
This commit is contained in:
Haoning Sun 2021-06-04 14:15:25 +08:00 committed by Balazs Meszaros
parent 2dd7ec9d9e
commit 7102dd0654
1 changed files with 21 additions and 4 deletions

View File

@ -78,6 +78,7 @@ import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.security.PrivilegedAction;
import java.util.List;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
@ -97,6 +98,7 @@ import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.filter.ParseFilter;
import org.apache.hadoop.hbase.http.HttpServerUtil;
import org.apache.hadoop.hbase.http.InfoServer;
import org.apache.hadoop.hbase.log.HBaseMarkers;
import org.apache.hadoop.hbase.security.SaslUtil;
import org.apache.hadoop.hbase.security.SecurityUtil;
import org.apache.hadoop.hbase.security.UserProvider;
@ -844,15 +846,30 @@ public class ThriftServer extends Configured implements Tool {
public int run(String[] strings) throws Exception {
processOptions(strings);
setupParamters();
startInfoServer();
if (httpEnabled) {
setupHTTPServer();
httpServer.start();
httpServer.join();
} else {
setupServer();
tserver.serve();
}
serviceUGI.doAs(new PrivilegedAction<Object>() {
@Override
public Object run() {
try {
startInfoServer();
if (httpEnabled) {
httpServer.start();
httpServer.join();
} else {
tserver.serve();
}
} catch (Exception e) {
LOG.error(HBaseMarkers.FATAL, "Cannot run ThriftServer", e);
System.exit(-1);
}
return null;
}
});
return 0;
}