1

I'm trying to run ycsb on my mongodb instance (runs in the cloud). On mongodb side I have create two users with a two very wide scope of permissions:

> show users
{
    "_id" : "admin.admin",
    "user" : "admin",
    "db" : "admin",
    "roles" : [
        {
            "role" : "clusterAdmin",
            "db" : "admin"
        },
        {
            "role" : "dbAdminAnyDatabase",
            "db" : "admin"
        },
        {
            "role" : "userAdminAnyDatabase",
            "db" : "admin"
        }
    ],
    "userId" : UUID("99509f21-0ca3-4e3d-b585-dd7455128fa2"),
    "mechanisms" : [
        "SCRAM-SHA-256"
    ]
}
{
    "_id" : "admin.ycsb",
    "user" : "ycsb",
    "db" : "admin",
    "roles" : [
        {
            "role" : "clusterAdmin",
            "db" : "admin"
        },
        {
            "role" : "dbAdminAnyDatabase",
            "db" : "admin"
        },
        {
            "role" : "userAdminAnyDatabase",
            "db" : "admin"
        }
    ],
    "userId" : UUID("96b184ee-759c-4de8-82f5-93ff62b59f23"),
    "mechanisms" : [
        "SCRAM-SHA-256"
    ]
}

Then I simply try to run next command to load a workload:

$ bin/ycsb.sh load mongodb -s -P workloads/workloada -p recordcount=500000 -threads 16 -p mongodb.url="mongodb://admin:<password>@<ip>:27017/admin?w=1" -p mongodb.auth="true"

In this case I'm getting error:

com.mongodb.MongoCommandException: Command failed with error 13 (Unauthorized): 'not authorized on ycsb to execute command { insert: "usertable", ordered: true, writeConcern: { w: 1 }, $db: "ycsb", $clusterTime: { clusterTime: Timestamp(1626190349, 1), signature: { hash: BinData(0, 42C9FF75F94BA394E2EE114DE31ED49002602D1E), keyId: 6983987685132075011 } }, lsid: { id: UUID("f5d018fb-f89b-4b9f-ae65-6edf04b87536") } }' on server <ip>:27017. The full response is { "operationTime" : { "$timestamp" : { "t" : 1626190349, "i" : 1 } }, "ok" : 0.0, "errmsg" : "not authorized on ycsb to execute command { insert: \"usertable\", ordered: true, writeConcern: { w: 1 }, $db: \"ycsb\", $clusterTime: { clusterTime: Timestamp(1626190349, 1), signature: { hash: BinData(0, 42C9FF75F94BA394E2EE114DE31ED49002602D1E), keyId: 6983987685132075011 } }, lsid: { id: UUID(\"f5d018fb-f89b-4b9f-ae65-6edf04b87536\") } }", "code" : 13, "codeName" : "Unauthorized", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1626190349, "i" : 1 } }, "signature" : { "hash" : { "$binary" : "Qsn/dflLo5Ti7hFN4x7UkAJgLR4=", "$type" : "00" }, "keyId" : { "$numberLong" : "6983987685132075011" } } } }

Interesting that it complains on the user ycsb, however I have provided admin in all possible places. If I change url to "mongodb://admin:<password>@<ip>:27017/aaaa?w=1", then I'm going to get an error related to user aaaa, but it never works for admin. That's a reason why I have created a new user ycsb, but commands:

$ bin/ycsb.sh load mongodb -s -P workloads/workloada -p recordcount=500000 -threads 16 -p mongodb.url="mongodb://admin:<password>@<ip>:27017/ycsb?w=1" -p mongodb.auth="true"

or

$ bin/ycsb.sh load mongodb -s -P workloads/workloada -p recordcount=500000 -threads 16 -p mongodb.url="mongodb://ycsb:<password>@<ip>:27017/ycsb?w=1" -p mongodb.auth="true"

fail with exactly the same error as above.

0 Answers0