Couchdb: Hostname is illegal

Created on 31 Jul 2017  路  5Comments  路  Source: apache/couchdb

The hostname is always illegal, no matter what I set it to in vm.args.

Expected Behavior

Accept this option in vm.args:
-sname couchdb@pizerogrijs

Current Behavior

All databases fail with state This database failed to load.

[error] 2017-07-31T20:41:19.546348Z couchdb@pizerogrijs <0.285.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:41:19.671179Z couchdb@pizerogrijs <0.292.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

Possible Solution

Using the right hostname configuration? Maybe set the local routing differently?

Steps to Reproduce (for bugs)

  1. Buy a Raspberry Pi
  2. Use this tutorial: http://derhess.de/2017/02/21/local-dev-server-couchdb-2-0-nodejs-raspberrypi/

Context

I cannot run couchdb, this hostname seems to be the root issue but it may very well be something different. This database failed to load. leaves a lot to the imagination.

Your Environment

  • Version used: 2.0.0
  • Browser Name and version: Chrome, latest
  • Operating System and version (desktop or mobile): Raspbian
  • Link to your project: build from source

local.ini

; CouchDB Configuration Settings

; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.

[couchdb]
;max_document_size = 4294967296 ; bytes
;os_process_timeout = 5000
uuid = bbbb7f8f9aad5da1d81bf384eb432998

[couch_peruser]
; If enabled, couch_peruser ensures that a private per-user database
; exists for each document in _users. These databases are writable only
; by the corresponding user. Databases are in the following form:
; userdb-{hex encoded username}
;enable = true
; If set to true and a user is deleted, the respective database gets
; deleted as well.
;delete_dbs = true

[chttpd]
port = 5984
bind_address = 0.0.0.0
; Options for the MochiWeb HTTP server.
;server_options = [{backlog, 128}, {acceptor_pool_size, 16}]
; For more socket options, consult Erlang's module 'inet' man page.
;socket_options = [{recbuf, 262144}, {sndbuf, 262144}, {nodelay, true}]

[httpd]
; NOTE that this only configures the "backend" node-local port, not the
; "frontend" clustered port. You probably don't want to change anything in
; this section.
; Uncomment next line to trigger basic-auth popup on unauthorized requests.
;WWW-Authenticate = Basic realm="administrator"

; Uncomment next line to set the configuration modification whitelist. Only
; whitelisted values may be changed via the /_config URLs. To allow the admin
; to change this value over HTTP, remember to include {httpd,config_whitelist}
; itself. Excluding it from the list would require editing this file to update
; the whitelist.
;config_whitelist = [{httpd,config_whitelist}, {log,level}, {etc,etc}]

[query_servers]
;nodejs = /usr/local/bin/couchjs-node /path/to/couchdb/share/server/main.js


[httpd_global_handlers]
;_google = {couch_httpd_proxy, handle_proxy_req, <<"http://www.google.com">>}

[couch_httpd_auth]
; If you set this to true, you should also uncomment the WWW-Authenticate line
; above. If you don't configure a WWW-Authenticate header, CouchDB will send
; Basic realm="server" in order to prevent you getting logged out.
; require_valid_user = false
secret = bc006ae8c955b1a1f67cb5cc64251ea6

[os_daemons]
; For any commands listed here, CouchDB will attempt to ensure that
; the process remains alive. Daemons should monitor their environment
; to know when to exit. This can most easily be accomplished by exiting
; when stdin is closed.
;foo = /path/to/command -with args

[daemons]
; enable SSL support by uncommenting the following line and supply the PEM's below.
; the default ssl port CouchDB listens on is 6984
; httpsd = {couch_httpd, start_link, [https]}

