linux服务之mongodb
发表于:2024-09-21 作者:千家信息网编辑
千家信息网最后更新 2024年09月21日,系统环境:[root@mongodb ~]# cat /etc/redhat-releaseCentOS release 6.5 (Final)[root@mongodb ~]# uname -aLi
千家信息网最后更新 2024年09月21日linux服务之mongodb
系统环境:
[root@mongodb ~]# cat /etc/redhat-releaseCentOS release 6.5 (Final)[root@mongodb ~]# uname -aLinux mongodb 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
开始安装
[root@mongodb ~]# yum -y install openssl openssl-devel[root@mongodb ~]# mkdir soft[root@mongodb ~]# mkdir -p /opt/mongodb/data/[root@mongodb ~]# mkdir -p /opt/mongodb/logs/[root@mongodb ~]# cd soft/[root@mongodb soft]# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz[root@mongodb soft]# cd /usr/local/[root@mongodb local]# mkdir mongodb[root@mongodb local]# cd mongodb/[root@mongodb mongodb]# mv /root/soft/mongodb-linux-x86_64-2.4.9.tgz .[root@mongodb mongodb]# lsmongodb-linux-x86_64-2.4.9.tgz[root@mongodb mongodb]# tar xf mongodb-linux-x86_64-2.4.9.tgz[root@mongodb mongodb]# mv mongodb-linux-x86_64-2.4.9/* .[root@mongodb mongodb]# rm mongodb-linux-x86_64-2.4.9.tgz mongodb-linux-x86_64-2.4.9/ -rf[root@mongodb mongodb]# lsbin GNU-AGPL-3.0 README THIRD-PARTY-NOTICES[root@mongodb mongodb]# vim /etc/mongodb.cnf mongodb配置文件#configuration Options for MongoDB## For More Information, Consider:# - Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters# - File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configurationdbpath = /opt/mongodb/data/logpath = /opt/mongodb/logs/mongodb.loglogappend = true#bind_ip = 127.0.0.1#port = 27017fork = true#auth = truenoauth = truedirectoryperdb = truejournal = truerest = false[root@mongodb mongodb]# /usr/local/mongodb/bin/mongod --config /etc/mongodb.cnf 启动mongodbwarning: remove or comment out this line by starting it with '#', skipping now : rest = falseabout to fork child process, waiting until server is ready for connections.forked process: 5970all output going to: /opt/mongodb/logs/mongodb.log[root@mongodb ~]# tail -f /opt/mongodb/logs/mongodb.log 查看mongodb启动日志Fri Apr 4 21:30:45.634 [websvr] admin web console waiting for connections on port 28017Fri Apr 4 21:30:45.635 [initandlisten] waiting for connections on port 27017 启动成功[root@mongodb ~]# netstat -tulnpan |grep mon 查询监听端口tcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 5970/mongod tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 5970/mongod [root@mongodb ~]# ps aux |grep mongodroot 5970 6.9 3.6 465848 37504 ? Sl 21:29 0:17 /usr/local/mongodb/bin/mongod --config /etc/mongodb.cnfroot 5974 0.1 0.0 100944 576 pts/1 S+ 21:29 0:00 tail -f /opt/mongodb/logs/mongodb.logroot 6007 0.0 0.0 103252 820 pts/2 S+ 21:33 0:00 grep mongod[root@mongodb ~]# kill -2 5970 停止服务
我们来把mongodb封装成一个启动脚本让
[root@mongodb ~]# vim /etc/init.d/mongodb#!/bin/bash# chkconfig: 2345 97 15# description: mongodb init script for Linux.. /etc/init.d/functionssource /etc/bashrcsource /etc/profilemongodb_HOME=/usr/local/mongodb/binexport mongodb_HOMEstart() {/usr/local/mongodb/bin/mongod --config /etc/mongodb.cnf >> /dev/nullecho "start"}stop() {echo "stop"kill -2 `ps -C mongod -f | grep mongod |tr -s ' ' | cut -d ' ' -f 2`sleep 5}case "$1" in start) start ;; stop) stop ;; restart) stop start ;; version) exec $mongodb_HOME/mongod --version ;; *) echo $"Usage: $0 {start|stop|restart|version}" exit 1esac[root@mongodb ~]# chmod +x /etc/init.d/mongodb[root@mongodb ~]# /etc/init.d/mongodb start[root@mongodb ~]# cd /usr/local/mongodb/bin/[root@mongodb bin]# ./mongoMongoDB shell version: 2.4.9connecting to: test>已经成功连进来了[root@mongodb ~]# /etc/init.d/mongodb versiondb version v2.4.9Fri Apr 4 21:35:44.926 git version: 52fe0d21959e32a5bdbecdc62057db386e4e029c[root@mongodb ~]# netstat -tulnpan |grep montcp 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 6024/mongod tcp 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 6024/mongod [root@mongodb ~]# /etc/init.d/mongodb stopstop[root@mongodb ~]# netstat -tulnpan |grep mon[root@mongodb ~]# chkconfig mongodb on
开机自己启动
成功
服务
文件
日志
环境
端口
系统
脚本
封装
查询
监听
配置
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
服务器管理员账号是ip
戴尔服务器t310
工作生活中网络安全培隐患
效益好的科技和互联网公司
获取数据库页数
徐州机电软件开发注意事项
wps在线文档建立数据库
网络安全火
sql把数据库删掉
我的世界服务器手机版推荐有难度
江苏购房指数网络技术
信息类软件开发商的营业原则
php开发游戏服务器
黄浦区机械网络技术应用范围
软件开发各方责任
玩原神一直重新连接服务器
画网络安全的画超简单
数据库查核
360网络安全等级考试
服务器oracle打不开
哈医大胃癌病人数据库
海南安脉云网络技术有限公司
大方网络安全工程师
电厂保障网络安全方案
网络安全不少于多少学时
施乐j75拆服务器硬盘
网络安全信息安全教授
麒麟软件开发者平台
客户端和游戏库可以分装服务器吗
软件开发专业技术水平自我评价