The officially official Devuan Forum!

You are not logged in.

#1 2020-05-13 23:45:44

Jokah
Member
Registered: 2019-01-30
Posts: 5  

MongoDB issues

Hi, I need to install MongoDB Community Edition, so I've tryed to follow the instruction provided here : https://docs.mongodb.com/manual/tutoria … on-debian/

actually everything installed flawless, until I try to install the service (the docs even mention that both systemd and system V init) are supported so I went stright forward with doing: service mongod start and I get "mongod: unrecognized service", any clue how to solve this? anybody ever tryed to install and run successfully MongoDB? (I am on Devuan 3.0)

Offline

#2 2020-05-14 00:43:09

bgstack15
Member
Registered: 2018-02-04
Posts: 146  

Re: MongoDB issues

You can go find the names of the services on your system:

ls -al /etc/init.d

This will show you the files in the directory where the service scripts are stored. If mongodb supports sysvinit, it will probably place the service file there. Maybe it's named mongodb.

I just checked a random deb file from the mongodb site, and that version only provided a systemd unit.

$ dpkg-deb --contents mongodb-org-unstable-server_4.3.6_amd64.deb | grep -iE 'systemd|init|rc'
drwxr-xr-x root/root         0 2013-12-19 00:41 ./lib/systemd/
drwxr-xr-x root/root         0 2013-12-19 00:41 ./lib/systemd/system/
-rw-r--r-- root/root       716 2013-12-19 00:41 ./lib/systemd/system/mongod.service

The packages are geared towards debian, of course, which uses systemd.

So it looks like you will have to adapt an init script to run your daemon. You could investigate using the sysd2v script (http://www.trek.eu.org/devel/sysd2v/) that will try to read the unit file and write you a template for an init script.

But also perhaps an old-school init script from the interwebs might be adapted too: https://github.com/shoken0x/mongodb-init-script

EDIT:
On second thought, you should try using the init script from the rpm that is built for CentOS 6.

wget http://repo.mongodb.org/yum/redhat/6/mongodb-org/4.3/x86_64/RPMS/mongodb-org-unstable-server-4.3.6-1.el6.x86_64.rpm
mkdir -p tmp ; cd tmp
rpm2cpio < ../mongodb-org-unstable-server-4.3.6-1.el6.x86_64.rpm | cpio -idmv

To run the above commands you will need to install rpm2cpio and cpio packages.
Then, inside the tmp/etc/init.d directory you will have the init script! It might need adjusting for a devuan (debian-family) distro, so I can look through it if you're not ready for that. Once you're satisfied the init script calls the right binaries and uses the right paths, place it in /etc/init.d and then:

update-rc.d mongod defaults

Last edited by bgstack15 (2020-05-14 00:59:41)


This space intentionally left blank.

Offline

#3 2020-05-14 13:12:17

Jokah
Member
Registered: 2019-01-30
Posts: 5  

Re: MongoDB issues

I tryed the procedure you suggested, I've installed mongodb-org-unstable-server-4.3.6-1.el6.x86_64.rpm and I tryed use the mongod inside
/tmp/etc/init.d/mongod and placed it in /etc/init.d, but its not working, some edit are needed but I am not really good at it, some stuff I seen that indeed seems wrong for devuan but as i don't know redhat I dunno in which matter it should be changed.. for example:

# chkconfig: 35 85 15
# description: Mongo is a scalable, document-oriented database.
# processname: mongod
# config: /etc/mongod.conf

. /etc/rc.d/init.d/functions <----- this line

# All variables set before this point can be overridden by users, by
# setting them directly in the SYSCONFIG file. Use this to explicitly
# override these values, at your own risk.
SYSCONFIG="/etc/sysconfig/mongod"
if [ -f "$SYSCONFIG" ]; then
    . "$SYSCONFIG"
fi

this procedure also won't work either, and there could be more, but I don't know how to fix it propery, sorry.

Last edited by Jokah (2020-05-14 13:12:45)

Offline

#4 2020-05-14 16:56:07

Jokah
Member
Registered: 2019-01-30
Posts: 5  

Re: MongoDB issues

I could solve it, I found and used this init: https://github.com/mongodb/mongo/blob/m … ian/init.d

Offline

Board footer