【mongodb】mongodb的安装

本文涉及的产品
云数据库 MongoDB,通用型 2核4GB
简介:
获取mongo db安装包解压
[root@localhost ~]# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.3-rc0.tgz
[monogdb@localhost ~]$ tar xzf mongodb-linux-x86_64-1.8.3-rc0.tgz  
创建monogdb的数据存放位置并赋予monogdb相应的权限。
[root@localhost ~]# cd /opt
[root@localhost opt]# mkdir monogdata
[root@localhost opt]# ls
monogdata  oracle  software
[root@localhost opt]# chown monogdb:monogdb /opt/monogdata/
[root@localhost opt]# su - monogdb
[monogdb@localhost ~]$ mv mongodb-linux-x86_64-1.8.3-rc0  monogdb
[monogdb@localhost ~]$ cd monogdb/
[monogdb@localhost monogdb]$ cd bin/

[monogdb@localhost bin]$ ./mongod  -dbpath /opt/monogdata/data/ --指定monogdb数据存放的位置。并开启monogdb的服务。
Mon Aug  8 20:45:15 [initandlisten] MongoDB starting : pid=10340 port=27017 dbpath=/opt/monogdata/data/ 64-bit 
Mon Aug  8 20:45:15 [initandlisten] db version v1.8.3-rc0, pdfile version 4.5
Mon Aug  8 20:45:15 [initandlisten] git version: 81147c1ca4cc10d9a81a0a2afdf364ab1ca8867d
Mon Aug  8 20:45:15 [initandlisten] build sys info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Mon Aug  8 20:45:15 [initandlisten] waiting for connections on port 27017
Mon Aug  8 20:45:15 [websvr] web admin interface listening on port 28017
Mon Aug  8 20:47:15 [initandlisten] connection accepted from 127.0.0.1:21108 #1
Mon Aug  8 21:16:25 [conn1] end connection 127.0.0.1:21108
在另一个窗口即客户端
/home/monogdb/monogdb/bin目录下,执行./mongo 启动客户端和服务端连接,并做一些简单的测试。
[monogdb@localhost bin]$ ./mongo 
MongoDB shell version: 1.8.3-rc0
connecting to: test
> db                                                                                                                                
test
> use test;
switched to db test
> help
        db.help()                    help on db methods
        db.mycoll.help()             help on collection methods
        rs.help()                    help on replica set methods
        help connect                 connecting to a db help
        help admin                   administrative help
        help misc                    misc things to know
        help mr                      mapreduce help

        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
        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

> show dbs
admin   (empty)
local   (empty)
> show users
> show profile
db.system.profile is empty
Use db.setProfilingLevel(2) will enable profiling
Use db.system.profile.find() to show raw profile entries
> exit
bye
相关实践学习
MongoDB数据库入门
MongoDB数据库入门实验。
快速掌握 MongoDB 数据库
本课程主要讲解MongoDB数据库的基本知识,包括MongoDB数据库的安装、配置、服务的启动、数据的CRUD操作函数使用、MongoDB索引的使用(唯一索引、地理索引、过期索引、全文索引等)、MapReduce操作实现、用户管理、Java对MongoDB的操作支持(基于2.x驱动与3.x驱动的完全讲解)。 通过学习此课程,读者将具备MongoDB数据库的开发能力,并且能够使用MongoDB进行项目开发。   相关的阿里云产品:云数据库 MongoDB版 云数据库MongoDB版支持ReplicaSet和Sharding两种部署架构,具备安全审计,时间点备份等多项企业能力。在互联网、物联网、游戏、金融等领域被广泛采用。 云数据库MongoDB版(ApsaraDB for MongoDB)完全兼容MongoDB协议,基于飞天分布式系统和高可靠存储引擎,提供多节点高可用架构、弹性扩容、容灾、备份回滚、性能优化等解决方案。 产品详情: https://www.aliyun.com/product/mongodb
相关文章
|
5月前
|
开发框架 NoSQL JavaScript
mongoDB入门教程四:安装Node+express环境支撑
mongoDB入门教程四:安装Node+express环境支撑
48 0
|
5月前
|
NoSQL 数据可视化 MongoDB
Windows MongoDB的安装及配置图文说明(非常详细)
Windows MongoDB的安装及配置图文说明(非常详细)
292 0
|
5月前
|
NoSQL MongoDB 数据库
mongoDB入门教程一:下载安装和环境配置、连接运行
mongoDB入门教程一:下载安装和环境配置、连接运行
200 0
|
5月前
|
JSON NoSQL MongoDB
MongoDB Compass的安装及使用图文说明(非常详细)
MongoDB Compass的安装及使用图文说明(非常详细)
509 2
|
5月前
|
存储 NoSQL Linux
Linux下安装MongoDB
Linux下安装MongoDB
95 0
|
4月前
|
NoSQL MongoDB 数据安全/隐私保护
|
1月前
|
NoSQL MongoDB Docker
docker安装MongoDB
docker安装MongoDB
21 0
|
2月前
|
NoSQL 关系型数据库 MySQL
Windows、Linux、Mac安装数据库(mysql、MongoDB、Redis)#0
不同系统下进行MySQL安装、MongoDB安装、Redis安装【2月更文挑战第5天】
441 5
Windows、Linux、Mac安装数据库(mysql、MongoDB、Redis)#0
|
3月前
|
存储 JSON NoSQL
【MongoDB】<文档型数据库>Windows&Liunx安装MongoDB(无错完整)
【1月更文挑战第26天】【MongoDB】<文档型数据库>Windows&Liunx安装MongoDB(无错完整)
|
3月前
|
存储 NoSQL MongoDB
学习如何使用 Python 连接 MongoDB: PyMongo 安装和基础操作教程
Python 需要一个 MongoDB 驱动程序来访问 MongoDB 数据库。我将使用 MongoDB 驱动程序 PyMongo 建议您使用 PIP 来安装 PyMongo。PIP 很可能已经安装在您的 Python 环境中。将命令行导航到 PIP 的位置,然后键入以下内容:
93 1