如何修复连接被拒绝,并且找不到弹性搜索的主机错误 [英] How to fix connection refused and can't find a master error on elasticsearch mongoriver

查看:128
本文介绍了如何修复连接被拒绝,并且找不到弹性搜索的主机错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启动弹性搜索时遇到此错误

I'm experiencing this error when starting elasticsearch

~  elasticsearch -f
getopt: illegal option -- f
[2014-04-22 23:23:27,793][INFO ][node                     ] [Starlight] version[1.0.0], pid[3785], build[a46900e/2014-02-12T16:18:34Z]
[2014-04-22 23:23:27,794][INFO ][node                     ] [Starlight] initializing ...
[2014-04-22 23:23:27,837][INFO ][plugins                  ] [Starlight] loaded [mongodb-river, mapper-attachments], sites [river-mongodb]
[2014-04-22 23:23:29,997][INFO ][node                     ] [Starlight] initialized
[2014-04-22 23:23:29,998][INFO ][node                     ] [Starlight] starting ...
[2014-04-22 23:23:30,077][INFO ][transport                ] [Starlight] bound_address {inet[/127.0.0.1:9300]}, publish_address {inet[/127.0.0.1:9300]}
[2014-04-22 23:23:33,149][INFO ][cluster.service          ] [Starlight] new_master [Starlight][5kL_aPXDQVy-kecgDGY4VA][JOHNs-MacBook-Pro.local][inet[/127.0.0.1:9300]], reason: zen-disco-join (elected_as_master)
[2014-04-22 23:23:33,177][INFO ][discovery                ] [Starlight] elasticsearch_johnkevinmbasco/5kL_aPXDQVy-kecgDGY4VA
[2014-04-22 23:23:33,200][INFO ][http                     ] [Starlight] bound_address {inet[/127.0.0.1:9200]}, publish_address {inet[/127.0.0.1:9200]}
[2014-04-22 23:23:33,880][INFO ][gateway                  ] [Starlight] recovered [11] indices into cluster_state
[2014-04-22 23:23:34,990][INFO ][river.mongodb            ] Parse river settings for mongodb
[2014-04-22 23:23:34,993][INFO ][river.mongodb            ] Server: 127.0.0.1 - 27017
[2014-04-22 23:23:35,020][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] Starting river mongodb
[2014-04-22 23:23:35,031][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] MongoDB River Plugin - version[2.0.0] - hash[a0c23f1] - time[2014-02-23T20:40:05Z]
[2014-04-22 23:23:35,032][INFO ][org.elasticsearch.river.mongodb.MongoDBRiver] starting mongodb stream. options: secondaryreadpreference [false], drop_collection [false], include_collection [], throttlesize [5000], gridfs [false], filter [null], db [testmongo], collection [person], script [null], indexing to [mongoindex]/[person]
Apr 22, 2014 11:23:35 PM com.mongodb.ConnectionStatus$UpdatableNode update
WARNING: Server seen down: JOHNs-MacBook-Pro.local/10.209.30.254:27017
java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
    at java.net.Socket.connect(Socket.java:527)
    at com.mongodb.DBPort._open(DBPort.java:223)
    at com.mongodb.DBPort.go(DBPort.java:125)
    at com.mongodb.DBPort.go(DBPort.java:106)
    at com.mongodb.DBPort.findOne(DBPort.java:162)
    at com.mongodb.DBPort.runCommand(DBPort.java:170)
    at com.mongodb.ConnectionStatus$UpdatableNode.update(ConnectionStatus.java:196)
    at com.mongodb.ReplicaSetStatus$UpdatableReplicaSetNode.update(ReplicaSetStatus.java:603)
    at com.mongodb.ReplicaSetStatus$Updater.updateAll(ReplicaSetStatus.java:755)
    at com.mongodb.ReplicaSetStatus$Updater.run(ReplicaSetStatus.java:725)
