3

I have a relatively simple replica set test setup between two VMs and my host machine, with VM1 as primary, VM2 as secondary and the host as arbiter. I have mongodb 2.6.4 installed on all machines. So far it works without any issue, however things go weird when I try to setup authentication. For now it is disabled, and I am just trying to create an admin user so that I can set auth to true and set the keyFile in the configuration. I run the following commands on the primary (VM1):

use admin
db.createUser(
  {
  user: "admin",
  pwd: "blop",
  roles:
    [
      {
        role: "userAdminAnyDatabase",
        db: "admin"
      }
    ]
  }
)

However when I do that (on the primary, not the secondary), the secondary (VM2) crashes after throwing this error:

ERROR: error: exception cloning object in admin.system.users system.users entry must have either a 'pwd' field or a 'userSource' field, but not both obj:{ _id: "admin.admin", user: "admin", db: "admin", credentials: { MONGODB-CR: "85bc114ccxf991158fd4x8eb134834d8" }, roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] }

What am I doing wrong?

Thanks in advance

EDIT: I found the issue, actually for some reason the mongod instance on VM2 was still on 2.4, which has an incompatible way of creating users and would crash when receiving new-style user data from the primary.

7
  • VM2 is an arbiter right? It doesn't "store" anything. It just votes.
    – Neil Lunn
    Sep 17, 2014 at 12:13
  • no, the host is an arbiter. VM2 is a secondary
    – axelcdv
    Sep 17, 2014 at 12:27
  • @axelcdv So how did you solve this? I am trying to create a replset with 2.6 and 2.4 hosts Dec 10, 2014 at 13:24
  • @TrevorGowing I just updated the 2.4 host to 2.6
    – axelcdv
    Dec 10, 2014 at 14:13
  • @axelcdv Just an fyi, we are not in a position to be able to just upgrade all our hosts to 2.6 right now. So we got around this by doing all the authentication and replset setup on one of the 2.4 hosts rather than on the 2.6 host. Dec 11, 2014 at 9:52

1 Answer 1

0

I found the issue, actually for some reason the mongod instance on VM2 was still on 2.4, which has an incompatible way of creating users and would crash when receiving new-style user data from the primary. I just fixed it by upgrading MongoDB on VM2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.