[ssl]
;cert_file = /full/path/to/server_cert.pem
;key_file = /full/path/to/server_key.pem
;password = somepassword
; set to true to validate peer certificates
;verify_ssl_certificates = false
; Set to true to fail if the client does not send a certificate. Only used if verify_ssl_certificates is true.
;fail_if_no_peer_cert = false
; Path to file containing PEM encoded CA certificates (trusted
; certificates used for verifying a peer certificate). May be omitted if
; you do not want to verify the peer.
;cacert_file = /full/path/to/cacertf
; The verification fun (optional) if not specified, the default
; verification fun will be used.
;verify_fun = {Module, VerifyFun}
; maximum peer certificate depth
;ssl_certificate_max_depth = 1
;
; Reject renegotiations that do not live up to RFC 5746.
;secure_renegotiate = true
; The cipher suites that should be supported.
; Can be specified in erlang format "{ecdhe_ecdsa,aes_128_cbc,sha256}"
; or in OpenSSL format "ECDHE-ECDSA-AES128-SHA256".
;ciphers = ["ECDHE-ECDSA-AES128-SHA256", "ECDHE-ECDSA-AES128-SHA"]
; The SSL/TLS versions to support
;tls_versions = [tlsv1, 'tlsv1.1', 'tlsv1.2']

; To enable Virtual Hosts in CouchDB, add a vhost = path directive. All requests to
; the Virual Host will be redirected to the path. In the example below all requests
; to http://example.com/ are redirected to /database.
; If you run CouchDB on a specific port, include the port number in the vhost:
; example.com:5984 = /database
[vhosts]
;example.com = /database/

[update_notification]
;unique notifier name=/full/path/to/exe -with "cmd line arg"

; To create an admin account uncomment the '[admins]' section below and add a
; line in the format 'username = password'. When you next start CouchDB, it
; will change the password to a hash (so that your passwords don't linger
; around in plain-text files). You can add more admin accounts with more
; 'username = password' lines. Don't forget to restart CouchDB after
; changing this.
[admins]
;admin = mysecretpassword
admin = -pbkdf2-f79e44d9645e321128d5293bc75f95e1c6a2ee69,adf8a051efc0b6591fd24f3d804e4454,10

vm.args

# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.

# Each node in the system must have a unique name.  A name can be short
# (specified using -sname) or it can by fully qualified (-name).  There can be
# no communication between nodes running with the -sname flag and those running 
# with the -name flag.
-sname couchdb@pizerogrijs

# All nodes must share the same magic cookie for distributed Erlang to work.
# Comment out this line if you synchronized the cookies by other means (using
# the ~/.erlang.cookie file, for example).
-setcookie monster

# Tell kernel and SASL not to log anything
-kernel error_logger silent
-sasl sasl_error_logger false

# Use kernel poll functionality if supported by emulator
+K true

# Start a pool of asynchronous IO threads
+A 16

# Comment this line out to enable the interactive Erlang shell on startup
+Bd -noinput

hosts

127.0.0.1   pizerogrijs pizerogrijs.local
::1     localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

127.0.1.1   localhost

hostname
pizerogrijs

log file

[info] 2017-07-31T20:57:50.742188Z couchdb@pizerogrijs <0.7.0> -------- Application couch_log started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:50.795591Z couchdb@pizerogrijs <0.7.0> -------- Application folsom started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.198140Z couchdb@pizerogrijs <0.7.0> -------- Application couch_stats started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.202259Z couchdb@pizerogrijs <0.7.0> -------- Application khash started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.311576Z couchdb@pizerogrijs <0.7.0> -------- Application couch_event started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.384415Z couchdb@pizerogrijs <0.7.0> -------- Application ibrowse started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.454440Z couchdb@pizerogrijs <0.7.0> -------- Application ioq started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.458034Z couchdb@pizerogrijs <0.7.0> -------- Application mochiweb started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.462116Z couchdb@pizerogrijs <0.7.0> -------- Application oauth started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:51.562404Z couchdb@pizerogrijs <0.204.0> -------- Apache CouchDB 2.0.0 is starting.

