mongod无法获取主机名OS X的地址信息

时间:2016-03-17 13:26:10

标签: macos mongodb

使用mongod --dbpath启动mongo时遇到问题。我收到以下错误:

NETWORK  [HostnameCanonicalizationWorker] Failed to obtain address information for hostname ##########: nodename nor servname provided, or not known

主机名只有拉丁字符。我尝试了多个网络,删除了所有DNS条目,确认我的/ etc / hosts看起来很好,现在我处于停滞状态。

这是我的/ etc / hosts:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
#::1             localhost  

3 个答案:

答案 0 :(得分:0)

尝试启用ipv6并重启mongod服务器

::1             localhost

答案 1 :(得分:0)

我在这张JIRA票中听到了答案。

这是我的/etc/hosts文件。

  1 ##
  2 # Host Database
  3 #
  4 # localhost is used to configure the loopback interface
  5 # when the system is booting.  Do not change this entry.
  6 ##
  7 # 127.0.0.1 localhost
  8 127.0.0.1 localhost localhost.localdomain
  9 255.255.255.255 broadcasthost
 10 # ::1             localhost

答案 2 :(得分:-2)

更改HOSTNAME个人中的/etc/sysconfig/network

HOSTNAME=Steven

然后在/etc/hosts中更改您的主机名:

127.0.0.1 localhost localhost.localdomain ...............

127.0.0.1 localhost Steven  ...............