Skip to content

LapDevelopment_MongoDB

StephanOepen edited this page Jan 14, 2015 · 13 revisions

Initial Setup

The database is stored on a dedicated partition (on the SSD RAID); to prepare and mount the filesystem:

  mkfs.ext4 /dev/datavg/mongo
  mount /var/lib/mongodb

Install the server, client, and libraries:

  yum -y install mongodb mongodb-server libmongodb libmongodb-devel

In /etc/mongodb.conf, enable incoming connections from the ABEL-internal network and require authentication:

  bind_ip = 127.0.0.1,10.110.0.132
  auth = true

In /etc/init.d/mongod, declare NUMA policy (interleaving memory over all cpus) for the database daemon:

  daemon [...] "numactl --interleave=all $exec [...]"

Finally, create a database user laportal with administrator rights:

  mongo --authenticationDatabase admin

  use admin
  db.addUser( { user: "laportal", pwd: "????????", roles: [ "userAdminAnyDatabase" ] } )

Starting, Stopping, and Restarting the Database Server

  sudo /etc/init.d/mongod start|stop|restart

LAP Store Configuration

For the time being, at least, we assume that all annotations (by all LAP users) share one database and one database user; to initially create the database and user:

  mongo --verbose -u laportal -p '????????' admin

  use lapstore
  db.addUser({ user: "lapstore", pwd: "????????", roles: [ "readWrite" ] })

Interactive Database Inspection and Manipulation

To connect to the LAP Store using the MongoDB Shell:

  mongo --verbose -u lapstore -p '????????' lapstore

To inspect the contents of a specific collection (use show collections or db.getCollectionNames() for the selection):

  db[db.getCollectionNames()[0]].find().pretty()

To drop all collections, i.e. free up storage space; this will render all Galaxy files in all user histories (i.e. receipts, referring to collections) useless, thus must only be used on development instances:

  db.getCollectionNames().forEach(function(foo) { if (foo.indexOf("system.") == -1) db[foo].drop(); })
Clone this wiki locally