如何在各个僧侣之间共享锁定文件



我正在尝试设置分片和副本集。

我的假设程序是这样的:

  1. 启动一个副本集(让它只有一个,仅用于测试(
  2. 然后mongo启动副本
  3. 启动一个配置服务器(再次让它成为一个,仅用于测试(
  4. 启动一个分片服务器(再次让它只是一个(
  5. 添加分片并通过mongo启用sharding

我做了什么:

  1. mongod --replSet rs0 --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0
  2. mongo然后rs.initiate()
  3. mongod --configsvr --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0

-- 现在卡在步骤 3 上。

我发现的错误是 2017-05-22T20:00:13.857+0530 [initandlisten] exception in initAndListen: 10310 Unable to lock file: data/rs0-0/mongod.lock. Is a mongod instance already running?, terminating

我试过什么:

我尝试使用不同的目录进行 --unixSocketPrefix 选项,但每次它都命中data/rs0-0/mongod.lock同一个文件。所以它没有奏效

这似乎很简单,但无法弄清楚锁定文件如何在各种 mongod(无论是配置服务器、副本集还是分片服务器(之间共享

我在蒙戈布2.6.12

您需要使用不同的数据库路径选项启动mongodconfig server。您可以按照以下步骤操作:

mongod --replSet rs0 --dbpath data/rs0-0 --unixSocketPrefix data/rs0-0

mongod --replSet rs0 --dbpath data/rs0-0

mongo然后rs.initiate()

mkdir -p /data/configdb(递归授予所需权限(

mongod --configsvr --dbpath /data/configdb --port 27019

最新更新