HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled (#2123)

Signed-off-by: Elliot Miller <elliot_miller@apple.com>
This commit is contained in:
Pankaj 2020-07-28 21:40:42 +05:30 committed by stack
parent 2720a9d93e
commit 6ded070f82
1 changed files with 11 additions and 10 deletions

View File

@ -76,22 +76,23 @@ module Hbase
# Returns a filtered list of tasks on the given host
def tasksOnHost(filter, host)
java_import 'java.net.URL'
java_import 'java.net.SocketException'
java_import 'java.io.InputStreamReader'
java_import 'org.apache.hbase.thirdparty.com.google.gson.JsonParser'
infoport = @admin.getClusterStatus.getLoad(host).getInfoServerPort.to_s
# Note: This condition use constants from hbase-server
# if (!@admin.getConfiguration().getBoolean(org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_KEY,
# org.apache.hadoop.hbase.http.ServerConfigurationKeys::HBASE_SSL_ENABLED_DEFAULT))
# schema = "http://"
# else
# schema = "https://"
# end
schema = 'http://'
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
begin
schema = "http://"
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
json = URL.new(url).openStream
rescue SocketException => e
# Let's try with https when SocketException occur
schema = "https://"
url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter
json = URL.new(url).openStream
end
json = URL.new(url).openStream
parser = JsonParser.new
# read and parse JSON