Mongos shell 不显示在分片上创建的 collections
Mongos shell not displaying the collections that are created on shards
我有一个 3 节点分片集群,mongos 安装在一个单独的节点上。
当使用 mongos shell 创建数据库(测试)并添加 collections 时,我可以使用
查看 collections
使用测试
显示collections
然而,当数据库 (test2) 在其中一个分片节点中创建时(不使用 mongos)。
mongo --host=主机名 --port=端口
使用testdb2
db.collection1.insert({"testing_user":"test"})
我可以从这个碎片
查看collection
但是当我登录 mongos shell 时,它显示 testdb2 的 collections 是空的。
此外,我尝试检查 collection 是否存在于配置数据库中。
使用配置
db.collection.find()
我没有看到添加到 testdb2
的 collection
However when the database (test2) is created in one of the shard node (not using mongos).
不要那样做。
分片集群的全部意义在于在分片之间划分数据。配置服务器分配和维护每个 database/collection 存储位置的记录,mongos 路由器透明地将查询定向到适当的分片。
如果您通过直接连接到分片来创建集合,mongos 和配置服务器不会知道它,因此不能指望 mongos 知道它。在大多数情况下,数据将无法访问,在某些情况下,数据可能会被删除。
底线是,如果您使用的是分片 mongodb 集群,插入和访问数据的唯一安全方法是通过 mongos。
我有一个 3 节点分片集群,mongos 安装在一个单独的节点上。 当使用 mongos shell 创建数据库(测试)并添加 collections 时,我可以使用
查看 collections使用测试
显示collections
然而,当数据库 (test2) 在其中一个分片节点中创建时(不使用 mongos)。
mongo --host=主机名 --port=端口
使用testdb2
db.collection1.insert({"testing_user":"test"})
我可以从这个碎片
查看collection但是当我登录 mongos shell 时,它显示 testdb2 的 collections 是空的。
此外,我尝试检查 collection 是否存在于配置数据库中。
使用配置
db.collection.find()
我没有看到添加到 testdb2
的 collectionHowever when the database (test2) is created in one of the shard node (not using mongos).
不要那样做。
分片集群的全部意义在于在分片之间划分数据。配置服务器分配和维护每个 database/collection 存储位置的记录,mongos 路由器透明地将查询定向到适当的分片。
如果您通过直接连接到分片来创建集合,mongos 和配置服务器不会知道它,因此不能指望 mongos 知道它。在大多数情况下,数据将无法访问,在某些情况下,数据可能会被删除。
底线是,如果您使用的是分片 mongodb 集群,插入和访问数据的唯一安全方法是通过 mongos。