昊鼎王五: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 <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
> 

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

还有其他问题的可以在评论区留言或者扫码加博主获取资源或者提问。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值