ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
下面是在CentOS7安装。 <br/> **1. 配置 yum 源** ```shell [hadoop@hadoop101 ~]# vim /etc/yum.repos.d/mongodb.repo 添加如下内容 [MongoDB] name=MongoDB Repository baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-o rg/4.0/x86_64/ gpgcheck=0 enabled=1 ``` <br/> **2.下载** ```shell [hadoop@hadoop101 ~]# yum -y install mongodb-org ``` <br/> **3.启动** ```shell [hadoop@hadoop101 ~]# systemctl start mongod.service ``` <br/> **4.配置开启启动** ```shell [hadoop@hadoop101 ~]# chkconfig mongod on ``` <br/> **5.验证查看启动状态和版本信息** ```shell [hadoop@hadoop101 ~]# systemctl status mongod.service ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2021-03-15 17:10:57 CST; 20s ago Docs: https://docs.mongodb.org/manual Main PID: 2916 (mongod) CGroup: /system.slice/mongod.service └─2916 /usr/bin/mongod -f /etc/mongod.conf [hadoop@hadoop101 ~]# mongod --version db version v4.0.23 git version: 07c6611b38d2aacbdb1846b688db70b3273170fb OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013 allocator: tcmalloc modules: none build environment: distmod: rhel70 distarch: x86_64 target_arch: x86_64 ``` <br/> **6.Mongodb 工具安装** 可以使用 mongodbmanager 可视化工具进行操作 MongoDB,需要修改 MonogDB的配置文件: ```shell [root@hadoop101 ~]# vim /etc/mongod.conf # network interfaces # 将bindIp由127.0.0.1改成0.0.0.0允许任意机器的访问 net: port: 27017 bindIp: 0.0.0.0 ``` 之后就可以使用该工具进行连接。