[info] 2017-07-31T20:57:51.566135Z couchdb@pizerogrijs <0.205.0> -------- Starting couch_sup
[info] 2017-07-31T20:57:52.864173Z couchdb@pizerogrijs <0.204.0> -------- Apache CouchDB has started. Time to relax.

[info] 2017-07-31T20:57:52.867404Z couchdb@pizerogrijs <0.204.0> -------- Apache CouchDB has started on http://127.0.0.1:5986/
[info] 2017-07-31T20:57:52.870843Z couchdb@pizerogrijs <0.7.0> -------- Application couch started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:52.874383Z couchdb@pizerogrijs <0.7.0> -------- Application ets_lru started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:52.991727Z couchdb@pizerogrijs <0.7.0> -------- Application rexi started on node couchdb@pizerogrijs
[error] 2017-07-31T20:57:53.235792Z couchdb@pizerogrijs <0.285.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:57:53.371396Z couchdb@pizerogrijs <0.292.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[info] 2017-07-31T20:57:53.480372Z couchdb@pizerogrijs <0.7.0> -------- Application mem3 started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:53.485945Z couchdb@pizerogrijs <0.7.0> -------- Application fabric started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:53.726779Z couchdb@pizerogrijs <0.7.0> -------- Application chttpd started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:53.869410Z couchdb@pizerogrijs <0.7.0> -------- Application couch_index started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:53.874521Z couchdb@pizerogrijs <0.7.0> -------- Application couch_mrview started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:53.879635Z couchdb@pizerogrijs <0.7.0> -------- Application couch_plugins started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.234624Z couchdb@pizerogrijs <0.7.0> -------- Application couch_replicator started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.240382Z couchdb@pizerogrijs <0.7.0> -------- Application couch_peruser started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.508749Z couchdb@pizerogrijs <0.7.0> -------- Application ddoc_cache started on node couchdb@pizerogrijs
[error] 2017-07-31T20:57:54.570417Z couchdb@pizerogrijs emulator -------- Error in process <0.330.0> on node 'couchdb@pizerogrijs' with exit value: {{badmatch,false},[{fabric_util,stream_start,4,[{file,"src/fabric_util.erl"},{line,65}]},{fabric_view_changes,send_changes,6,[{file,"src/fabric_view_changes.erl"},{line,169}]},{fabric_view_changes,keep_sending_changes,8,[... 
[notice] 2017-07-31T20:57:54.571202Z couchdb@pizerogrijs <0.329.0> -------- chttpd_auth_cache changes listener died no match of right hand value false at fabric_util:stream_start/4(line:65) <= fabric_view_changes:send_changes/6(line:169) <= fabric_view_changes:keep_sending_changes/8(line:82) <= fabric_view_changes:go/5(line:43)
[info] 2017-07-31T20:57:54.731095Z couchdb@pizerogrijs <0.7.0> -------- Application global_changes started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.734385Z couchdb@pizerogrijs <0.7.0> -------- Application jiffy started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.805448Z couchdb@pizerogrijs <0.7.0> -------- Application mango started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.875823Z couchdb@pizerogrijs <0.7.0> -------- Application setup started on node couchdb@pizerogrijs
[info] 2017-07-31T20:57:54.879596Z couchdb@pizerogrijs <0.7.0> -------- Application snappy started on node couchdb@pizerogrijs
[notice] 2017-07-31T20:57:56.852701Z couchdb@pizerogrijs <0.449.0> 9656077d2f pizerogrijs.local:5984 192.168.178.136 undefined GET /_utils/ 304 ok 242
[notice] 2017-07-31T20:57:56.875541Z couchdb@pizerogrijs <0.449.0> ed23edccb1 pizerogrijs.local:5984 192.168.178.136 undefined GET /_utils/dashboard.assets/js/bundle-b8e0ba71119195edb7ec64b98f53d9b9.js 304 ok 7
[notice] 2017-07-31T20:57:57.291175Z couchdb@pizerogrijs <0.449.0> 2f8429f42a pizerogrijs.local:5984 192.168.178.136 undefined GET /_session 200 ok 42
[notice] 2017-07-31T20:57:57.422516Z couchdb@pizerogrijs <0.449.0> 3d6e135f65 pizerogrijs.local:5984 192.168.178.136 undefined GET /_session 200 ok 8
[notice] 2017-07-31T20:57:57.455070Z couchdb@pizerogrijs <0.449.0> 09aec8e9ae pizerogrijs.local:5984 192.168.178.136 undefined GET / 200 ok 13
[notice] 2017-07-31T20:57:57.468394Z couchdb@pizerogrijs <0.450.0> 7c342474b7 pizerogrijs.local:5984 192.168.178.136 undefined GET /_utils/dashboard.assets/img/CouchDB-negative-logo.png 304 ok 23
[notice] 2017-07-31T20:57:57.489127Z couchdb@pizerogrijs <0.451.0> 621558cb1d pizerogrijs.local:5984 192.168.178.136 undefined GET /_utils/dashboard.assets/fonts/fauxtonicon5.woff 304 ok 11
[error] 2017-07-31T20:57:59.631812Z couchdb@pizerogrijs emulator -------- Error in process <0.528.0> on node 'couchdb@pizerogrijs' with exit value: {{badmatch,false},[{fabric_util,stream_start,4,[{file,"src/fabric_util.erl"},{line,65}]},{fabric_view_changes,send_changes,6,[{file,"src/fabric_view_changes.erl"},{line,169}]},{fabric_view_changes,keep_sending_changes,8,[... 
[notice] 2017-07-31T20:57:59.632638Z couchdb@pizerogrijs <0.329.0> -------- chttpd_auth_cache changes listener died no match of right hand value false at fabric_util:stream_start/4(line:65) <= fabric_view_changes:send_changes/6(line:169) <= fabric_view_changes:keep_sending_changes/8(line:82) <= fabric_view_changes:go/5(line:43)
[notice] 2017-07-31T20:58:00.280436Z couchdb@pizerogrijs <0.451.0> 012f1721ab pizerogrijs.local:5984 192.168.178.136 undefined POST /_session 200 ok 9
[notice] 2017-07-31T20:58:00.292817Z couchdb@pizerogrijs <0.451.0> 4da070baf4 pizerogrijs.local:5984 192.168.178.136 admin GET /_session 200 ok 5
[notice] 2017-07-31T20:58:00.548966Z couchdb@pizerogrijs <0.451.0> 5cebad96ab pizerogrijs.local:5984 192.168.178.136 admin GET /_all_dbs?_=1501534677133 200 ok 214
[notice] 2017-07-31T20:58:00.673277Z couchdb@pizerogrijs <0.451.0> ff275da45d pizerogrijs.local:5984 192.168.178.136 undefined GET /_users 500 ok 116
[notice] 2017-07-31T20:58:00.678979Z couchdb@pizerogrijs <0.450.0> 31527f7dd1 pizerogrijs.local:5984 192.168.178.136 undefined GET /verifytestdb 500 ok 117
[notice] 2017-07-31T20:58:00.680836Z couchdb@pizerogrijs <0.449.0> 54e0c96273 pizerogrijs.local:5984 192.168.178.136 undefined GET /whut 500 ok 118
[error] 2017-07-31T20:58:04.667194Z couchdb@pizerogrijs emulator -------- Error in process <0.722.0> on node 'couchdb@pizerogrijs' with exit value: {{badmatch,false},[{fabric_util,stream_start,4,[{file,"src/fabric_util.erl"},{line,65}]},{fabric_view_changes,send_changes,6,[{file,"src/fabric_view_changes.erl"},{line,169}]},{fabric_view_changes,keep_sending_changes,8,[... 
[notice] 2017-07-31T20:58:04.667959Z couchdb@pizerogrijs <0.329.0> -------- chttpd_auth_cache changes listener died no match of right hand value false at fabric_util:stream_start/4(line:65) <= fabric_view_changes:send_changes/6(line:169) <= fabric_view_changes:keep_sending_changes/8(line:82) <= fabric_view_changes:go/5(line:43)
[error] 2017-07-31T20:58:07.397858Z couchdb@pizerogrijs <0.807.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:58:07.398362Z couchdb@pizerogrijs <0.809.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[error] 2017-07-31T20:58:07.402508Z couchdb@pizerogrijs <0.815.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:58:07.402945Z couchdb@pizerogrijs <0.816.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[error] 2017-07-31T20:58:07.442838Z couchdb@pizerogrijs <0.831.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:58:07.444466Z couchdb@pizerogrijs <0.832.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[error] 2017-07-31T20:58:07.449228Z couchdb@pizerogrijs <0.834.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:58:07.449686Z couchdb@pizerogrijs <0.835.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[error] 2017-07-31T20:58:07.456629Z couchdb@pizerogrijs <0.840.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname 192.168.178.59 is illegal **

[error] 2017-07-31T20:58:07.457552Z couchdb@pizerogrijs <0.842.0> -------- ** System NOT running to use fully qualified hostnames **
** Hostname pizerogrijs.local is illegal **

[notice] 2017-07-31T20:58:07.577395Z couchdb@pizerogrijs <0.449.0> fb36da87fe pizerogrijs.local:5984 192.168.178.136 undefined PUT /doesnotwork 500 ok 324
[error] 2017-07-31T20:58:09.731504Z couchdb@pizerogrijs emulator -------- Error in process <0.889.0> on node 'couchdb@pizerogrijs' with exit value: {{badmatch,false},[{fabric_util,stream_start,4,[{file,"src/fabric_util.erl"},{line,65}]},{fabric_view_changes,send_changes,6,[{file,"src/fabric_view_changes.erl"},{line,169}]},{fabric_view_changes,keep_sending_changes,8,[... 
[notice] 2017-07-31T20:58:09.732685Z couchdb@pizerogrijs <0.329.0> -------- chttpd_auth_cache changes listener died no match of right hand value false at fabric_util:stream_start/4(line:65) <= fabric_view_changes:send_changes/6(line:169) <= fabric_view_changes:keep_sending_changes/8(line:82) <= fabric_view_changes:go/5(line:43)
^C[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
[os_mon] memory supervisor port (memsup): Erlang has closed

documentation

Most helpful comment

Reinstalling.. compiling now.. will try a single node config first and if it succeeds reinstall again for a cluster config.

--

Awesome, it finally works. Thank you @wohali for sticking with me.

All 5 comments

Try using -name instead of -sname in your vm.args file. Then - do you intend to run these in a cluster? Then you need to ensure that the portion that follows the @ is resolvable by DNS. If not, just use localhost, there is no need to set this with an actual host name if you're not in a cluster.

Not sure why you closed this issue. The use of -name did not change the errors reported.

Sorry, we didn't get any feedback. Are you trying to run this in a cluster, or not? If not, did you try -name couchdb@localhost?

This is base Erlang functionality, not CouchDB. From running clusters in production for many years, our advice is:

  1. Never use -sname. We will be removing this suggestion from the sample vm.args file.
  2. If this is a single node, not a cluster, always use -name [email protected].
  3. If DNS isn't configured, use IP addresses only: -name [email protected].
  4. If DNS is configured, use the FQDN only: -name [email protected]
  5. Tricks with /etc/hosts don't work as Erlang bypasses libresolv.

This may help: http://erlang.2086793.n4.nabble.com/inet-gethostbyname-issue-td2115935.html

I'll leave this ticket open for us to update our docs.

Reinstalling.. compiling now.. will try a single node config first and if it succeeds reinstall again for a cluster config.

--

Awesome, it finally works. Thank you @wohali for sticking with me.

Was this page helpful?
0 / 5 - 0 ratings