0

I'm creating a shared cluster following the official tutorial using three configuration servers, three server in the replica set and using a mongos client, but when i try to create a collection with

db.createCollection("XYZ")

I get

/* 1 */
{
    "ok" : 0.0,
    "errmsg" : "can't create user databases on a --configsvr instance",
    "code" : 14037,
    "codeName" : "Location14037"
}

My server status is

/* 1 */
{
    "host" : "mongo-1",
    "version" : "3.4.1",
    "process" : "mongos",
    "pid" : NumberLong(1),
    "uptime" : 16325.0,
    "uptimeMillis" : NumberLong(16324905),
    "uptimeEstimate" : NumberLong(16324),
    "localTime" : ISODate("2017-01-26T02:04:32.110Z"),
    "asserts" : {
        "regular" : 0,
        "warning" : 0,
        "msg" : 0,
        "user" : 0,
        "rollovers" : 0
    },
    "connections" : {
        "current" : 4,
        "available" : 419426,
        "totalCreated" : 23
    },
    "extra_info" : {
        "note" : "fields vary by platform",
        "page_faults" : 0
    },
    "network" : {
        "bytesIn" : NumberLong(70779),
        "bytesOut" : NumberLong(106181),
        "physicalBytesIn" : NumberLong(70779),
        "physicalBytesOut" : NumberLong(106181),
        "numRequests" : NumberLong(1865)
    },
    "opcounters" : {
        "insert" : 0,
        "query" : 54,
        "update" : 0,
        "delete" : 0,
        "getmore" : 0,
        "command" : 864
    },
    "sharding" : {
        "configsvrConnectionString" : "production/10.7.0.28:27019,10.7.0.29:27019,10.7.0.30:27019",
        "lastSeenConfigServerOpTime" : {
            "ts" : Timestamp(6379728405545353, 1),
            "t" : NumberLong(2)
        }
    },
    "tcmalloc" : {
        "generic" : {
            "current_allocated_bytes" : 2719976,
            "heap_size" : 6291456
        },
        "tcmalloc" : {
            "pageheap_free_bytes" : 167936,
            "pageheap_unmapped_bytes" : 0,
            "max_total_thread_cache_bytes" : 1045430272,
            "current_total_thread_cache_bytes" : 777824,
            "total_free_bytes" : 3403544,
            "central_cache_free_bytes" : 194040,
            "transfer_cache_free_bytes" : 2431680,
            "thread_cache_free_bytes" : 777824,
            "aggressive_memory_decommit" : 0,
            "formattedString" : "------------------------------------------------\nMALLOC:        2719976 (    2.6 MiB) Bytes in use by application\nMALLOC: +       167936 (    0.2 MiB) Bytes in page heap freelist\nMALLOC: +       194040 (    0.2 MiB) Bytes in central cache freelist\nMALLOC: +      2431680 (    2.3 MiB) Bytes in transfer cache freelist\nMALLOC: +       777824 (    0.7 MiB) Bytes in thread cache freelists\nMALLOC: +      1171648 (    1.1 MiB) Bytes in malloc metadata\nMALLOC:   ------------\nMALLOC: =      7463104 (    7.1 MiB) Actual memory used (physical + swap)\nMALLOC: +            0 (    0.0 MiB) Bytes released to OS (aka unmapped)\nMALLOC:   ------------\nMALLOC: =      7463104 (    7.1 MiB) Virtual address space used\nMALLOC:\nMALLOC:            508              Spans in use\nMALLOC:             24              Thread heaps in use\nMALLOC:           4096              Tcmalloc page size\n------------------------------------------------\nCall ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).\nBytes released to the OS take up virtual address space but no physical memory.\n"
        }
    },
    "mem" : {
        "bits" : 64,
        "resident" : 28,
        "virtual" : 228,
        "supported" : true
    },
    "metrics" : {
        "cursor" : {
            "timedOut" : NumberLong(0),
            "open" : {
                "multiTarget" : NumberLong(0),
                "singleTarget" : NumberLong(0),
                "pinned" : NumberLong(0),
                "total" : NumberLong(0)
            }
        },
        "commands" : {
            "addShard" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(3)
            },
            "aggregate" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(12)
            },
            "buildInfo" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(14)
            },
            "create" : {
                "failed" : NumberLong(9),
                "total" : NumberLong(9)
            },
            "enableSharding" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(1)
            },
            "find" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(54)
            },
            "grantRolesToUser" : {
                "failed" : NumberLong(7),
                "total" : NumberLong(10)
            },
            "isMaster" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(48)
            },
            "listCollections" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(19)
            },
            "ping" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(618)
            },
            "replSetGetStatus" : {
                "failed" : NumberLong(14),
                "total" : NumberLong(14)
            },
            "revokeRolesFromUser" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(1)
            },
            "saslContinue" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(62)
            },
            "saslStart" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(31)
            },
            "serverStatus" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(2)
            },
            "usersInfo" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(8)
            },
            "whatsmyuri" : {
                "failed" : NumberLong(0),
                "total" : NumberLong(12)
            }
        }
    },
    "ok" : 1.0
}

And sharded status

--- Sharding Status --- 
  sharding version: {
    "_id" : 1,
    "minCompatibleVersion" : 5,
    "currentVersion" : 6,
    "clusterId" : ObjectId("58891625f1d4d70889a9787b")
}
  shards:
    {  "_id" : "production",  "host" : "production/10.7.0.14:27018,10.7.0.16:27018,10.7.0.9:27018",  "state" : 1 }
  active mongoses:
    "3.4.1" : 1
  balancer:
    Currently enabled:  yes
    Currently running:  yes
        Balancer lock taken at Wed Jan 25 2017 17:20:29 GMT-0400 (VET) by ConfigServer:Balancer
    Failed balancer rounds in last 5 attempts:  0
    Migration Results for the last 24 hours: 
        No recent migrations
  databases:
    {  "_id" : "base",  "primary" : "production",  "partitioned" : true }

What am I doing wrong?

Thanks in advance.

4
  • You need to connect to your mongos router and then create the collection Commented Jan 26, 2017 at 4:58
  • @ares im connecting to the mongos router using a mongo shell, after executing the query i get the error. Or should i do it on a different way? Commented Jan 26, 2017 at 12:37
  • Have you started your mongos with the --configsvr option. The error says it clearly. Commented Jan 26, 2017 at 12:43
  • @ares no my mongos was started with this mongos --configdb production/10.7.0.30:27019,10.7.0.28:27019,10.7.0.29:27019 --keyFile /opt/keyfile Commented Jan 26, 2017 at 12:49

1 Answer 1

3

Answering my own question and its really dummy the issue. The thing is that because config servers are a replica set the names between that replica set and shard replica set need to be unique, in my case where not and that cause the issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.