Centos 6 install MongoDB and server configuration using yum

Source: Internet
Author: User
Tags install mongodb mongodb server mongo shell

There are many ways to install MongoDB. you can install MongoDB in source code or in centos using Yum source. Because MongoDB is updated fast, I prefer the yum source installation method. The installation steps for 64-bit centos are as follows:

1. Preparations

Run the yum command to view the MongoDB package information [root @ localhost ~] # Yum info mongo-10gen

(No matching information is displayed.) The yum source in your centos system does not contain MongoDB resources. Therefore, you need to add the yum source before installing MongoDB using the yum command, that is, in/etc/yum. repos. d/Add * to the directory *. repo Yum source configuration file

2. VI/etc/yum. Repos. d/10gen. Repo. Enter the following statement:

[10gen]

Name = 10gen Repository

Base url = http://downloads-distro.mongodb.org/repo/redhat/ OS /x86_64

Gpgcheck = 0

After configuring the yum source, if the configuration is correct, execute the following command to query MongoDB-related information:

View MongoDB server package information

[Root @ localhost geffzhang] # Yum info mongo-10gen-server
* Base: centos.ustc.edu.cn
* Extras: centos.ustc.edu.cn
* Updates: centos.ustc.edu.cn
Installed packages
Name: mongo-10gen-server
Arch: x86_64
Version: 2.0.6
Release: mongodb_1
Size: 13 m
Repo: Installed
From repo: 10gen
Summary: Mongo server, sharding server, and support scripts
URL: http://www.mongodb.org
License: agpl 3.0
Description: Mongo (from "Humongous") is a schema-free document-oriented
: Database.
:
: This package provides the Mongo server software, Mongo sharding
: Server softwware, default configuration files, and init. d scripts.
View Client installation status
[Root @ localhost geffzhang] #

* Base: centos.ustc.edu.cn
* Extras: centos.ustc.edu.cn
* Updates: centos.ustc.edu.cn
Installed packages
Name: mongo-10gen
Arch: x86_64
Version: 2.0.6
Release: mongodb_1
Size: 69 m
Repo: Installed
From repo: 10gen
Summary: Mongo client shell and tools
URL: http://www.mongodb.org
License: agpl 3.0
Description: Mongo (from "Humongous") is a schema-free document-oriented
: Database. It features dynamic profileable queries, full indexing,
: Replication and fail-over support, efficient storage of large
: Binary data objects, and auto-sharding.
:
: This package provides the Mongo shell, import/export tools, and
: Other client utilities.

3. Install the MongoDB server and client tools
[Root @ localhost geffzhang] # Yum install mongo-10gen-server

[Root @ localhost geffzhang] # Yum install mongo-10gen

4. Start MongoDB

Service Producer d start

Later updated, stop MongoDB, execute Yum update mongo-10gen mongo-10gen-server can be.

5. server configuration:/etc/same D. conf

  1. # Mongo. conf
  2. # Where to log
  3. Logpath =/var/log/Mongo/mongod. Log
  4. Logappend = true # Write logs by append
  5. # Fork and run in background
  6. Fork = true
  7. # Port = 27017 # Port
  8. Dbpath =/var/lib/Mongo # database file storage location
  9. Directoryperdb = true
  10. # Enables periodic logging of CPU utilization and I/O wait
  11. # Enable periodic recording of CPU utilization and I/O wait
  12. # CPU = true
  13. # Turn On/Off security. Off is currently the default
  14. # Whether to run in Security Authentication mode. The default mode is non-security mode.
  15. # Noauth = true
  16. # Auth = true
  17. # Verbose logging output.
  18. # Detailed record output
  19. # Verbose = true
  20. # Inspect all client data for validity on receept (useful
  21. # Developing Drivers) is used to check the validity of data received by the client during driver development.
  22. # Objcheck = true
  23. # Enable dB quota management to enable database quota management. By default, each database can have 8 files, which can be set using the quotafiles parameter.
  24. # Quota = true
  25. # Set the oplog record level
  26. # Set oplogging level where N is
  27. #0 = off (default)
  28. #1 = W
  29. #2 = r
  30. #3 = both
  31. #7 = W + some reads
  32. # Oplog = 0
  33. # Diagnostic/debugging option dynamic debugging item
  34. # Nocursors = true
  35. # Ignore query hints ignore query prompt
  36. # Nohints = true
  37. # Disable the HTTP interface. The default value is localhost: 28017.
  38. # Disable the HTTP interface (defaults to localhost: 27018). This port number is written incorrectly.
  39. # Nohttpinterface = true
  40. # Disable the server script, which greatly limits the function.
  41. # Turns Off server-side scripting. This will result in greatly limited
  42. # Functionality
  43. # Noscripting = true
  44. # Close the scan table. Any query will fail.
  45. # Turns off table scans. Any query that wocould do a table scan fails.
  46. # Notablescan = true
  47. # Disable data file pre-allocation
  48. # Disable data file preallocation.
  49. # Noprealloc = true
  50. # Specify the size of the. Ns file for the new database. Unit: MB
  51. # Specify. Ns file size for new databases.
  52. # Nssize = <size>
  53. # Accout token for Mongo monitoring server.
  54. # MMS-Token = <token>
  55. # Mongo monitoring server name
  56. # Server name for Mongo monitoring server.
  57. # MMS-name = <server-Name>
  58. # Ping interval of the Mongo Monitoring Server
  59. # Ping interval for Mongo monitoring server.
  60. # MMS-interval = <seconds>
  61. # Replication options
  62. # In replicated Mongo databases, specify here whether this is a slave or master in replication, specifying that the current is a slave
  63. # Slave = true
  64. # Source = master.example.com
  65. # Slave only: specify a single database to replicate
  66. # Only = master.example.com
  67. # Or
  68. # Master = true
  69. # Source = slave.example.com

 

 

 

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.