- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 6
feat: HBase resolvable endpoints #1159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 14 commits
      Commits
    
    
            Show all changes
          
          
            27 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      0fbe36b
              
                patches I
              
              
                adwk67 b5f96d5
              
                patches I
              
              
                adwk67 303739e
              
                wip: patch hbase to use listener endpoints
              
              
                adwk67 8dc1c99
              
                changed rendering
              
              
                adwk67 bd17a9e
              
                rework patch for UI
              
              
                adwk67 4a5df3b
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                nightkr 2a2a5ac
              
                Consistently override the advertised ports
              
              
                nightkr 9ef046c
              
                add listener endpoint and info port to hbase-site.xml
              
              
                adwk67 99fd166
              
                patch and entrypoint refactoring
              
              
                adwk67 9953042
              
                hbase: use listener service for region mover
              
              
                adwk67 9b02ec8
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                adwk67 4b6b849
              
                hbase: patch for 2.6.2 endpoints
              
              
                adwk67 be89d58
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                adwk67 ceba85b
              
                removed dead variable
              
              
                adwk67 f08e1c5
              
                Update hbase/stackable/patches/2.6.1/0005-Allow-overriding-ipc-bind-p…
              
              
                adwk67 d98ac32
              
                Update hbase/stackable/patches/2.6.1/0005-Allow-overriding-ipc-bind-p…
              
              
                adwk67 bd0b75e
              
                review comments: added constants etc.
              
              
                adwk67 a6a7e10
              
                merge main and fix conflicts
              
              
                adwk67 de0c6c7
              
                set RPC_CLIENT_SPECIFY_HOST to true by default
              
              
                adwk67 496444d
              
                corrected constant descriptions
              
              
                adwk67 3fa6301
              
                updated 2.6.2 patch
              
              
                adwk67 ee7ea2e
              
                patch 2.6.1 to reverse bound/advertised properties
              
              
                adwk67 7a4340e
              
                property re-working for 2.6.2
              
              
                adwk67 f3d3596
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                adwk67 65aaae2
              
                provide advertised port as a fallback, removed changes to test class
              
              
                adwk67 528b8b5
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                adwk67 668365b
              
                Merge branch 'main' into feat/hbase-resolvable-endpoints
              
              
                adwk67 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            195 changes: 195 additions & 0 deletions
          
          195 
        
  ...e/stackable/patches/2.6.1/0005-Allow-overriding-ipc-bind-port-and-use-alternative-p.patch
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| From f2360ad266a17eb342eb826ae9dad08d3293b580 Mon Sep 17 00:00:00 2001 | ||
| From: =?UTF-8?q?Natalie=20Klestrup=20R=C3=B6ijezon?= <[email protected]> | ||
| Date: Fri, 30 May 2025 14:26:26 +0200 | ||
| Subject: Allow overriding ipc bind port and use alternative port from listener | ||
|  | ||
| --- | ||
| .../apache/hadoop/hbase/master/HMaster.java | 11 ++++++-- | ||
| .../hbase/regionserver/HRegionServer.java | 28 +++++++++++++------ | ||
| .../hbase/regionserver/RSRpcServices.java | 4 +-- | ||
| 3 files changed, 30 insertions(+), 13 deletions(-) | ||
|  | ||
| diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java | ||
| index 3fe5abac27..6d40db77ae 100644 | ||
| --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java | ||
| +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java | ||
| @@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.master; | ||
| import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_COORDINATED_BY_ZK; | ||
| import static org.apache.hadoop.hbase.HConstants.HBASE_MASTER_LOGCLEANER_PLUGINS; | ||
| import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK; | ||
| +import static org.apache.hadoop.hbase.HConstants.MASTER_PORT; | ||
| import static org.apache.hadoop.hbase.master.cleaner.HFileCleaner.CUSTOM_POOL_SIZE; | ||
| import static org.apache.hadoop.hbase.util.DNS.MASTER_HOSTNAME_KEY; | ||
|  | ||
| @@ -559,6 +560,11 @@ public class HMaster extends HRegionServer implements MasterServices { | ||
| return conf.get(MASTER_HOSTNAME_KEY); | ||
| } | ||
|  | ||
| + @Override | ||
| + protected int getUseThisPortInstead(Configuration conf) { | ||
| + return conf.getInt(MASTER_PORT, this.rpcServices.getSocketAddress().getPort()); | ||
| + } | ||
| + | ||
| private void registerConfigurationObservers() { | ||
| configurationManager.registerObserver(this.rpcServices); | ||
| configurationManager.registerObserver(this); | ||
| @@ -586,8 +592,7 @@ public class HMaster extends HRegionServer implements MasterServices { | ||
| registerConfigurationObservers(); | ||
| Threads.setDaemonThreadRunning(new Thread(() -> TraceUtil.trace(() -> { | ||
| try { | ||
| - int infoPort = putUpJettyServer(); | ||
|         
                  adwk67 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| - startActiveMasterManager(infoPort); | ||
| + startActiveMasterManager(useThisInfoPortInstead); | ||
| } catch (Throwable t) { | ||
| // Make sure we log the exception. | ||
| String error = "Failed to become Active Master"; | ||
| @@ -2991,7 +2996,7 @@ public class HMaster extends HRegionServer implements MasterServices { | ||
| } | ||
| case MASTER_INFO_PORT: { | ||
| if (infoServer != null) { | ||
| - builder.setMasterInfoPort(infoServer.getPort()); | ||
| + builder.setMasterInfoPort(useThisInfoPortInstead); | ||
| } | ||
| break; | ||
| } | ||
| diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java | ||
| index 27bcef2f06..80949070fd 100644 | ||
| --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java | ||
| +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java | ||
| @@ -24,6 +24,7 @@ import static org.apache.hadoop.hbase.HConstants.DEFAULT_HBASE_SPLIT_WAL_MAX_SPL | ||
| import static org.apache.hadoop.hbase.HConstants.DEFAULT_SLOW_LOG_SYS_TABLE_CHORE_DURATION; | ||
| import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_COORDINATED_BY_ZK; | ||
| import static org.apache.hadoop.hbase.HConstants.HBASE_SPLIT_WAL_MAX_SPLITTER; | ||
| +import static org.apache.hadoop.hbase.HConstants.REGIONSERVER_PORT; | ||
| import static org.apache.hadoop.hbase.master.waleventtracker.WALEventTrackerTableCreator.WAL_EVENT_TRACKER_ENABLED_DEFAULT; | ||
| import static org.apache.hadoop.hbase.master.waleventtracker.WALEventTrackerTableCreator.WAL_EVENT_TRACKER_ENABLED_KEY; | ||
| import static org.apache.hadoop.hbase.namequeues.NamedQueueServiceChore.NAMED_QUEUE_CHORE_DURATION_DEFAULT; | ||
| @@ -505,6 +506,10 @@ public class HRegionServer extends Thread | ||
| */ | ||
| protected String useThisHostnameInstead; | ||
|  | ||
| + protected int useThisPortInstead; | ||
| + | ||
| + protected int useThisInfoPortInstead; | ||
| + | ||
| /** | ||
| * @deprecated since 2.4.0 and will be removed in 4.0.0. Use | ||
| * {@link HRegionServer#UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY} instead. | ||
| @@ -669,6 +674,8 @@ public class HRegionServer extends Thread | ||
| this.namedQueueRecorder = NamedQueueRecorder.getInstance(this.conf); | ||
| rpcServices = createRpcServices(); | ||
| useThisHostnameInstead = getUseThisHostnameInstead(conf); | ||
| + useThisPortInstead = getUseThisPortInstead(conf); | ||
| + useThisInfoPortInstead = conf.getInt("hbase.info.port" , this.infoServer != null ? this.infoServer.getPort() : -1); | ||
|         
                  nightkr marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved         
                  nightkr marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| // if use-ip is enabled, we will use ip to expose Master/RS service for client, | ||
| // see HBASE-27304 for details. | ||
| @@ -678,7 +685,7 @@ public class HRegionServer extends Thread | ||
| useIp ? rpcServices.isa.getAddress().getHostAddress() : rpcServices.isa.getHostName(); | ||
| String hostName = | ||
| StringUtils.isBlank(useThisHostnameInstead) ? isaHostName : useThisHostnameInstead; | ||
| - serverName = ServerName.valueOf(hostName, this.rpcServices.isa.getPort(), this.startcode); | ||
| + serverName = ServerName.valueOf(hostName, useThisPortInstead, this.startcode); | ||
|  | ||
| rpcControllerFactory = RpcControllerFactory.instantiate(this.conf); | ||
| rpcRetryingCallerFactory = RpcRetryingCallerFactory.instantiate(this.conf, | ||
| @@ -715,7 +722,7 @@ public class HRegionServer extends Thread | ||
|  | ||
| // Some unit tests don't need a cluster, so no zookeeper at all | ||
| // Open connection to zookeeper and set primary watcher | ||
| - zooKeeper = new ZKWatcher(conf, getProcessName() + ":" + rpcServices.isa.getPort(), this, | ||
| + zooKeeper = new ZKWatcher(conf, getProcessName() + ":" + useThisPortInstead, this, | ||
| canCreateBaseZNode()); | ||
| // If no master in cluster, skip trying to track one or look for a cluster status. | ||
| if (!this.masterless) { | ||
| @@ -776,6 +783,10 @@ public class HRegionServer extends Thread | ||
| } | ||
| } | ||
|  | ||
| + protected int getUseThisPortInstead(Configuration conf) { | ||
| + return conf.getInt(REGIONSERVER_PORT, this.rpcServices.isa.getPort()); | ||
|         
                  adwk67 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| + } | ||
| + | ||
| private void setupSignalHandlers() { | ||
| if (!SystemUtils.IS_OS_WINDOWS) { | ||
| HBasePlatformDependent.handle("HUP", (number, name) -> { | ||
| @@ -958,7 +969,7 @@ public class HRegionServer extends Thread | ||
| } | ||
| // Setup RPC client for master communication | ||
| this.rpcClient = RpcClientFactory.createClient(conf, clusterId, | ||
| - new InetSocketAddress(this.rpcServices.isa.getAddress(), 0), | ||
| + new InetSocketAddress(0), | ||
|         
                  nightkr marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| clusterConnection.getConnectionMetrics(), Collections.emptyMap()); | ||
| span.setStatus(StatusCode.OK); | ||
| } catch (Throwable t) { | ||
| @@ -1533,6 +1544,8 @@ public class HRegionServer extends Thread | ||
| } else { | ||
| serverLoad.setInfoServerPort(-1); | ||
| } | ||
| + // serverLoad.setInfoServerPort(Integer.parseInt(System.getenv("HBASE_INFO_PORT"))); | ||
|         
                  adwk67 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| + serverLoad.setInfoServerPort(useThisInfoPortInstead); | ||
| MetricsUserAggregateSource userSource = | ||
| metricsRegionServer.getMetricsUserAggregate().getSource(); | ||
| if (userSource != null) { | ||
| @@ -1688,7 +1701,7 @@ public class HRegionServer extends Thread | ||
| if (key.equals(HConstants.KEY_FOR_HOSTNAME_SEEN_BY_MASTER)) { | ||
| String hostnameFromMasterPOV = e.getValue(); | ||
| this.serverName = ServerName.valueOf(hostnameFromMasterPOV, | ||
| - rpcServices.getSocketAddress().getPort(), this.startcode); | ||
| + useThisPortInstead, this.startcode); | ||
| String expectedHostName = rpcServices.getSocketAddress().getHostName(); | ||
| // if Master use-ip is enabled, RegionServer use-ip will be enabled by default even if it | ||
| // is set to disable. so we will use the ip of the RegionServer to compare with the | ||
| @@ -1814,7 +1827,7 @@ public class HRegionServer extends Thread | ||
|  | ||
| private void createMyEphemeralNode() throws KeeperException { | ||
| RegionServerInfo.Builder rsInfo = RegionServerInfo.newBuilder(); | ||
| - rsInfo.setInfoPort(infoServer != null ? infoServer.getPort() : -1); | ||
| + rsInfo.setInfoPort(infoServer != null ? useThisInfoPortInstead : -1); | ||
| rsInfo.setVersionInfo(ProtobufUtil.getVersionInfo()); | ||
| byte[] data = ProtobufUtil.prependPBMagic(rsInfo.build().toByteArray()); | ||
| ZKUtil.createEphemeralNodeAndWatch(this.zooKeeper, getMyEphemeralNodePath(), data); | ||
| @@ -2479,7 +2492,7 @@ public class HRegionServer extends Thread | ||
| LOG.info("Retry starting http info server with port: " + port); | ||
| } | ||
| } | ||
| - port = this.infoServer.getPort(); | ||
| + port = useThisInfoPortInstead; | ||
| conf.setInt(HConstants.REGIONSERVER_INFO_PORT, port); | ||
| int masterInfoPort = | ||
| conf.getInt(HConstants.MASTER_INFO_PORT, HConstants.DEFAULT_MASTER_INFOPORT); | ||
| @@ -3073,12 +3086,11 @@ public class HRegionServer extends Thread | ||
| LOG.info("reportForDuty to master=" + masterServerName + " with isa=" + rpcServices.isa | ||
| + ", startcode=" + this.startcode); | ||
| long now = EnvironmentEdgeManager.currentTime(); | ||
| - int port = rpcServices.isa.getPort(); | ||
| RegionServerStartupRequest.Builder request = RegionServerStartupRequest.newBuilder(); | ||
| if (!StringUtils.isBlank(useThisHostnameInstead)) { | ||
| request.setUseThisHostnameInstead(useThisHostnameInstead); | ||
| } | ||
| - request.setPort(port); | ||
| + request.setPort(useThisPortInstead); | ||
| request.setServerStartCode(this.startcode); | ||
| request.setServerCurrentTime(now); | ||
| result = rss.regionServerStartup(null, request.build()); | ||
| diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java | ||
| index b77fcf338a..1f5c9dd21f 100644 | ||
| --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java | ||
| +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java | ||
| @@ -1270,14 +1270,14 @@ public class RSRpcServices implements HBaseRPCErrorHandler, AdminService.Blockin | ||
| int port = conf.getInt(HConstants.MASTER_PORT, HConstants.DEFAULT_MASTER_PORT); | ||
| // Creation of a HSA will force a resolve. | ||
| initialIsa = new InetSocketAddress(hostname, port); | ||
| - bindAddress = new InetSocketAddress(conf.get("hbase.master.ipc.address", hostname), port); | ||
| + bindAddress = new InetSocketAddress(conf.get("hbase.master.ipc.address", hostname), conf.getInt("hbase.master.ipc.port", port)); | ||
|         
                  nightkr marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| } else { | ||
| String hostname = DNS.getHostname(conf, DNS.ServerType.REGIONSERVER); | ||
| int port = conf.getInt(HConstants.REGIONSERVER_PORT, HConstants.DEFAULT_REGIONSERVER_PORT); | ||
| // Creation of a HSA will force a resolve. | ||
| initialIsa = new InetSocketAddress(hostname, port); | ||
| bindAddress = | ||
| - new InetSocketAddress(conf.get("hbase.regionserver.ipc.address", hostname), port); | ||
| + new InetSocketAddress(conf.get("hbase.regionserver.ipc.address", hostname), conf.getInt("hbase.regionserver.ipc.port", port)); | ||
|         
                  nightkr marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| } | ||
| if (initialIsa.getAddress() == null) { | ||
| throw new IllegalArgumentException("Failed resolve of " + initialIsa); | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.