CentOS6.5 Installing MongoDB

Source: Internet
Author: User
Tags mkdir mongodb mongodb server centos dochub

1. Prepare the mongodb-linux-x86_64-3.4.6.tgz first,

Can be downloaded from the official website, you can also download me from the official website of the 3.4.6 version. Download LINK Address: http://pan.baidu.com/s/1dFgWb0t

2. Start the installation:

First, now create the MongoDB directory under the/usr/local/directory:

Mkdir/usr/local/mongodb

Move the prepared tgz file to the MongoDB directory created above:

MV mongodb-linux-x86_64-3.4.6.tgz/usr/local/mongodb/

Extract:

Tar-xvzf mongodb-linux-x86_64-3.4.6.tgz

To delete a compressed package:

RM mongodb-linux-x86_64-3.4.6.tgz

Create a directory where MongoDB defaults to hold data: (Create/data/db under absolute path)

Mkdir-p/data/db

Open 27017 Access Port permissions

-A input-m state--state new-m tcp-p TCP--dport 27017-j ACCEPT

Restarting the firewall

Service Iptables Restart

3. Run the MongoDB server and go to the bin directory to execute:

./mongod

The following information will be printed on the terminal:

[Root@centos-server-yzr bin]#./mongod
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] MongoDB starting:pid=1827 port=27017 dbpath=/data/db 64-bit Host =centos-server-yzr
2017-07-18t18:16:33.918+0800 I CONTROL [initandlisten] DB version v3.4.6
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] git version:c55eb86ef46ee7aede3b1e2a5d184a7df4bfb5b5
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] Allocator:tcmalloc
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] Modules:none
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] Build environment:
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] distarch:x86_64
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] target_arch:x86_64
2017-07-18t18:16:33.918+0800 I CONTROL [Initandlisten] options: {}
2017-07-18t18:16:33.948+0800 I-[Initandlisten] detected data files in/data/db created by the ' Wiredtiger ' storage Engin E, so setting the active storage engine to ' Wiredtiger '.
2017-07-18t18:16:33.949+0800 I STORAGE [Initandlisten]
2017-07-18t18:16:33.949+0800 I STORAGE [initandlisten] * * warning:using The XFS filesystem is strongly recommended with T He wiredtiger storage engine
2017-07-18t18:16:33.949+0800 I STORAGE [Initandlisten] * * See Http://dochub.mongodb.org/core/prodnotes-filesystem
2017-07-18t18:16:33.949+0800 I STORAGE [Initandlisten] Wiredtiger_open config:create,cache_size=1396m,session_max= 20000,eviction= (threads_min=4,threads_max=4), config_base=false,statistics= (FAST), log= (enabled=true,archive= True,path=journal,compressor=snappy), file_manager= (close_idle_time=100000), checkpoint= (Wait=60,log_size=2GB), Statistics_log= (wait=0),
2017-07-18t18:16:34.342+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.342+0800 I control [Initandlisten] * * warning:access CONTROL is not enabled for the database.
2017-07-18t18:16:34.342+0800 I CONTROL [initandlisten] * * Read and Write access to data and configuration is unrestricted.
2017-07-18t18:16:34.342+0800 I CONTROL [initandlisten] * * Warning:you is running this process as the root user, which is Not recommended.
2017-07-18t18:16:34.342+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/enabled is ' Always '.
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/defrag is ' Always '.
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.345+0800 I ftdc [Initandlisten] Initializing full-time diagnostic data capture with directory '/data/ Db/diagnostic.data '
2017-07-18t18:16:34.346+0800 I NETWORK [thread1] waiting for connections on port 27017


4. Open another terminal and go to the bin directory under MongoDB to execute:

./mongo

The following information will be printed at the terminal:

[Root@centos-server-yzr bin]#./mongo
MongoDB Shell version v3.4.6
Connecting to:mongodb://127.0.0.1:27017
MongoDB Server version:3.4.6
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
Server has startup warnings:
2017-07-18t18:16:33.949+0800 I STORAGE [Initandlisten]
2017-07-18t18:16:33.949+0800 I STORAGE [initandlisten] * * warning:using The XFS filesystem is strongly recommended with T He wiredtiger storage engine
2017-07-18t18:16:33.949+0800 I STORAGE [Initandlisten] * * See Http://dochub.mongodb.org/core/prodnotes-filesystem
2017-07-18t18:16:34.342+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.342+0800 I control [Initandlisten] * * warning:access CONTROL is not enabled for the database.
2017-07-18t18:16:34.342+0800 I CONTROL [initandlisten] * * Read and Write access to data and configuration is unrestricted.
2017-07-18t18:16:34.342+0800 I CONTROL [initandlisten] * * Warning:you is running this process as the root user, which is Not recommended.
2017-07-18t18:16:34.342+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/enabled is ' Always '.
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * WARNING:/sys/kernel/mm/transparent_hugepage/defrag is ' Always '.
2017-07-18t18:16:34.343+0800 I CONTROL [initandlisten] * * We suggest setting it to ' never '
2017-07-18t18:16:34.343+0800 I CONTROL [Initandlisten]
> Show DBS
Admin 0.000GB
Local 0.000GB
> db.version ()
3.4.6
> Use Post
Switched to DB Post
> Show DBS
Admin 0.000GB
Local 0.000GB
TestDB 0.000GB
> Use TestDB
Switched to DB TestDB
> db.createcollection ("Mycoll")
{"OK": 1}
> Db.mycoll.insert ({"Name": "ZYR"})
Writeresult ({"ninserted": 1})
> Show Collections
Mycoll
>

5. Connect to the MongoDB server using Mongovue in Windows

Where the Name property can be filled out, at startup without configuring password Authentication configuration, so do not require login password can be directly connected.









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.