标签:shell server connect ble cti reboot nbsp usr system
安装、查看服务、服务是否随开机自动启动、查看端口、本地连接、远程连接。
安装
apt install mongodb
查看服务
ll /etc/init.d
-rwxr-xr-x 1 root root 7768 6月 30 2014 mongodb*
service mongodb status
● mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset:
Active: active (running) since 三 2018-08-01 12:43:19 CST; 1min 12s ago
Docs: man:mongod(1)
Main PID: 3017 (mongod)
CGroup: /system.slice/mongodb.service
└─3017 /usr/bin/mongod --config /etc/mongodb.conf
显然,安装后自动启动服务。
服务是否随开机自动启动
reboot
显然,mongodb服务随开机自动启动。
查看端口
netstat -anpl|grep mongo
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 994/mongod
本地连接
mongo
MongoDB shell version: 2.6.10
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
>
远程连接
1 修改配置文件。
vim /etc/mongodb.conf
把 bind_ip=127.0.0.1 这一行注释掉或者是修改成 bind_ip=0.0.0.0
2 重启服务(视情形是否必要)。
/etc/init.d/mongodb restart
3 防火墙开放端口(视情形是否必要)。
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 27017 -j ACCEPT
mongo client
mongod server
标签:shell server connect ble cti reboot nbsp usr system
原文地址:https://www.cnblogs.com/dailycode/p/9417476.html