mongodb分片群集错误14037

时间:2017-01-26 02:07:05

标签: mongodb sharding

我在the official tutorial之后使用三个配置服务器,副本集中的三个服务器以及使用mongos客户端创建共享集群,但是当我尝试使用

创建集合时
db.createCollection("XYZ")

我得到了

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

我的服务器状态为

/* 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
}

分片状态

--- 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 }

我做错了什么?

提前致谢。

1 个答案:

答案 0 :(得分:2)

回答我自己的问题,这真的是假的问题。问题在于,因为配置服务器是副本集,所以副本集和分片副本集之间的名称必须是唯一的,在我的情况下,不会导致问题。