[2014-04-22 23:23:35,367][INFO ][node                     ] [Starlight] started
[2014-04-22 23:23:35,397][WARN ][org.elasticsearch.river.mongodb.MongoDBRiver] Fail to start river mongodb
com.mongodb.MongoException: can't find a master
    at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:517)
    at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:236)
    at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216)
    at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288)
    at com.mongodb.DB.command(DB.java:262)
    at com.mongodb.DB.command(DB.java:244)
    at com.mongodb.DB.command(DB.java:301)
    at com.mongodb.DB.command(DB.java:199)
    at org.elasticsearch.river.mongodb.MongoDBRiver.isMongos(MongoDBRiver.java:264)
    at org.elasticsearch.river.mongodb.MongoDBRiver.start(MongoDBRiver.java:208)
    at org.elasticsearch.river.RiversService.createRiver(RiversService.java:148)
    at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:275)
    at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:269)
    at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:93)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
[2014-04-22 23:23:38,979][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,083][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,204][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,287][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,345][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,356][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,371][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts
[2014-04-22 23:23:39,374][WARN ][river.routing            ] [Starlight] no river _meta document found after 5 attempts

任何人都知道我做错了什么?

Anyone knows what am I doing wrong?

这里是rs.status()的输出

And here is the output of rs.status()

{
    "set" : "rs0",
    "date" : ISODate("2014-04-22T15:26:33Z"),
    "myState" : 1,
    "members" : [
        {
            "_id" : 0,
            "name" : "JOHNs-MacBook-Pro.local:27017",
            "health" : 1,
            "state" : 1,
            "stateStr" : "PRIMARY",
            "uptime" : 503,
            "optime" : Timestamp(1398179531, 1),
            "optimeDate" : ISODate("2014-04-22T15:12:11Z"),
            "self" : true
        }
    ],
    "ok" : 1
}

ifconfig输出:

ifconfig output:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    inet 127.0.0.1 netmask 0xff000000
    inet6 ::1 prefixlen 128
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
    ether 54:26:96:d8:3e:57
    media: autoselect (<unknown type>)
    status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
    ether 06:26:96:d8:3e:57
    media: autoselect
    status: inactive
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
    inet 10.141.75.33 --> 10.64.64.64 netmask 0xff000000

我正在使用MongoDB River Plugin 2.0.0 - https://github.com/richardwilly98/elasticsearch-river-mongodb ,Elasticsearch 1.0.0和MongoDB 2.4。 9

I'm using MongoDB River Plugin 2.0.0 - https://github.com/richardwilly98/elasticsearch-river-mongodb, Elasticsearch 1.0.0 and MongoDB 2.4.9

推荐答案

首先,请注意,连接字符串中写的内容不是驱动程序要连接的内容。对于副本集,URL例如:

First of all, note that what you write in the connection string is not what the driver's going to connect to. For replica set, the URL, for exampl:

mongodb://hostname/some_db

这里的主机名是种子,您的驱动程序将获得可用的服务器列表。这是因为一个副本集通常是可变的。您可以随时向/从副本集添加或删除节点。因此,可用列表始终来自种子。

从您的信息中,它返回一个成员列表:

Here the hostname is a "seed" where your driver's going to get a "available server list". This is because a replica set is usually variable. You can add or remove a node to/from a replica set any time. Thus the available list is always got from the seed.
Here from your information, it returns a one-member list:

"name" : "JOHNs-MacBook-Pro.local:27017",

所以司机稍后尝试连接到JOHNs-MacBook-Pro.local:27017。您需要确保的是,名称JOHNs-MacBook-Pro.local:27017应该可以从您的客户端机器访问。所以如果它解析为127.0.0.1,您的客户端将永远无法连接到它。

So the driver later tries to connect to JOHNs-MacBook-Pro.local:27017. What you need to make sure is that the name JOHNs-MacBook-Pro.local:27017 should be accessible from your client machine. So if it resolves to 127.0.0.1, your client will never be able to connect to it.

这篇关于如何修复连接被拒绝,并且找不到弹性搜索的主机错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