MongoDB Basics (iv) Red Hat Enterprise 6.4 x64 Installation MONGDB 3.0 and configuration

Source: Internet
Author: User
Tags install mongodb mongodb mongodb version centos mongo shell

Mongodb-org
The package is a metadata package, the following 4 package packages will be installed automatically when installed
Mongodb-org-server
The package contains the Mongod daemon, the associated configuration, and

the initial script Mongodb-org-mongos
the package contains the MONGOs daemon

Mongodb-org-shell
The package contains the MONGO Shell
 
mongodb-org-tools
The package contains the following MongoDB tools:
mongoimport bsondump, Mongodump,mongoexport, Mongofiles, Mongooplog, Mongoperf, Mongorestore, Mongostat, Andmongotop.


1. Create a Yum source Repository file:
Vi/etc/yum.repos.d/mongodb-org-3.0.repo
[mongodb-org-3.0]
Name=mongodb Repository
baseurl=http://repo.mongodb.org/yum/redhat/6/mongodb-org/3.0/x86_64/
Gpgcheck =0
enabled=1


2. Install MongoDB packages and related tools:

Yum Install-y mongodb-org


If you install the specified version of MongoDB, you should independently specify the version number for each component package and appended to the package name, such as: sudo yum install-y mongodb-org-3.0.2 mongodb-org-server-3.0.2 mongodb-org-shell-3.0.2 mongodb-org-mongos-3.0.2 mongodb-org-tools-3.0.2


You can also define any available MongoDB version, and Yum will automatically update the MONGODB package when there is an updated version. To prevent inadvertent updates, you can use the Exclude directive in/etc/yum.conf, such as:
Exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools


3. Related configuration:

If the firewall is turned on, SELinux must be configured to allow MongoDB to run on the Red Hat system or CentOS Linux.
an administrator should set the following 3 options:

1. Allow port 27017 access (without first download tool semanage):
yum-y install Policycoreutils-python
semanage port-a-t mongod_port_t-p TCP 27017


2. In profile/etc/selinux/config set SELinux mode to permissive:
vi/etc/selinux/config

selinux=enforcing 
instead
Selinux=permissive


3. Completely disable SELINUX:
selinux=disabled

The default data file path for MongoDB instance storage is/var/lib/mongo, and the storage log file path is/var/log/mongodb and runs with the Mongod account. You can also configure the directory of data files and log files in the file/etc/mongod.conf.
Vi/etc/mongod.conf
# mongod.conf #where to log logpath=/var/log/mongodb/mongod.log logappend=true # fork and run in background fork=true #port =27017 Dbpath=/var/lib/mongo # location of Pidfile Pidfilepath=/var/run/mongodb/mongod.pid # Listen to local Inter Face only.
Comment out to listen on all interfaces. bind_ip=127.0.0.1 # Disables Write-ahead journaling # nojournal=true # enables periodic logging of CPU utilization and I  /o wait #cpu =true # Turn on/off security.
OFF is currently the default #noauth =true #auth =true # Verbose logging output. #verbose =true # Inspect All client data for validity on receipt (useful for # Developing drivers) #objcheck =true # ENABL E DB Quota Management #quota =true # Set oplogging level where n is # 0=off (default) # 1=w # 2=r # 3=both # 7=w
+some reads #diaglog =0 # Ignore Query hints #nohints =true # Enable The HTTP interface (Defaults to Port 28017).  #httpinterface =true # Turns off server-side scripting. This'll result in greatly limited # FUNCTIonality #noscripting =true # Turns off table scans.
Any query this would do a table scan fails.
#notablescan =true # Disable data file preallocation.
#noprealloc =true # specify. ns file size for new databases. # nssize=<size> # Replication Options # in replicated MONGO databases, specify the replica set name here #replSet = SetName # maximum size in megabytes for replication operation Log #oplogSize =1024 # Path to a key file storing Authenticat
 Ion info for connections # between replica set members #keyFile =/path/to/keyfile


4. Running MongoDB

Set up MongoDB with system self-boot:
chkconfig mongod on


enable MongoDB services: Service
mongod start


Verify that MongoDB started successfully: (see if the log has information waiting to be connected)
tail-5/var/log/mongodb/mongod.log

[Initandlisten] Waiting for connections On Port <port>

You also see that the data has been generated:



Enter MONGO directly on the command line to enter the database:



at this point, complete. ~

Official reference: Install MongoDB on Red Hat Enterprise or CentOS Linux



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.