MongoDB RPM Package Installation

Source: Internet
Author: User
Tags mongo shell

Monfodb is an open source document database that provides common performance, high availability, auto-scaling, and more

A record in MongoDB is a document, which is a pair of fields and values that make up the structure. A MongoDB document resembles a JSON object, and the value of a field can contain an array of other documents, arrays, and documents. Records are organized into collection, which are equivalent to tables. Reference:



The advantages of using a document are:
documentation for native data objects in many programming languages
inline documents and arrays reduce the cost of joins
Dynamic schema supports smooth polymorphism

Key Features:
Performance:
MongoDB provides high performance data persistence. Especially:
Support for inline data model reduces I/O for database systems
Indexes support quick queries and inline documents and arrays can contain keys

High Availability:
MongoDB offers high availability is replica sets
Auto Fail switch
Data redundancy
Replica set is a set of MONGODB servers that maintain the same data set, provide redundancy, and increase data availability.

Automatic Horizontal scaling:
Horizontal scaling is the kernel feature of MongoDB.
Automatically share distributed data on a cluster
The replica sets provides final consistent reads for low-latency, high-throughput applications.


Installation:

0
Environment
[Email protected] ~]# uname-a
Linux host2 2.6.32-504.3.3.el6.x86_64 #1 SMP Wed Dec 01:55:02 UTC x86_64 x86_64 x86_64 gnu/linux
[Email protected] ~]# cat/etc/issue
CentOS Release 6.5 (Final)
Kernel \ r on an \m

1
Configuring the Yum Source
[Email protected] ~]# Vi/etc/yum.repos.d/mongodb.repo
[MongoDB]
Name=mongodb Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
Gpgcheck=0
Enabled=1

2
With the command $ yum install-y mongodb-org installed, the command will automatically install the following four packages
Mongodb-org-server:this package contains the Mongod daemon and associated configuration and init scripts.
Mongodb-org-mongos:this package contains the MONGOs daemon.
Mongodb-org-shell:this package contains the MONGO shell.
Mongodb-org-tools:this package contains the following MongoDB Tools:mongoimport Bsondump, Mongodump, Mongoexport, Mongof Iles, Mongooplog, Mongoperf, Mongorestore, Mongostat, and Mongotop.

To install a specific version, you can use the command yum install-y mongodb-org-2.6.1 mongodb-org-server-2.6.1 mongodb-org-shell-2.6.1 mongodb-org-mongos-2.6.1 mongodb-org-tools-2.6.1

The 2.6.7 version is currently installed with the Yum install-y mongodb-org command
[email protected] ~]# Yum install-y mongodb-org
.。。。
Installed:
Mongodb-org.x86_64 0:2.6.7-1

Dependency installed:
mongodb-org-mongos.x86_64 0:2.6.7-1 mongodb-org-server.x86_64 0:2.6.7-1
mongodb-org-shell.x86_64 0:2.6.7-1 mongodb-org-tools.x86_64 0:2.6.7-1

complete!
[Email protected] ~]#

3
To prevent Automatic Updates, add the following line to the/etc/yum.conf:
Exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

4
Configuring SELinux
Semanage port-a-t mongod_port_t-p TCP 27017

$ yum Search Semanage
$ yum-y Install libsemanage-python.x86_64

Or
In/etc/selinux.conf
Selinux=permissive/selinux=disabled

Or
[Email protected] ~]# Getenforce
Enforcing
[Email protected] ~]# Setenforce 0
[Email protected] ~]# Getenforce
Permissive

5
View
The default data file is in/var/lib/mongo, and the log file is in/var/log/mongodb,
You can change the data and log file directories in the configuration file/etc/mongod.conf.
Run as user Mongod. If you are running with another user, you need to change the access permissions of the data directory and log directory.

Data file related
[Email protected] ~]# ll/var/lib/
。。。
Drwxr-xr-x. 2 Mongod mongod 4096 January 07:15 MONGO
[Email protected] ~]# Ll/var/lib/mongo
Total dosage 0

Log file correlation
[Email protected] ~]# ll/var/log/
。。。
Drwxr-xr-x. 2 Mongod mongod 4096 February 2 14:35 MongoDB
[Email protected] ~]# ll/var/log/mongodb/
Total dosage 0
-rw-r-----. 1 mongod mongod 0 January 07:15 Mongod.log

6
Running MongoDB
[Email protected] ~]#/etc/init.d/mongod status
Mongod has stopped
[[Email protected] ~]# service Mongod status
Mongod is stopped
[[Email protected] ~]# service Mongod start
Starting Mongod: [OK]

7
Inspection:
[Email protected] ~]# NETSTAT-NTPL | grep Mongod
TCP 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 5334/mongod

[Email protected] ~]# ll/var/lib/mongo/
Total dosage 81936
Drwxr-xr-x. 2 Mongod mongod 4096 February 2 15:16 Journal
-RW-------. 1 Mongod mongod 67108864 February 2 15:16 local.0
-RW-------. 1 Mongod mongod 16777216 February 2 15:16 local.ns
-rwxr-xr-x. 1 Mongod mongod 5 February 2 15:16 mongod.lock
Drwxr-xr-x. 2 Mongod mongod 4096 February 2 15:16 _tmp

8
Configure boot-up
Chkconfig Mongod on

9
Command line Entry test
[Email protected] ~]# MONGO
MongoDB Shell version:2.6.7
Connecting To:test
Welcome to the MongoDB shell.
For interactive help, type ' help '.
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the Support group
Http://groups.google.com/group/mongodb-user
> Show DBS
Admin (empty)
Local 0.078GB
> db.version ();
2.6.7
>
>
> Help
Db.help () Help on DB methods
Db.mycoll.help () Help on collection methods
Sh.help () sharding Helpers
Rs.help () Replica set helpers
Help Admin Administrative Help
Help connect connecting to a DB help
Help keys key shortcuts
Help Misc Misc Things to Know
Help Mr MapReduce

Show DBS Show Database names
Show collections show collections in current database
Show users show users in current database
Show profile Show most recent system.profile entries with time >= 1ms
Show logs show the accessible logger names
Show log [name] prints out the last segment of log in memory, ' global ' is default
Use <db_name> Set current database
Db.foo.find () List objects in collection Foo
Db.foo.find ({a:1}) List objects in Foo where a = = 1
It result of the last line evaluated; Use to further iterate
dbquery.shellbatchsize = X Set default number of items to display on shell
Exit quit the MONGO shell
>
> Exit
Bye
[Email protected] ~]#

10
Stop it
sudo service Mongod stop

You can view errors and related information for the Mongod process through the log file/var/log/mongodb/mongod.log.


Reference:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/


-----------------

Reprint Please specify the source:
Blog.csdn.net/beiigang

MongoDB RPM Package Installation

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.