發表文章

目前顯示的是 12月, 2016的文章

[ Mongodb ] 在ubnutu 14.04上安裝mongodb

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-14-04 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.lis sudo apt-get update sudo apt-get install -y mongodb-org Remove mongodb Try searching for installed mongo packages with  dpkg  : $ sudo dpkg -l | grep mongo That should output a list of packages with mongo in the name. If there are still files left on the system following an  apt-get remove mongo , try and run the command again with the  --purge  switch, using a wildcard search for the name: sudo apt-get remove mongodb* --purge

看mongodb log

Ref: http://stackoverflow.com/questions/15204341/mongodb-logging-all-queries I ended up solving this by starting mongod like this (hammered and ugly, yeah... but works for development environment): mongod --profile=1 --slowms=1 & This enables profiling and sets the threshold for "slow queries" as 1ms, causing all queries to be logged as "slow queries" to the file: /var/log/mongodb/mongodb.log Now I get continuous log outputs using the command: tail -f /var/log/mongodb/mongodb.log An example log: Mon Mar 4 15:02:55 [conn1] query dendro.quads query: { graph: "u:http://example.org/people" } ntoreturn:0 ntoskip:0 nscanned:6 keyUpdates:0 locks(micros) r:73163 nreturned:6 reslen:9884 88ms