From 891e174163c2051fd27d5dff094d84c9024d4e9c Mon Sep 17 00:00:00 2001 From: Pankaj Date: Thu, 23 Jul 2020 09:03:50 +0530 Subject: [PATCH 1/2] HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled --- hbase-shell/src/main/ruby/hbase/taskmonitor.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb index 02c84320c13c..c00a5e85a733 100644 --- a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb +++ b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb @@ -80,13 +80,12 @@ def tasksOnHost(filter, host) infoport = @admin.getClusterMetrics.getLiveServerMetrics.get(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://' + 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 url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter json = URL.new(url).openStream From 5429625534fe7dba9a0ec96134e7d1a4be8a5d2a Mon Sep 17 00:00:00 2001 From: Pankaj Date: Tue, 28 Jul 2020 19:43:20 +0530 Subject: [PATCH 2/2] HBASE-24738 [Shell] processlist command fails with ERROR: Unexpected end of file from server when SSL enabled --- hbase-shell/src/main/ruby/hbase/taskmonitor.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb index c00a5e85a733..c9cb042d341c 100644 --- a/hbase-shell/src/main/ruby/hbase/taskmonitor.rb +++ b/hbase-shell/src/main/ruby/hbase/taskmonitor.rb @@ -74,21 +74,23 @@ def initialize(configuration) # 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.getClusterMetrics.getLiveServerMetrics.get(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)) + begin schema = "http://" - else + 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 - url = schema + host.hostname + ':' + infoport + '/rs-status?format=json&filter=' + filter - json = URL.new(url).openStream parser = JsonParser.new # read and parse JSON