Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instanc



64 down vote accepted

I was having the same problem on a Ubuntu ec2 instance. I was following this amazon article on page 7:

http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

Mongodb path in /etc/mongodb.conf was set to /var/lib/mongodb (primary install location and working). When I changed to /data/db (EBS volume) I was getting 'errno:13 Permission denied'.

  1. First I ran sudo service mongodb stop.
  2. Then I used ls -la to see what group & owner mongodb assigned to /var/lib/mongodb(existing path) and I changed the /data/db (new path) with chown and chgrp to match. (example: sudo chown -R mongodb:mongodb /data/db)
  3. Then I updated the path in etc/mongodb.conf to /data/db and deleted the old mongo files in /var/lib/mongodb directory.
  4. Then I ran sudo service mongodb start and waited about a minute. If you try to connect to 27017 immediately you won't be able to.
  5. After a minute check /data/db (EBS volume) and mongo should have placed a journal, mongod.lock, local.ns, local.0, etc. If not try sudo service mongodb restart and check a minute later.

I just spent over a hour with this. Changing the group and deleting the old files is probably not necessary, but that's what worked for me.

This is a great video about mounting a ebs volume to ec2 instance:

http://www.youtube.com/watch?v=gBII3o3BofU








64 down vote accepted

I was having the same problem on a Ubuntu ec2 instance. I was following this amazon article on page 7:

http://d36cz9buwru1tt.cloudfront.net/AWS_NoSQL_MongoDB.pdf

Mongodb path in /etc/mongodb.conf was set to /var/lib/mongodb (primary install location and working). When I changed to /data/db (EBS volume) I was getting 'errno:13 Permission denied'.

  1. First I ran sudo service mongodb stop.
  2. Then I used ls -la to see what group & owner mongodb assigned to /var/lib/mongodb(existing path) and I changed the /data/db (new path) with chown and chgrp to match. (example: sudo chown -R mongodb:mongodb /data/db)
  3. Then I updated the path in etc/mongodb.conf to /data/db and deleted the old mongo files in /var/lib/mongodb directory.
  4. Then I ran sudo service mongodb start and waited about a minute. If you try to connect to 27017 immediately you won't be able to.
  5. After a minute check /data/db (EBS volume) and mongo should have placed a journal, mongod.lock, local.ns, local.0, etc. If not try sudo service mongodb restart and check a minute later.

I just spent over a hour with this. Changing the group and deleting the old files is probably not necessary, but that's what worked for me.

This is a great video about mounting a ebs volume to ec2 instance:

http://www.youtube.com/watch?v=gBII3o3BofU

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值