java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused

JIRA | Joseph Wang | 6 years ago
  1. 0

    Have the following codes: try { db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); } catch (Exception ex) { System.out.println("count: get exception " + ex); ex.printStackTrace(); db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); System.out.println("count: get " + size); } catch (Throwable t) { System.out.println("count: get thowable " + t); t.printStackTrace(); db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); System.out.println("count: get " + size); } Testing failover by issuing kill -9 on the primary node. Cannot seem to be able to catch exception s.t. I can retry the query. java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:205) at com.mongodb.DBPort.go(DBPort.java:85) at com.mongodb.DBPort.go(DBPort.java:66) at com.mongodb.DBPort.call(DBPort.java:56) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284) at com.mongodb.DBCursor._check(DBCursor.java:297) at com.mongodb.DBCursor._hasNext(DBCursor.java:420) at com.mongodb.DBCursor.hasNext(DBCursor.java:445) at com.mongodb.DBCursor.itcount(DBCursor.java:535) at com.leadpoint.db.MongoDbQueryPerformanceTest.getCount(MongoDbQueryPerformanceTest.java:101) at com.leadpoint.db.MongoDbQueryPerformanceTest.main(MongoDbQueryPerformanceTest.java:255) Nov 4, 2010 4:03:26 PM com.mongodb.DBTCPConnector$MyPort error SEVERE: MyPort.error called java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:205) at com.mongodb.DBPort.go(DBPort.java:85) at com.mongodb.DBPort.go(DBPort.java:66) at com.mongodb.DBPort.call(DBPort.java:56) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284) at com.mongodb.DBCursor._check(DBCursor.java:297) at com.mongodb.DBCursor._hasNext(DBCursor.java:420) at com.mongodb.DBCursor.hasNext(DBCursor.java:445) at com.mongodb.DBCursor.itcount(DBCursor.java:535)

    JIRA | 6 years ago | Joseph Wang
    java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused
  2. 0

    Spring Data Mongo seems to ignore host in XML configuration

    Stack Overflow | 4 years ago | Jim Garrison
    java.io.IOException: couldn't connect to [/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect
  3. 0

    Spring data MongoDb throwing error Connection refused

    Stack Overflow | 4 years ago | Jagan
    java.io.IOException: couldn't connect to [/127.0.0.1:27017] bc:java.net.ConnectException: Connection refused: connect
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    MongoDB replica set - Java Driver - java.io.IOException connection issue

    Google Groups | 6 years ago | RajAhm
    java.io.IOException: couldn't connect to [rbhatt25339/171.69.121.94:27019] bc:java.net.ConnectException: Connection refused: connect
  6. 0

    Endless replicaset connection error with spring data support and mongodb

    Stack Overflow | 6 years ago | Arun P Johny
    java.io.IOException: couldn't connect to [/192.168.1.42:27017] bc:java.net.ConnectException: Connection refused: connect

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused

      at com.mongodb.DBPort._open()
    2. MongoDB Java Driver
      DBCursor.itcount
      1. com.mongodb.DBPort._open(DBPort.java:205)
      2. com.mongodb.DBPort.go(DBPort.java:85)
      3. com.mongodb.DBPort.go(DBPort.java:66)
      4. com.mongodb.DBPort.call(DBPort.java:56)
      5. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211)
      6. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284)
      7. com.mongodb.DBCursor._check(DBCursor.java:297)
      8. com.mongodb.DBCursor._hasNext(DBCursor.java:420)
      9. com.mongodb.DBCursor.hasNext(DBCursor.java:445)
      10. com.mongodb.DBCursor.itcount(DBCursor.java:535)
      10 frames
    3. com.leadpoint.db
      MongoDbQueryPerformanceTest.main
      1. com.leadpoint.db.MongoDbQueryPerformanceTest.getCount(MongoDbQueryPerformanceTest.java:101)
      2. com.leadpoint.db.MongoDbQueryPerformanceTest.main(MongoDbQueryPerformanceTest.java:255)
      2 frames