windows 访问linux中的mongodb,MongoDB的linux系统下的安装与连接
一 安裝MongoDB的服務(wù)
下載Linux系統(tǒng)下的MongoDB安裝包
上傳壓縮包到linux服務(wù)器中,解壓到對應(yīng)的安裝目錄下
mkdir /usr/local/mongodb
tar -zxvf mongodb-linux-x86_64-4.0.10.tgz
mv mongodb-linux-x86_64-4.0.10 /usr/local/mongodb
新建目錄,分別用來存儲數(shù)據(jù)和日志
# 注意:此處是在根目錄下創(chuàng)建mongodb目錄,而不是在mongodb的安裝目錄下創(chuàng)建
#數(shù)據(jù)存儲目錄
mkdir -p /mongodb/single/data/db
#日志存儲目錄
mkdir -p /mongodb/single/log
新建并修改配置文件
vim /mongodb/single/mongod.conf
systemLog:
#MongoDB發(fā)送所有日志輸出的目標指定為文件
destination: file
#mongod或mongos應(yīng)向其發(fā)送所有診斷日志記錄信息的日志文件的路徑
path: "/mongodb/single/log/mongod.log"
#當mongos或mongod實例重新啟動時,mongos或mongod會將新條目附加到現(xiàn)有日志文件的末尾。
logAppend: true
storage:
#mongod實例存儲其數(shù)據(jù)的目錄。storage.dbPath設(shè)置僅適用于mongod。
dbPath: "/mongodb/single/data/db"
journal:
#啟用或禁用持久性日志以確保數(shù)據(jù)文件保持有效和可恢復。
enabled: true
processManagement:
#啟用在后臺運行mongos或mongod進程的守護進程模式。
fork: true
net:
#服務(wù)實例綁定的IP,默認是localhost
bindIp: localhost,192.168.44.142
#bindIp
#綁定的端口,默認是27017
port: 27017
啟動mongodb服務(wù)
/usr/local/mongodb/bin/mongod -f /mongodb/single/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 3730
child process started successfully, parent exiting
通過進程查看mongodb服務(wù)的啟動情況
ps -ef | grep mongod
關(guān)閉服務(wù),直接殺死進程
kill -2 進程號
二 連接mongodb
使用shell的方式連接
/usr/local/mongodb/bin/mongo --host=192.168.44.142 --port=27017
使用compass工具連接
關(guān)閉防火墻
# 關(guān)閉系統(tǒng)的防火墻
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
啟動windows系統(tǒng)下的compass工具
image-20210110163756070.png
image-20210110163807277.png
總結(jié)
以上是生活随笔為你收集整理的windows 访问linux中的mongodb,MongoDB的linux系统下的安装与连接的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python counter模块_pyt
- 下一篇: linux 其他常用命令