Skip to content

Instantly share code, notes, and snippets.

@dmfilipenko
Forked from sasha-id/README
Created July 2, 2014 05:37
Show Gist options
  • Select an option

  • Save dmfilipenko/80b83d47fd15482f3fd6 to your computer and use it in GitHub Desktop.

Select an option

Save dmfilipenko/80b83d47fd15482f3fd6 to your computer and use it in GitHub Desktop.

Revisions

  1. Alex created this gist Mar 23, 2012.
    13 changes: 13 additions & 0 deletions README
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    MongoDB upstart scripts for Ubuntu.

    Run following commands after installing upstart scripts:

    ln -s /lib/init/upstart-job /etc/init.d/mongoconf
    ln -s /lib/init/upstart-job /etc/init.d/mongodb
    ln -s /lib/init/upstart-job /etc/init.d/mongos

    To start services use:

    service mongodb [start|stop|restart]
    service mongoconf [start|stop|restart]
    service mongos [start|stop|restart]
    4 changes: 4 additions & 0 deletions etc-mongo.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    # /etc/mongo.conf
    MONGODB_ENABLED=yes
    MONGOCONF_ENABLED=no
    MONGOS_ENABLED=no
    19 changes: 19 additions & 0 deletions etc-mongoconf.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    # /etc/mongoconf.conf
    #configsvr config file

    #start mongod in configsvr mode
    configsvr=true

    #where to log
    logpath=/var/log/mongodb/mongoconf.log

    #log overwritten or appended to
    logappend=true

    #override port
    #port=27019

    #path to data files
    #dbpath=/data/configdb

    smallfiles = true
    14 changes: 14 additions & 0 deletions etc-mongos.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # /etc/mongos.conf
    #mongos config file

    #config servers
    configdb=host1:27019,host2:27019,host3:27019

    #where to log
    logpath=/var/log/mongodb/mongos.log

    #log overwritten or appended to
    logappend=true

    #override port
    #port=27017
    16 changes: 16 additions & 0 deletions mongoconf.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Ubuntu upstart file at /etc/init/mongoconf.conf

    limit nofile 20000 20000

    kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

    start on runlevel [2345]
    stop on runlevel [06]

    script
    if [ -f /etc/mongo.conf ]; then . /etc/mongo.conf; fi
    if [ "x$MONGOCONF_ENABLED" = "xyes" ]; then
    ENABLE_MONGOCONF="yes"
    if [ "x$ENABLE_MONGOCONF" = "xyes" ]; then exec start-stop-daemon --make-pidfile --pidfile /var/run/mongoconf.pid --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongoconf.conf; fi
    fi
    end script
    22 changes: 22 additions & 0 deletions mongodb.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # Ubuntu upstart file at /etc/init/mongodb.conf

    limit nofile 20000 20000

    kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

    pre-start script
    mkdir -p /var/lib/mongodb/
    mkdir -p /var/log/mongodb/
    end script

    start on runlevel [2345]
    stop on runlevel [06]

    script
    if [ -f /etc/mongo.conf ]; then . /etc/mongo.conf; fi
    if [ "x$MONGODB_ENABLED" = "xyes" ]; then
    ENABLE_MONGODB="yes"
    if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi
    if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --make-pidfile --pidfile /var/run/mongodb.pid --start --quiet --chuid mongodb --exec /usr/bin/mongod -- --config /etc/mongodb.conf; fi
    fi
    end script
    16 changes: 16 additions & 0 deletions mongos.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    # Ubuntu upstart file at /etc/init/mongos.conf

    limit nofile 20000 20000

    kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

    start on runlevel [2345]
    stop on runlevel [06]

    script
    if [ -f /etc/mongo.conf ]; then . /etc/mongo.conf; fi
    if [ "x$MONGOS_ENABLED" = "xyes" ]; then
    ENABLE_MONGOS="yes"
    if [ "x$ENABLE_MONGOS" = "xyes" ]; then exec start-stop-daemon --make-pidfile --pidfile /var/run/mongos.pid --start --quiet --chuid mongodb --exec /usr/bin/mongos -- --config /etc/mongos.conf; fi
    fi
    end script