Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33649

Can't create a user immediately after running rs.initiate()

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • 3.7.2
    • Replication
    • None
    • ALL
    • Hide

      1. Start mongod with the following command: mongod --auth --replSet
      2. Initiate replica set: mongo admin --eval "rs.initiate();"
      3. Create admin user: mongo admin --eval "db.createUser({user: '$MONGODB_ADMIN_USER', pwd: '$MONGODB_ADMIN_PASS', roles:[{role:'root',db:'admin'}]});"

      Show
      1. Start mongod with the following command: mongod --auth --replSet 2. Initiate replica set: mongo admin --eval "rs.initiate();" 3. Create admin user: mongo admin --eval "db.createUser({user: '$MONGODB_ADMIN_USER', pwd: '$MONGODB_ADMIN_PASS', roles:[{role:'root',db:'admin'}]});"

    Description

      I caught this bug during working with official docker image (v 3.7.2)

      mongo_1              | => Creating admin user with a password in MongoDB
      mongo_1              | 2018-03-03T11:22:09.246+0000 I NETWORK  [conn2] end connection 127.0.0.1:57942 (0 connections now open)
      mongo_1              | 2018-03-03T11:22:09.250+0000 I REPL     [rsSync] transition to SECONDARY from RECOVERING
      mongo_1              | 2018-03-03T11:22:09.263+0000 I REPL     [rsSync] conducting a dry run election to see if we could be elected. current term: 0
      mongo_1              | MongoDB shell version v3.7.2
      mongo_1              | 2018-03-03T11:22:09.268+0000 I REPL     [replexec-0] dry election run succeeded, running for election in term 1
      mongo_1              | 2018-03-03T11:22:09.284+0000 I STORAGE  [replexec-0] createCollection: local.replset.election with generated UUID: c4afa21d-93d0-4935-98e1-4e2e126a3801
      mongo_1              | connecting to: mongodb://127.0.0.1:27017/admin
      mongo_1              | 2018-03-03T11:22:09.350+0000 I NETWORK  [listener] connection accepted from 127.0.0.1:57944 #3 (1 connection now open)
      mongo_1              | 2018-03-03T11:22:09.351+0000 I NETWORK  [conn3] received client metadata from 127.0.0.1:57944 conn3: { application: { name: "MongoDB Shell" }, driver: { name: "MongoDB Internal Client", version: "3.7.2" }, os: { type: "Linux", name: "PRETTY_NAME="Debian GNU/Linux 8 (jessie)"", architecture: "x86_64", version: "Kernel 4.9.60-linuxkit-aufs" } }
      mongo_1              | MongoDB server version: 3.7.2
      mongo_1              | 2018-03-03T11:22:09.358+0000 E QUERY    [thread1] Error: couldn't add user: Cache Reader No keys found for HMAC that is valid for time: { ts: Timestamp(1520076129, 1) } with id: 0 :
      mongo_1              | _getErrorWithCode@src/mongo/shell/utils.js:25:13
      mongo_1              | DB.prototype.createUser@src/mongo/shell/db.js:1437:15
      mongo_1              | @(shell eval):1:1
      

      Attachments

        Activity

          People

            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            yashchenkon Mykola Yashchenko
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: