q989 发表于 2018-10-27 08:35:07

linux服务之mongodb-devops

# yum -y install openssl openssl-devel  
# mkdir soft
  
# mkdir -p /opt/mongodb/data/
  
# mkdir -p /opt/mongodb/logs/
  
# cd soft/
  
# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz
  
# cd /usr/local/
  
# mkdir mongodb
  
# cd mongodb/
  
# mv /root/soft/mongodb-linux-x86_64-2.4.9.tgz .
  
# ls
  
mongodb-linux-x86_64-2.4.9.tgz
  
# tar xf mongodb-linux-x86_64-2.4.9.tgz
  
# mv mongodb-linux-x86_64-2.4.9/* .
  
# rm mongodb-linux-x86_64-2.4.9.tgz mongodb-linux-x86_64-2.4.9/ -rf
  
# ls
  
binGNU-AGPL-3.0READMETHIRD-PARTY-NOTICES
  
# 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+Configuration
  
dbpath = /opt/mongodb/data/
  
logpath = /opt/mongodb/logs/mongodb.log
  
logappend = true
  
#bind_ip = 127.0.0.1
  
#port = 27017
  
fork = true
  
#auth = true
  
noauth = true
  
directoryperdb = true
  
journal = true
  
rest = false
  
# /usr/local/mongodb/bin/mongod --config /etc/mongodb.cnf            启动mongodb
  
warning: remove or comment out this line by starting it with '#', skipping now : rest = false
  
about to fork child process, waiting until server is ready for connections.
  
forked process: 5970
  
all output going to: /opt/mongodb/logs/mongodb.log
  
# tail -f /opt/mongodb/logs/mongodb.log查看mongodb启动日志
  
Fri Apr4 21:30:45.634 admin web console waiting for connections on port 28017
  
Fri Apr4 21:30:45.635 waiting for connections on port 27017            启动成功
  
# 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
  
# ps aux |grep mongod
  
root      59706.93.6 465848 37504 ?      Sl   21:29   0:17 /usr/local/mongodb/bin/mongod --config /etc/mongodb.cnf
  
root      59740.10.0 100944   576 pts/1    S+   21:29   0:00 tail -f /opt/mongodb/logs/mongodb.log
  
root      60070.00.0 103252   820 pts/2    S+   21:33   0:00 grep mongod
  
# kill -2 5970                                                          停止服务


页: [1]
查看完整版本: linux服务之mongodb-devops