昊鼎王五:linux(centos7)如何三分钟搭建mongodb单机服务器?

#昊鼎王五:linux(centos7)如何三分钟搭建mongodb单机服务器?

#1.基础知识:

##1.1什么是mongodb?

是NOSQL数据库服务器。

##1.2如何搭建mongodb服务器?

最小化的mongodb是1台机器,分别拟定如下:
A:192.168.1.101     服务端口是10001
具体请见详细搭建步骤

架构图如下:

#2.搭建mongodb服务器的步骤:
##2.1.获取包并解压

cd /hd205/service/mongodbwork
ll mongodb-linux-x86_64-rhel70-3.0.6.tgz
tar xf mongodb-linux-x86_64-rhel70-3.0.6.tgz
mv mongodb-linux-x86_64-rhel70-3.0.6 mongodb

##2.2.创建所需要的目录:

mkdir -p /hd205/service/mongodbwork/data/single
mkdir -p /hd205/service/mongodbwork/log

#3.启动:

/hd205/service/mongodbwork/mongodb/bin/mongod -port 10001 --dbpath  /hd205/service/mongodbwork/data/single --logpath /hd205/service/mongodbwork/log/mongodb.log --fork

#4.验证mongodb连接:

[root@haoding205 bin]# ./mongo -port 10001
MongoDB shell version v3.0.6-6-g47e002d
connecting to: mongodb://127.0.0.1:10001/
> 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                 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
> 

好了,聪明如你,知道了linux(centos7)如何三分钟搭建mongodb单机服务器,是不是很欢喜 _

还有其他问题的可以在评论区留言或者扫码加博主获取资源或者提问。
昊鼎王五:linux(centos7)如何三分钟搭建mongodb单机服务器?_第1张图片

你可能感兴趣的:(mongodb)