JAVA全系列 教程
3762个小节阅读:7088.1k
目录
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
进入/etc/yum.repos.d目录,创建文件mongodb-org-5.0.repo
xxxxxxxxxx
[root@192 yum.repos.d]# pwd
/etc/yum.repos.d
[root@192 yum.repos.d]#
在文件内输入yum源地址
xxxxxxxxxx
[mongodb-org]
name=MongoDB Repository
baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/5.0/x86_64/
gpgcheck=0
enabled=1
安装之前先更新
xxxxxxxxxx
yum update
开始安装
xxxxxxxxxx
yum -y install mongodb-org
安装完成后,查看mongo的安装位置
xxxxxxxxxx
whereis mongod
修改配置文件
xxxxxxxxxx
vim /etc/mongod.conf
xxxxxxxxxx
bindIp: 172.0.0.1 改为 bindIp: 0.0.0.0
启动
xxxxxxxxxx
systemctl start mongod.service
停止
xxxxxxxxxx
systemctl stop mongod.service
重启
xxxxxxxxxx
systemctl restart mongod.service
查看
xxxxxxxxxx
systemctl status mongod.service
设置开机自启动
xxxxxxxxxx
systemctl enable mongod.service
mongo shell 的启动
xxxxxxxxxx
./bin/mongo
指定主机和端口的方式启动
xxxxxxxxxx
./bin/mongo --host=主机IP --port=端口
访问hub.docker.com,搜索mongo镜像
查看可用的镜像
获取你想要拉取的镜像
xxxxxxxxxx
docker pull mongo:xxx
查看已下载的镜像
xxxxxxxxxx
docker images
创建挂载目录
xxxxxxxxxx
mkdir -p /mnt/mongodb/data --创建保存数据目录
创建并运行 mongo 容器
xxxxxxxxxx
docker run -itd --privileged=true --name mongo5 -p 27017:27017 -v /mnt/mongodb/data:/data/db mongo:5.0.9-focal
使用NosqlBooster For MongoDB客户端工具连接MongoDB数据库
实时效果反馈
1.MongoDB默认端口是?
A 6379
B 27017
C 8761
D 15672
答案
1=>B