Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-1458

Slow Replicaset with one offline member

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: pecl-mongo
    • Environment:
      Setup:

      * 2 MongoDB Server with MongoDB 3.0.3 (as Mongo01 and Mongo02)
      ** Debian 7
      * 1 Arbiter with MongoDB 3.0.3
      ** Debian 7
      * n Servers for MongoDB Requests
      ** All Debian 7

      PHP Mongo Version: 1.6.8
    • # Replies:
      6
    • Last comment by Customer:
      true

      Description

      If we have one offline member in our setup (For maintenance) the replication set is very slow. It occures after the first 10-15 minutes we set the secondary offline.
      This problem occures on every PHP Script.
      It shows up as Timeouts to MongoDB or canceld scripts.

      Logs from Mongo (Snippet):

      2015-06-03T19:30:55.540+0200 W NETWORK [ReplExecNetThread-1] Failed to connect to Mongo01:27017, reason: errno:113 No route to host
      2015-06-03T19:30:55.540+0200 I REPL [ReplicationExecutor] Error in heartbeat request to Mongo01:27017; Location18915 Failed attempt to connect to Mongo01:27017; couldn't connect to serverMongo01:27017 (Mongo01), connection attempt failed
      2015-06-03T19:30:58.540+0200 W NETWORK [ReplExecNetThread-1] Failed to connect to Mongo01:27017, reason: errno:113 No route to host
      

      PHP Snippets:

          $aOptions = array(
              'connectTimeoutMS'  => 86400000,
              'socketTimeoutMS'  => 86400000,
              'readPreference'    => \MongoClient::RP_PRIMARY
          );
          try {
              $oMongo = new MongoClient('mongodb://mongo01:27017,mongo02:27017/?replicaSet=rs0', $aOptions);
          } catch(Exception $oExeption) {
              trigger_error('cant connect to mongodb ('.$oExeption->getMessage().'), we try again', E_USER_WARNING);
              $oMongo = new MongoClient('mongodb://mongo01:27017,mongo02:27017/?replicaSet=rs0', $aOptions);
          }
       
          $this->oMongoDB = $oMongo->selectDB(\MongoHelper::getDB());
       
          if (!$this->oCollection = $this->oMongoDB->selectCollection(\MongoHelper::getColDB())) {
              return 0;
          }
       
          $result = $this->oCollection->findOne(
              array('_id' => $this->Key)
          );
      

        Attachments

        1. all_ok.txt
          31 kB
        2. failure01.txt
          36 kB
        3. failure02.txt
          27 kB
        4. newlogs.txt
          69 kB

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            sascha.weiss Sascha Weiß
            Participants:
            Last commenter:
            Rathi Gnanasekaran
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              4 years, 11 weeks, 3 days ago
              Date of 1st Reply: