Unable to start MongoDB 3.0.2 service on CentOS 7 -


we setting mongodb server production environment on amazon ec2 instance, not able start service. i've followed this documentation setup. here steps, i've taken setting server:

added following /etc/yum.repos.d/mongodb-org-3.0.repo

[mongodb-org-3.0] name=mongodb repository baseurl=http://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/ gpgcheck=0 enabled=1 

and installed mongodb 3.0.2 using sudo yum install -y mongodb-org-3.0.2

created 3 partitions data, journal & log:

sudo mkdir /mongo sudo mkdir /mongo/data sudo mkdir /mongo/log sudo mkdir /mongo/journal 

created file system 3 separate partitions:

sudo mkfs.ext4 /dev/xvdb sudo mkfs.ext4 /dev/xvdc sudo mkfs.ext4 /dev/xvdd 

created entry in fstab reboot:

echo '/dev/xvdb /mongo/data ext4 defaults,auto,noatime,noexec 0 0 /dev/xvdc /mongo/journal ext4 defaults,auto,noatime,noexec 0 0 /dev/xvdd /mongo/log ext4 defaults,auto,noatime,noexec 0 0' | sudo tee -a /etc/fstab 

and mounted partitions:

sudo mount /mongo/data sudo mount /mongo/journal sudo mount /mongo/log 

given permissions , created link

sudo chown mongod:mongod /mongo/data /mongo/journal /mongo/log sudo ln -s /mongo/journal /mongo/data/journal 

configured ulimit & read ahead settings given in documentation link above. verified permissions , partitions:

[deployer@prod-mongo ~]$ df -h filesystem      size  used avail use% mounted on /dev/xvda1      8.0g  1.3g  6.8g  16% / devtmpfs        3.6g     0  3.6g   0% /dev tmpfs           3.5g     0  3.5g   0% /dev/shm tmpfs           3.5g   57m  3.4g   2% /run tmpfs           3.5g     0  3.5g   0% /sys/fs/cgroup /dev/xvdc       7.8g   36m  7.3g   1% /mongo/journal /dev/xvdb       150g   51m  149g   1% /mongo/data /dev/xvdd       3.9g   16m  3.6g   1% /mongo/log 

permissions:

[deployer@prod-mongo ~]$ ll / total 32 lrwxrwxrwx.   1 root   root      7 sep 29  2014 bin -> usr/bin dr-xr-xr-x.   4 root   root   4096 sep 29  2014 boot drwxr-xr-x.  17 root   root   2860 may 11 12:11 dev lrwxrwxrwx.   1 root   root      7 sep 29  2014 lib -> usr/lib lrwxrwxrwx.   1 root   root      9 sep 29  2014 lib64 -> usr/lib64 drwxr-xr-x.   2 root   root      6 jun 10  2014 mnt drwxr-xr-x.   5 mongod mongod   41 may 11 05:06 mongo drwxr-xr-x.  21 root   root    660 may 11 12:47 run lrwxrwxrwx.   1 root   root      8 sep 29  2014 sbin -> usr/sbin 

inside /mongo

[deployer@prod-mongo ~]$ ll /mongo/ total 12 drwxr-xr-x. 3 mongod mongod 4096 may 11 07:33 data drwxr-xr-x. 3 mongod mongod 4096 may 11 07:31 journal drwxr-xr-x. 3 mongod mongod 4096 may 11 08:58 log 

after changing configurations inside /etc/mongodb.conf

logpath=/mongo/log/mongod.log dbpath=/mongo/data 

and when i'm doing: sudo service mongod start, i'm getting error:

starting mongod (via systemctl):  job mongod.service failed. see 'systemctl status mongod.service' , 'journalctl -xn' details.                                                            [failed] 

further logging:

[deployer@prod-mongo ~]$ sudo systemctl status mongod.service  mongod.service - sysv: mongo scalable, document-oriented database.    loaded: loaded (/etc/rc.d/init.d/mongod)    active: failed (result: exit-code) since tue 2015-05-12 04:42:10 utc; 42s ago   process: 22881 execstart=/etc/rc.d/init.d/mongod start (code=exited, status=1/failure)  may 11 04:42:10 ip-xx-xx-xx-xx.local runuser[22887]: pam_unix(runuser:session): session opened user mongod (uid=0) may 11 04:42:10 ip-xx-xx-xx-xx.localdomain runuser[22887]: pam_unix(runuser:session): session closed user mongod may 11 04:42:10 ip-xx-xx-xx-xx.local mongod[22881]: starting mongod: [failed] may 11 04:42:10 ip-xx-xx-xx-xx.local systemd[1]: mongod.service: control process exited, code=exited status=1 may 11 04:42:10 ip-xx-xx-xx-xx.local systemd[1]: failed start sysv: mongo scalable, document-oriented database.. may 11 04:42:10 ip-xx-xx-xx-xx.local systemd[1]: unit mongod.service entered failed state. 

i've followed various articles , blog posts , stackexchange answers didn't solution. missing something?

update: if i'm directly running mongodb service normal user this: sudo mongod --logpath ~/mongod.log --dbpath ~/mongodata, service starting properly.

we tried changing path of pid file directory, didn't either.

i'm guessing you're running flavour of linux uses selinux (rhel or centos 7, perhaps?)

if so, issue don't have permissive policy on /mongo/ directory permits access daemons (like mongod service.)

from wikipedia:

selinux can potentially control activities system allows each user, process , daemon, precise specifications. however, used confine daemons[citation needed] database engines or web servers have more defined data access , activity rights. limits potential harm confined daemon becomes compromised. ordinary user-processes run in unconfined domain, not restricted selinux still restricted classic linux access rights

to check whether issue, try @ shell:

sudo setenforce 0

this should disable selinux policies , allow service run.

for more permanent solution, see https://wiki.centos.org/howtos/selinux


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -