Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-53461

clusterInit with allowedHosts fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: User Error
    • Major
    • None
    • 7.1.1
    • ns_server, RESTful-APIs
    • None
    • Untriaged
    • 1
    • Unknown

    Description

      This has happened on 7.1.1 and 7.1.2 build 3421. I expect the clusterInit in step 2 to succeed, since the first naming convention in the list supports the hostname. As the rest of the sequence indicates, there doesn't seem a problem when the list is established with /settings/security.

       

      Problem with allowedHosts and clusterInit
      -----------------------------------------

      1. Make sure /etc/hosts contains 'com.test.ubuntu':

      more /etc/hosts

      127.0.0.1    localhost
      127.0.1.1    ubuntu1804.localdomain
      127.0.0.1    com.test.ubuntu

       

      2. Try cluster init specifying allowedHosts:

      curl -v -X POST http://10.144.231.104:8091/clusterInit \
      -u Administrator:password \
      -d "hostname=com.test.ubuntu" \
      -d "services=kv%2Cn1ql" \
      -d "username=Administrator" \
      -d "password=password" \
      -d "port=SAME" \
      -d "allowedHosts=["*.test.ubuntu", "127.0.0.1"]"

       

      3. Fails with following message:

      {"errors":{"hostname":"Can't use 'com.test.ubuntu' as a node name because it is not allowed by the 'allowedHosts' setting"}}

       

      4. Check current setting:

          curl -X GET http://localhost:8091/settings/security | jq '.'

      Returns:

        "allowedHosts": [
          "*"
        ],
        
        

      5. Change setting directly:

      curl -X POST http://com.test.ubuntu:8091/settings/security \
      -d 'allowedHosts=["*.test.ubuntu", "127.0.0.1"]' \
      -u Administrator:password

      []

       

      6. Check that change has been made:

      curl -X GET http://localhost:8091/settings/security | jq '.'

      "allowedHosts": [
          "*.test.ubuntu",
          "127.0.0.1"
        ],
        
        

      7. Try cluster init with com.test.ubuntu:

      curl -v -X POST http://10.144.231.104:8091/clusterInit \
      -u Administrator:password \
      -d "hostname=com.test.ubuntu" \
      -d "services=kv%2Cn1ql" \
      -d "username=Administrator" \
      -d "password=password" \
      -d "port=SAME"

       

      8. Success. Returns:

      {"newBaseUri":"http://10.144.231.104:8091/"}

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            timofey.barmin Timofey Barmin
            tony.hillman Tony Hillman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty