richardwilly98 / elasticsearch-river-mongodb

MongoDB River Plugin for ElasticSearch
1.12k stars 215 forks source link

com.mongodb.MongoException: can't find a master #36

Closed yangchunhe closed 12 years ago

yangchunhe commented 12 years ago

If of elasticsearch and mongdb in the normal operation of a machine, if in a different machine error.

help me!

java code :

public void riverMongo3(){ Client client = EsticSearchClientFactory.getClient(); try { client.prepareIndex("_river", "mongodb", "_meta") .setSource( jsonBuilder().startObject() .field("type", "mongodb") .startObject("mongodb") .field("host","192.168.1.133") .field("port",10000) .field("db","jua") .field("collection","blog") .endObject()
.startObject("index") .field("name","test") .field("type","test") .field("bulk_size","1000") .field("bulk_timeout","30") .endObject() .endObject() ).execute().actionGet(); } catch (ElasticSearchException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }

192.168.1.133:10000 can be visited;

error:

[2012-10-30 14:06:27,907][INFO ][cluster.metadata ] [Stygyro] [_river] update_mapping mongodb [2012-10-30 14:06:28,034][INFO ][river.mongodb ] [Stygyro] [mongodb][mongodb] Using mongodb server(s): host [192.168.1.133], port [10000] [2012-10-30 14:06:28,035][INFO ][river.mongodb ] [Stygyro] [mongodb][mongodb] starting mongodb stream: options: secondaryreadpreference [false], gridfs [false], filter [jua], db [test], indexing to [test]/[{}] [2012-10-30 14:06:28,187][INFO ][index.analysis ] [Stygyro] [test] /home/www/es/elasticsearch/config/mmseg [2012-10-30 14:06:28,192][INFO ][index.analysis ] [Stygyro] [test] /home/www/es/elasticsearch/config/mmseg [2012-10-30 14:06:28,193][INFO ][index.analysis ] [Stygyro] [test] /home/www/es/elasticsearch/config/mmseg [2012-10-30 14:06:28,200][INFO ][paoding-analyzer ] postPropertiesLoaded init [2012-10-30 14:06:28,200][INFO ][paoding-analyzer ] postPropertiesLoaded return [2012-10-30 14:06:28,202][INFO ][index.analysis ] [Stygyro] [test] /home/www/es/elasticsearch/config/mmseg [2012-10-30 14:06:28,216][INFO ][paoding-analyzer ] postPropertiesLoaded init [2012-10-30 14:06:28,216][INFO ][paoding-analyzer ] postPropertiesLoaded return [2012-10-30 14:06:28,247][INFO ][cluster.metadata ] [Stygyro] [test] creating index, cause [api], shards [5]/[1], mappings [] [2012-10-30 14:06:29,185][ERROR][river.mongodb ] [Stygyro] [mongodb][mongodb] Mongo gave an exception com.mongodb.MongoException: can't find a master at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:437) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:313) at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:298) at com.mongodb.DB.getCollectionNames(DB.java:298) at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.assignCollections(MongoDBRiver.java:509) at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.run(MongoDBRiver.java:546) at java.lang.Thread.run(Thread.java:662) [2012-10-30 14:06:29,196][ERROR][river.mongodb ] [Stygyro] [mongodb][mongodb] Mongo gave an exception com.mongodb.MongoException: can't find a master at com.mongodb.DBTCPConnector.checkMaster(DBTCPConnector.java:437) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:208) at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:313) at com.mongodb.DBApiLayer$MyCollection.find(DBApiLayer.java:298) at com.mongodb.DB.getCollectionNames(DB.java:298) at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.assignCollections(MongoDBRiver.java:509) at org.elasticsearch.river.mongodb.MongoDBRiver$Slurper.run(MongoDBRiver.java:546) at java.lang.Thread.run(Thread.java:662) [2012-10-30 14:06:29,207][ERROR][river.mongodb ] [Stygyro] [mongodb][mongodb] Mongo gave an exception com.mongodb.MongoException: can't find a master

richardwilly98 commented 12 years ago

Hi,

Thanks.