Configuring mongoDB raspberry pi

I just installed mongopi from https://github.com/RickP/mongopi and it works correctly by doing a few settings basically $ sudo chown $USER /data/db . However, my mongo and mangods arent persistent I do PATH=$PATH:/opt/mongo/bin/ & export PATH however this will not continue in the next ssh session. Also, how can I make mongo initialize at startup? I took all the steps from github rehearsal.

+4
source share
1 answer

For part of the question path:

To get the path, you must put it in a script that runs every time you log in. Usually in your home directory there is an rc file for your shell. A type

 echo $SHELL 

to see which shell you are using. Go to your home directory:

 cd 

and then open the file that is being called. (your shell) rc - that is, if you are using bash, open .bashrc

 nano .bashrc 

add a path to the end of this file:

 PATH=$PATH:/opt/mongo/bin export PATH 

For the question initialization part:

Download and edit script: Mongo init.d on github

You will need to change the DEAMON value on line 50. I had some other problems, but you should probably be fine if you create a configuration file (maybe it may be empty) and refer to it from line 57 In addition, you need to add the mongodb user, which should be started by the server. You can edit this on line 95, but by default it is probably a good idea.

When all this editing is done, you move the file to /etc/init.d/mongodb, for example:

 sudo mv init.d /etc/init.d/mongodb 

and then add it to the system startup procedure

 sudo update-rc.d mongodb defaults 

(It is assumed that you run debian. Other distributions may have different commands for this.)

Now make sure you are not using mongod elsewhere and are managing the service

 sudo service mongodb start service mongodb status sudo service mongodb stop 

... and so on. It also starts automatically at startup and shutdown.

+4
source

Source: https://habr.com/ru/post/1493844/


All Articles