Line 1: |
Line 1: |
| == How to install MongoDB 4.0 == | | == How to install MongoDB 4.0 == |
| + | |
| + | {{Note box| All info is based on SME Server 9 only but I have just started to test on v10 - see notes below}} |
| | | |
| === Install Official Repository === | | === Install Official Repository === |
| + | |
| + | This should work for every version of Koozali SME |
| + | |
| + | You may need to change the mongodb version as required |
| + | |
| db yum_repositories set mongodb repository \ | | db yum_repositories set mongodb repository \ |
− | BaseURL https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/4.0/x86_64/ \ | + | BaseURL https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/4.0/$basearch/ \ |
| EnableGroups no \ | | EnableGroups no \ |
| GPGCheck yes \ | | GPGCheck yes \ |
Line 24: |
Line 31: |
| | | |
| ===Start Mongo=== | | ===Start Mongo=== |
| + | |
| + | {{Warning box|Please check additional notes below before trying this section}} |
| + | |
| + | {{Note box|If you start mongo like this you will run mongo as root. |
| + | When mongo later tries to start automatically it may fail because it will be started as the mongod user and won't be able to access the DB files.}} |
| + | |
| /etc/init.d/mongod start | | /etc/init.d/mongod start |
| | | |
Line 39: |
Line 52: |
| signal-event post-upgrade | | signal-event post-upgrade |
| signal-event reboot | | signal-event reboot |
| + | |
| + | ===Additional Notes=== |
| + | |
| + | Note - I need to test this again This is my initial observation. |
| + | |
| + | As far as I can see, the link above to mongodb is not necessary. |
| + | |
| + | It may need this to set on and off correctly in other service levels: |
| + | |
| + | chkconfig mongod on |
| + | |
| + | Create a service link in in rc7.d: |
| + | |
| + | ln -s /etc/init.d/mongod /etc/rc.d/rc7.d/S57mongod |
| + | |
| + | To use e-smith-service it will need a key: |
| + | |
| + | config set mongod service status enabled |
| + | |
| + | You should now be able to do: |
| + | |
| + | service mongod start|stop|restart etc |
| + | |
| + | Mongo should come up on boot. |
| + | |
| + | |
| + | ==Koozali SME v10== |
| + | |
| + | {{Warning box| Complete work in progress - here be Dragons!}} |
| + | |
| + | ===Install=== |
| + | Use the above method to add the repo and then: |
| + | |
| + | yum --enablerepo=mongodb install mongodb-org |
| + | |
| + | Mongo will automatically create a symlink so currently there is no way to enable/disable it apart from manually. Once Koozali SME has some more systemd tools we can use DB keys etc. |
| + | |
| + | Created symlink from /etc/systemd/system/multi-user.target.wants/mongod.service to /usr/lib/systemd/system/mongod.service |
| + | |
| + | To enable/disable this just use: |
| + | |
| + | systemctl {en|dis}able mongodb |
| + | |
| + | And to start stop |
| + | |
| + | systemctl {start|stop|restart} mongodb |
| + | |
| + | ===Vaporise or reinitialise the database=== |
| + | |
| + | {{Warning box| This will totally and utterly vaporise your data. Got a backup?? You have been warned}} |
| + | |
| + | Remove the directory contents: |
| + | |
| + | rm -rf /var/lib/mongo/* |
| + | |
| + | Or remove the entire directory and recreate it with the correct ownership: |
| + | |
| + | rm -rf /var/lib/mongo |
| + | mkdir -p /var/lib/mongo |
| + | chown -R mongod:mongod /var/lib/mongo |
| + | |
| + | If you have a replicaset set in /etc/mongod.conf make sure you initiate it: |
| + | |
| + | mongo --eval "printjson(rs.initiate())" |
| | | |
| ---- | | ---- |
| [[Category:Howto]] | | [[Category:Howto]] |
| [[Category:Administration]] | | [[Category:Administration]] |