29 April 2011

MongoDB Solaris 11 express

MongoDB is a lightweight noSQL db. You can check it out here: http://www.mongodb.org/

Installation is quite simple as well. You can simply follow quick start provided on their site, but it seems that solaris lacks some libs needed to run the dbms. But don't  worry. You can get wem yourself without a problem.

x32:
x64:
Also I recommend moving the libraries to /usr/lib so you won't need to extra-link them.

And now one more interesting thing. Adding SMF service. You can get the ready-made files at https://github.com/shl/mongodb.smf.

Hell... that gave me a lot of work to do. Ok, what should you do:
  1. Create some dir like
    /var/svc/manifest/network/mongodb
    and put a manifest file from the archive you've downloaded.
  2. Now move&rename method file to
    /lib/svc/method/svc-mongodb
    (so svc-mongodb is a new name)
  3. And now the most interesting stuff: edit svc-mongodb
    change:
    .. /lib/svc/share/smf_include.sh
    to
    . /lib/svc/share/smf_include.sh
    (remove one dot at the beginning)

    take a look at:
    /opt/mongo/bin/mongod --fork --logpath /var/log/mongo.log --log
    append --dbpath /var/lib/mongo
    First path shows where the mongo daemon is. So if your mongo root isn't /opt/mongo you have to change something. Next you have to remove a line-break because the option --logappend is recognized as --log append. And the last: --dbpath /var/lib/mongo is a path to the database. If you use default /data/db you can just remove it, if you use some different location, you'll want to tune that line a bit too.
  4. And at last register a service:
    svccfg
    svc:> validate /var/svc/manifest/network/mongodb/manifest
    svc:> import /var/svc/manifest/network/mongodb/manifest
    svc:> exit
    and start it:
    svcadm enable mongodb
Voila!
Now get to work!

No comments:

Post a Comment