I'm following this tutorial for a Rocket.Chat setup on an Ubuntu 14.04 LTS installation. After installation of Mongod, it says to setup a replica set and gives the instructions to insert the following at the end of /etc/mongod.conf:
replSet=001-rs
However, when trying to initialize and create the replica set in the MongoDB shell with:
> rs.initiate()
I'm greeted with this error message:
{
"info2" : "no configuration explicitly specified -- making one",
"errmsg" : "exception: bad --replSet config string format is: <setname>[/<seedhost1>,<seedhost2>,...]",
"code" : 13093,
"ok" : 0
}
Am I interpreting this to mean the mongod.conf line should read as something like:
replSet <name of set>
Thanks in advance for any assistance.
Проблема связана с тем, что служба mongoDB не запустилась должным образом после внесения изменений.
В ubuntu она немного особенная ...: -)
Создайте новый файл:
nano /etc/systemd/system/mongodb.service
и напишите:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
теперь используйте с:
sudo systemctl start mongodb
# OR
sudo systemctl stop mongodb