1

I'm deploying mongo with Amazon OpsWorks as described in the Setting Up a MongoDB Replicaset With AWS OpsWorks and the instance fails to start when I specify mounted ebs volume (/data/ebs) in dbpath.

Here's stack's custom json:

{
  "mongodb" : {
    config: {
      "dbpath" : "/data/ebs/data/",
      "logpath" : "/data/ebs/log/",
    }
    "cluster_name" : "replicaset",
    "replicaset_name": "replicaset"
  }
}

The reason why mongo fails to start is apparently because of /data/ebs ownership:

[ec2-user@mongodb1 data]$ ls -la /data/ebs
drwxr-xr-x 2 root root   21 May 24 08:43 .
drwxr-xr-x 3 root root 4096 May 24 04:49 ..

How do I override it? Is there a recipe I need to run apart from mongodb::10gen_repo and mongodb::replicaset?

andriys
  • 113
  • 3

1 Answers1

1

A few basic things here:

First, your listing of /data/ebs does not seem to include the data directory or the log directory. You should create both if they do not in fact exist:

Next, the ownership of the /data/ebs/data folder should not be root:root. When installing as a service via apt, the relevant user is mongodb and hence the proper permission is usually mongodb:mongodb. To change it (repeat for the log directory also):

cd /data/ebs/data
sudo chown -R mongodb:mongodb .

Finally, the logpath piece of the config needs to be a full path to a file, not a directory. That is, it should be /data/ebs/log/mongod.log or similar instead.

Adam C
  • 5,132
  • 2
  • 28
  • 49