当前位置:网站首页>环境搭建-MongoDB
环境搭建-MongoDB
2022-07-26 16:40:00 【wangmcn】
环境搭建-MongoDB
目录
- 1、简介
- 2、安装
- 3、启动与停止
本篇主要讲解在 CentOS 环境下安装 MongoDB。
1、简介
MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 Web 应用提供可扩展的高性能数据存储解决方案。
MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。它支持的数据结构非常松散,是类似 json 的 bson 格式,因此可以存储比较复杂的数据类型。最大的特点是它支持的查询语言非常强大,其语法有点类似于面向对象的查询语言,几乎可以实现类似关系数据库单表查询的绝大部分功能,而且还支持对数据建立索引。
官网地址:
https://www.mongodb.com/
2、安装
1、安装依赖包
sudo yum install libcurl openssl2、下载
官网下载地址(社区版):
https://www.mongodb.com/try/download/community
选择相应的版本、平台、包,进行下载或者拷贝下载链接进行下载。
例如:下载mongodb-linux-x86_64-rhel70-5.0.5.tgz
并将已下载的文件上传到服务器上
或者直接输入命令,在服务器上进行下载
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-5.0.5.tgz3、解压
tar -zxvf mongodb-linux-x86_64-rhel70-5.0.5.tgz解压后生成mongodb-linux-x86_64-rhel70-5.0.5目录
4、将解压包移动到指定目录下(/usr/local/),并命名为mongodb5
mv mongodb-linux-x86_64-rhel70-5.0.5 /usr/local/mongodb55、设置环境变量
(1)修改配置文件
vim /etc/profile(2)最后一行填写(mongodb文件路径以实际为准)
export PATH=$PATH:/usr/local/mongodb5/bin(3)使配置生效
source /etc/profile3、启动与停止
1、创建数据存储目录(/var/lib/mongodb),并授权
sudo mkdir -p /var/lib/mongodb
sudo chown 755 /var/lib/mongodb2、创建日志文件目录(/var/log/mongodb),并授权
sudo mkdir -p /var/log/mongodb
sudo chown 755 /var/log/mongodb3、启动服务
mongod --dbpath /var/lib/mongodb --logpath/var/log/mongodb/mongod.log --fork4、停止服务
方式一:
mongod --dbpath /var/lib/mongodb --logpath/var/log/mongodb/mongod.log --shutdown方式二:
输入mongo,进入mongo命令下
依次输入以下命令即可
use admin
db.shutdownServer()
exit边栏推荐
- Pyqt5 rapid development and practice 3.2 introduction to layout management and 3.3 practical application of QT Designer
- Chapter 1 Overview - Section 1 - 1.3 composition of the Internet
- The Ministry of Public Security issued a traffic safety warning for summer tourism passenger transport: hold the steering wheel and tighten the safety string
- Quickly build a development platform for enterprise applications
- 【Express接收Get、Post、路由请求参数】
- Is it safe for Guosen Securities to open an account? How can I find the account manager
- FIR filter design
- My meeting of OA project (meeting seating & submission for approval)
- Are CRM and ERP the same thing? What's the difference?
- 【开发教程8】疯壳·开源蓝牙心率防水运动手环-三轴计步伐
猜你喜欢

Method and voltage setting of exciting vibrating wire sensor with hand-held vibrating wire collector
![[C language classic topic exercise 2]](/img/66/8dbfefe585aa35f5791f04b376b75c.png)
[C language classic topic exercise 2]

Small application of C language using structure to simulate election

Operating system migration practice: deploying MySQL database on openeuler

About the adjustment of the game background, reading this article is enough

Avalanche subnets vs. polygon supernets of application chain

Packet capturing and streaming software and network diagnosis

Alibaba cloud Toolkit - project one click deployment tool

Detailed explanation of tcpdump command

限流对比:Sentinel vs Hystrix 到底怎么选?
随机推荐
Win11系统如何一键进行重装?
Win11自动删除文件设置方法
MySQL foundation - basic database operation
Batch normalization batch_ normalization
40个高质量信息管理专业毕设项目分享【源码+论文】(六)
2022-2023 信息管理毕业设计选题题目推荐
PXE efficient batch network installation
正则表达式
OA项目之我的会议(会议排座&送审)
第一章概述-------第一节--1.3互联网的组成
About the adjustment of the game background, reading this article is enough
Matlab论文插图绘制模板第40期—带偏移扇区的饼图
【无标题】
How to use C language nested linked list to realize student achievement management system
[ctfshow web] deserialization
Marxan model, reserve optimization and protection vacancy selection technology, application in invest ecosystem
VIM visualization mode and its usage
How to connect tdengine with idea database tool?
Sharing of 40 completed projects of high-quality information management specialty [source code + Thesis] (VI)
Quickly learn to configure local and network sources of yum, and learn to use yum