MongoDb学习-2.Cemtos安装MongoDb

http://mayanze.com/(这里有我写的粗浅网站,欢迎留言)

 

参考官方按照文档:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

1.Configure the package management system (yum).

Create a /etc/yum.repos.d/mongodb-org-4.4.repo file so that you can install MongoDB directly using yum:

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

 

翻译:创建 /etc/yum.repos.d/mongodb-org-4.4.repo 文件

然后把下面代码复制进去,如截图

 

2.Install the MongoDB packages.

To install the latest stable version of MongoDB, issue the following command:

sudo yum install -y mongodb-org

翻译:就是执行 sudo yum install -y mongodb-org 这个命令会安装最新的稳定版本

 

By default, MongoDB runs using the mongod user account and uses the following default directories:

  • /var/lib/mongo (the data directory)
  • /var/log/mongodb (the log directory)

默认数据目录和日志目录就是这两个;

配置文件在:

/etc/mongod.conf

 

 启动

  sudo systemctl start mongod

查看状态

sudo systemctl status mongod

停掉

sudo systemctl stop mongod

重启

sudo systemctl restart mongod 

配置远程连接, vi /etc/mongod.conf

注意看默认配置后面一段注释:

# Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

翻译:输入 0.0.0.0,:: 绑定到所有IPv4和IPv6地址,或者使用net.bindIpAll设置。

然后重新启动

systemctl restart mongod

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值