Ubuntu Install MongoDB

Source: Internet
Author: User
Tags install mongodb mongodb server

#!/bin/sh
# # # BEGIN INIT INFO
# Provides:mongodb
# Required-start:
# Required-stop:
# Default-start:2 3 4 5
# default-stop:0 1 6
# Short-description:mongodb
# Description:mongo DB Server
# # # END INIT INFO
Export lc_all= "C"
. /lib/lsb/init-functions
Program=/opt/mongodb/bin/mongod
Mongopid= ' Ps-ef | grep ' Mongod ' | Grep-v grep | awk ' {print $} '
Test-x $PROGRAM | | Exit 0
Case "$" in
Start
Log_begin_msg "Starting MongoDB server"
#/usr/bin/mongod--fork--quiet--dbpath/data/db--logpath/var/log/mongodb.log
/opt/mongodb/bin/mongod--fork--quiet-journal-maxconns=2400-rest--dbpath=/opt/mongdb--logpath/usr/local/src/ Data/mongodb/journal/mongdb.log
Log_end_msg 0
;;
Stop
Log_begin_msg "Stopping MongoDB server"
if [!-Z "$MONGOPID"]; Then
Kill-15 $MONGOPID
Fi
Log_end_msg 0
;;
Status
;;
*)
Log_success_msg "Usage:/etc/init.d/mongodb {start|stop|status}"
Exit 1
Esac
Exit 0


#
sudo chmod +x/etc/init.d/mongdb

#

The limits.conf file is actually a pam_limits.so configuration file in the Linux PAM (plug-in authentication module, pluggable authentication Modules), and only needles for a single session.
The limits.conf format is as follows:
username| @groupname Type Resource limit
username| @groupname: Sets the user name that needs to be restricted, the group name is preceded by the @ and the user name differs. You can also use the wildcard character * to restrict all users.
Type: Soft,hard and-,soft refer to the setting values that are currently in effect for the system. Hard indicates the maximum value that can be set in the system. The soft limit cannot be higher than the Har limit. -The soft and hard values are also set.
Resource
Core-limits the size of the kernel file
Date-Maximum data size
Fsize-Maximum file size
Memlock-Maximum lock memory address space
Nofile-Maximum number of open files
RSS-Maximum Persistent setting size
Stack-Maximum stack size
CPU-Maximum CPU time in minutes
Noproc-Maximum number of processes
As-address space limitations
Maxlogins-Maximum number of logons allowed by this user
For the limits.conf file configuration to take effect, you must make sure that the pam_limits.so file is added to the startup file. The view/etc/pam.d/login file has:
Session required/lib/security/pam_limits.so

Example: Modify file descriptor size (65536)
Vi/etc/security/limits.conf

* Soft Nofile 65536
* Hard Nofile 65536

#
Export lc_all= "C" to remove local settings

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.