无法将mongo设置为副本集

时间:2017-10-04 04:19:55

标签: mongodb replicaset

您好我正在尝试将mongo-connector用于从mongo db到elasticsearch的传输数据。为此,我需要将mongodb设置为副本集。所以我先执行mongod命令运行mongodb,然后运行mongod --replSet "rs0命令。但它显示了如下错误。

2017-10-03T21:16:46.571-0700 I CONTROL  [initandlisten] MongoDB starting : pid=12180 port=27017 dbpath=C:\data\db\ 64-bit host=ME
2017-10-03T21:16:46.572-0700 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-10-03T21:16:46.572-0700 I CONTROL  [initandlisten] db version v3.4.6
2017-10-03T21:16:46.572-0700 I CONTROL  [initandlisten] git version: c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-10-03T21:16:46.573-0700 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1u-fips  22 Sep 2016
2017-10-03T21:16:46.573-0700 I CONTROL  [initandlisten] allocator: tcmalloc
2017-10-03T21:16:46.573-0700 I CONTROL  [initandlisten] modules: none
2017-10-03T21:16:46.573-0700 I CONTROL  [initandlisten] build environment:
2017-10-03T21:16:46.573-0700 I CONTROL  [initandlisten]     distmod: 2008plus-ssl
2017-10-03T21:16:46.574-0700 I CONTROL  [initandlisten]     distarch: x86_64
2017-10-03T21:16:46.574-0700 I CONTROL  [initandlisten]     target_arch: x86_64
2017-10-03T21:16:46.574-0700 I CONTROL  [initandlisten] options: { replication: { replSet: "rs0" } }
2017-10-03T21:16:46.575-0700 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: C:\data\db\mongod.lock The process cannot access the file because it is being used by another process.. Is a mongod instance already running?, terminating
2017-10-03T21:16:46.575-0700 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2017-10-03T21:16:46.575-0700 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2017-10-03T21:16:46.575-0700 I CONTROL  [initandlisten] now exiting
2017-10-03T21:16:46.576-0700 I CONTROL  [initandlisten] shutting down with code:100

1 个答案:

答案 0 :(得分:0)

直接运行命令mongod --replSet "rs0",不要使用mongod,然后使用replSet命令。