Solr
  1. Solr
  2. SOLR-4088

ZkController baseURL only get the host name not address, will occur can't get the right URL to do recovery.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0-ALPHA, 4.0-BETA, 4.0
    • Fix Version/s: 4.1, 6.0
    • Component/s: SolrCloud
    • Labels:
      None
    • Environment:

      Linux env

      Description

      In the ZKController.getHostAddress, it gets host name. In the linux, get hostname from /etc/sysconfig/network or /etc/hostname that maybe not config for ip address.

      Other server can't access it(http://hostname:port/..) correctly that cause recovery fail.

      1. patch-4088.txt
        2 kB
        Raintung Li
      2. SOLR-4088_unknown_host.patch
        1 kB
        Robert Muir

        Activity

        Hide
        Raintung Li added a comment -

        change host name to host address

        Show
        Raintung Li added a comment - change host name to host address
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411466

        SOLR-4088: New and improved auto host detection strategy for SolrCloud.

        Show
        Commit Tag Bot added a comment - [trunk commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411466 SOLR-4088 : New and improved auto host detection strategy for SolrCloud.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411467

        SOLR-4088: New and improved auto host detection strategy for SolrCloud.

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411467 SOLR-4088 : New and improved auto host detection strategy for SolrCloud.
        Hide
        Mark Miller added a comment -

        Thanks Raintung!

        Show
        Mark Miller added a comment - Thanks Raintung!
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411473

        SOLR-4088: Format code and remove tabs

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411473 SOLR-4088 : Format code and remove tabs
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411471

        SOLR-4088: Format code and remove tabs

        Show
        Commit Tag Bot added a comment - [trunk commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411471 SOLR-4088 : Format code and remove tabs
        Hide
        Mark Miller added a comment - - edited

        Robert just mentioned to me that this can cause a problem in tests - sometimes a host cannot be found depending on your network connectivity and setup.

        Makes this kind of difficult to test...but most tests could go to something else - we could explicitly set the host to 127.0...or we could fail back to the previous detection method if this new one fails? Or we could do both.

        I'm not sure what we should do to test this specific detection method though.

        Show
        Mark Miller added a comment - - edited Robert just mentioned to me that this can cause a problem in tests - sometimes a host cannot be found depending on your network connectivity and setup. Makes this kind of difficult to test...but most tests could go to something else - we could explicitly set the host to 127.0...or we could fail back to the previous detection method if this new one fails? Or we could do both. I'm not sure what we should do to test this specific detection method though.
        Hide
        Robert Muir added a comment -

        I hit this when running tests:

        [junit4:junit4]    > Caused by: java.net.UnknownHostException: xxx.yyy.zzz: xxx.yyy.zzz: nodename nor servname provided, or not known
        [junit4:junit4]    > 	at java.net.InetAddress.getLocalHost(InetAddress.java:1438)
        [junit4:junit4]    > 	at org.apache.solr.cloud.ZkController.getHostAddress(ZkController.java:375)
        [junit4:junit4]    > 	at org.apache.solr.cloud.ZkController.<init>(ZkController.java:157)
        [junit4:junit4]    > 	at org.apache.solr.core.CoreContainer.initZooKeeper(CoreContainer.java:254)
        [junit4:junit4]    > 	... 44 more
        
        Show
        Robert Muir added a comment - I hit this when running tests: [junit4:junit4] > Caused by: java.net.UnknownHostException: xxx.yyy.zzz: xxx.yyy.zzz: nodename nor servname provided, or not known [junit4:junit4] > at java.net.InetAddress.getLocalHost(InetAddress.java:1438) [junit4:junit4] > at org.apache.solr.cloud.ZkController.getHostAddress(ZkController.java:375) [junit4:junit4] > at org.apache.solr.cloud.ZkController.<init>(ZkController.java:157) [junit4:junit4] > at org.apache.solr.core.CoreContainer.initZooKeeper(CoreContainer.java:254) [junit4:junit4] > ... 44 more
        Hide
        Robert Muir added a comment -

        Here's the patch i'm testing locally.

        The problem is when the host is configured as null, there are heuristics to guess how the host should be advertised.

        basically the patch just handles the situation where the first heuristical method (resolving the hostname from the system) fails, which can happen, e.g. if DNS is not functioning.

        In this case we just fall through to the logic below, of iterating interfaces.

        Show
        Robert Muir added a comment - Here's the patch i'm testing locally. The problem is when the host is configured as null, there are heuristics to guess how the host should be advertised. basically the patch just handles the situation where the first heuristical method (resolving the hostname from the system) fails, which can happen, e.g. if DNS is not functioning. In this case we just fall through to the logic below, of iterating interfaces.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1425972

        SOLR-4088: when host is null, fall back to interface iteration (heuristic 2) if resolving the system hostname (heuristic 1) fails

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1425972 SOLR-4088 : when host is null, fall back to interface iteration (heuristic 2) if resolving the system hostname (heuristic 1) fails
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1425971

        SOLR-4088: when host is null, fall back to interface iteration (heuristic 2) if resolving the system hostname (heuristic 1) fails

        Show
        Commit Tag Bot added a comment - [trunk commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1425971 SOLR-4088 : when host is null, fall back to interface iteration (heuristic 2) if resolving the system hostname (heuristic 1) fails
        Hide
        Mark Miller added a comment -

        Thanks for the fix!

        Show
        Mark Miller added a comment - Thanks for the fix!
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411473

        SOLR-4088: Format code and remove tabs

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411473 SOLR-4088 : Format code and remove tabs
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Mark Robert Miller
        http://svn.apache.org/viewvc?view=revision&revision=1411467

        SOLR-4088: New and improved auto host detection strategy for SolrCloud.

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Mark Robert Miller http://svn.apache.org/viewvc?view=revision&revision=1411467 SOLR-4088 : New and improved auto host detection strategy for SolrCloud.

          People

          • Assignee:
            Mark Miller
            Reporter:
            Raintung Li
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development