Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
2013-08-19 14:03
746 查看
1,启动脚本
保存在 /etc/init.d/mongodb
2,下载自己需要的版本,我这用的是mongodb-linux-x86_64-0.9.2.tgz
3,创建mongodb目录,和数据库目录。
4,增加mongodb用户
5,编写配置文件
保存在 /etc/init.d/mongodb
Helder RibeiroFreedom on all levels. Installing MongoDB on Gentoo So I had some trouble running the good old “sudo emerge mongodb -va” due to some issues. After installing it by hand I found this little portage overlay that handles things better, but it has an outdated version of MongoDB, so I’ll show you how to get the latest and greatest. It’s all very basic, but since I’m no sysadmin, I still had to wrestle with things a bit to get it working, so I hope to relieve others of the same effort. Since the problem was with one of the dependencies (spidermonkey), you’ll need the static version, that is, the one that comes with all the dependencies compiled in. Below is the one I used, but make sure to find the latest tgz for your platform here (choose the “legacy-static”). wget http://downloads.mongodb.org/linux/mongodb-linux-i686-static-1.4.2.tgz After that, basically all you have to do is follow the instructions on this guide. It’s in German, but you can get what you have to do from the commands it tells you to run (the automatic translation is also not so bad). The only thing you’re not supposed to do is copy the script in the section “Start-Stop Script”. It is meant for Debian distributions and won’t work on Gentoo because of some missing commands. So instead, copy the script below into /etc/init.d/mongodb, give it +x permission and follow the rest of the guide as usual. Let me know if you run into any troubles! #! /bin/sh # start / stop script for mongodb ### BEGIN INIT INFO # Provides: mongod # Required-Start: \$remote_fs \$syslog # Required-Stop: \$remote_fs \$syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start mongod at boot time # Description: Enable service provided by mongod. ### END INIT INFO # Source function library. #. /lib/lsb/init-functions retval=0 pidfile=/var/run/mongodb.pid exec="/bin/mongod" prog="mongod" config="/etc/mongodb/mongodb.conf" lockfile="/var/lock/mongod" [ -e $config ] && . $config start() { if [ ! -x $exec ] then echo $exec not found exit 5 fi echo "Starting mongoDB daemon" echo $prog start-stop-daemon --start --pidfile $pidfile -m -c $MONGO_USER \ --exec $exec -- $MONGO_OPTS run > /dev/null 2>&1 & retval=$? if [ $retval -eq 0 ] then echo 0 else echo 1 fi return $retval } stop() { echo "Stopping mongoDB daemon" echo $prog start-stop-daemon --stop --pidfile $pidfile --retry 10 \ --exec $exec retval=$? if [ $retval -eq 0 ] && rm -f $lockfile then echo 0 else echo 1 fi rm -f $pidfile return $retval } restart() { stop start } reload() { restart } # See how we were called. case "$1" in start) $1 ;; stop) $1 ;; restart) $1 ;; reload) $1 ;; *) echo "Usage: $0 {start|stop|restart|reload}" exit 2 esac exit $?
2,下载自己需要的版本,我这用的是mongodb-linux-x86_64-0.9.2.tgz
# cd /tmp/ # wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-0.9.2.tgz # tar -xzf mongodb-linux-x86_64-0.9.2.tgz
3,创建mongodb目录,和数据库目录。
# mv mongodb-linux-x86_64-0.9.2 /opt/mongodb # mkdir -p /data/mongodb
4,增加mongodb用户
# useradd mongod -s /bin/false # chown -R mongod:mongod /data/mongodb
5,编写配置文件
# mkdir /etc/mongodb # cat << EOF > /etc/mongodb/mongodb.conf MONGO_USER="mongod" MONGO_OPTS="--dbpath /data/mongodb/" EOF
相关文章推荐
- intellij IDE Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- 运行的程序时,出现内存不足时的解决方式Exception in thread "main" java.lang.OutOfMemoryError: Java heap space(转)
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space(Java堆空间内存溢出)解决方法
- Eclipse迅速执行:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- OOM:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Java Eclipse Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space解决方法
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space解决方法
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space解决方法
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space(Java堆空间内存溢出)解决方法
- Eclipse运行程序提示:Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
- 问题描述 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space 解决方案[转] 一直都知道可以设置jvm he
- Exception in thread "main" java.lang.OutOfMemoryError: Java heap space(Java堆空间内存溢出)解决方法