Вопрос

My resplica set configuration is something like this:

rs.glu:SECONDARY> rs.status()
{
    "set" : "rs.glu",
    "date" : ISODate("2014-04-03T04:34:35Z"),
    "myState" : 2,
    "syncingTo" : "10.13.96.13:27017",
    "members" : [
            {
                    "_id" : 2,
                    "name" : "10.13.98.14:27017",
                    "health" : 1,
                    "state" : 1,
                    "stateStr" : "PRIMARY",
                    "uptime" : 51453,
                    "optime" : Timestamp(1396448528, 1),
                    "optimeDate" : ISODate("2014-04-02T14:22:08Z"),
                    "lastHeartbeat" : ISODate("2014-04-03T04:34:33Z"),
                    "lastHeartbeatRecv" : ISODate("2014-04-03T04:34:33Z"),
                    "pingMs" : 1
            },
            {
                    "_id" : 3,
                    "name" : "10.13.98.13:27017",
                    "health" : 1,
                    "state" : 7,
                    "stateStr" : "ARBITER",
                    "uptime" : 51453,
                    "lastHeartbeat" : ISODate("2014-04-03T04:34:33Z"),
                    "lastHeartbeatRecv" : ISODate("2014-04-03T04:34:33Z"),
                    "pingMs" : 1
            },
            {
                    "_id" : 4,
                    "name" : "10.13.96.13:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 51453,
                    "optime" : Timestamp(1396448528, 1),
                    "optimeDate" : ISODate("2014-04-02T14:22:08Z"),
                    "lastHeartbeat" : ISODate("2014-04-03T04:34:34Z"),
                    "lastHeartbeatRecv" : ISODate("2014-04-03T04:34:34Z"),
                    "pingMs" : 0,
                    "syncingTo" : "10.13.98.14:27017"
            },
            {
                    "_id" : 5,
                    "name" : "10.13.96.12:27017",
                    "health" : 1,
                    "state" : 2,
                    "stateStr" : "SECONDARY",
                    "uptime" : 51533,
                    "optime" : Timestamp(1396448528, 1),
                    "optimeDate" : ISODate("2014-04-02T14:22:08Z"),
                    "self" : true
            }
    ],
    "ok" : 1
}

Now my connector code is this:

List<ServerAddress> listOfServers = new ArrayList<ServerAddress>();
listOfServers.add(new ServerAddress(properties.getProperty("mongo.host1"), Integer.valueOf(properties.getProperty("mongo.port1"))));
listOfServers.add(new ServerAddress(properties.getProperty("mongo.host2"), Integer.valueOf(properties.getProperty("mongo.port2"))));
listOfServers.add(new ServerAddress(properties.getProperty("mongo.host3"), Integer.valueOf(properties.getProperty("mongo.port3"))));
MongoClient mongoClient = new MongoClient(listOfServers);
mongoClient.setWriteConcern(WriteConcern.ACKNOWLEDGED);

MongoDbFactory gameDbFactory = new SimpleMongoDbFactory(mongoClient, properties.getProperty("adminportal.db"));

MongoTemplate gameMongoTemplate = new MongoTemplate(gameDbFactory);

Here is my properties file:

mongo.host1=10.13.96.12 
mongo.port1=27017

mongo.host2=10.13.96.13
mongo.port2=27017

mongo.host3=10.13.98.14
mongo.port3=27017

But when I try to connect my code I get this exception,

WARNING: Server seen down: /10.13.96.12:27017 - java.io.IOException - message: Read  timed out
Apr 03, 2014 12:36:26 AM com.mongodb.ConnectionStatus$UpdatableNode update
WARNING: Server seen down: /10.13.96.13:27017 - java.io.IOException - message: Read timed out
Apr 03, 2014 12:36:46 AM com.mongodb.ConnectionStatus$UpdatableNode update 
WARNING: Server seen down: /10.13.98.14:27017 - java.io.IOException - message: Read timed out
Apr 03, 2014 12:38:14 AM com.mongodb.ConnectionStatus$UpdatableNode update
  1. why this is happening, why there is a slash before the ip?
  2. there is no where I attached the "/" in my code?

Am I thinking correct that this is the cause of the issue?

Thanks Ankur

Это было полезно?

Решение

This seems an issue with the logger configuration and not an error.

Please refer to https://groups.google.com/forum/#!topic/mongodb-user/eAV7erPoZGU and Configure logging for the MongoDB Java driver for logger configuration for mongoDB.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top