MongoDB3.2.7安装及用户角色配置

记录一下,MongoDB的角色创建及配置,以便以后使用

 

1、MongDB安装步骤

1.1、  下载安装包

环境信息:

Linux:CentOS release 6.5 (Final)

MongoDB:3.2.7

MongoDB下载地址:

http://downloads.10gen.com/linux/mongodb-linux-x86_64-enterprise-rhel62-3.2.7.tgz

 

 

1.2、解压

tar -zxvf mongodb-linux-x86_64-enterprise-rhel62-3.2.7.tgz

1.3、指定安装目录

mv mongodb-linux-x86_64-enterprise-rhel62-3.2.7 /home/dd/mongodb/

1.4、新建目录

新建MongoDB数据文件存放目录

mkdir -p /home/dd/mongodb/db

新建log文件存放目录

mkdir -p /home/dd/mongodb/logs

1.5、新建配置文件

MongoDB支持把参数写进配置文件,mongod.conf配置文件内容如下

# mongod.conf
# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /home/dd/mongodb/logs/mongod.log #日志文件存放目录

# Where and how to store data.
storage:
  dbPath: /home/dd/mongodb/db #数据文件存放目录
  journal:
    enabled: true
#  engine:
#  mmapv1:
#  wiredTiger:

# how the process runs
processManagement:
  fork: true  #以守护程序的方式启用,即在后台运行
  pidFilePath: /home/dd/mongodb/mongod.pid  # location of pidfile

# network interfaces
net:
  port: 27017 #端口
  bindIp: 0.0.0.0  # Listen to local interface only, comment to listen on all interfaces.

#security:
  #authorization: enabled 
#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

1.6、配置开机启动

vi /etc/rc.d/rc.local  

/home/dd/mongodb/mongodb-linux-x86_64-enterprise-rhel62-3.2.7/bin/mongod --config /home/dd/mongodb/mongodb-linux-x86_64-enterprise-rhel62-3.2.7/bin/mongod.conf

1.7、测试连接

1、通过xshell连接对应linux服务器,到MongoDB安装的bin目录运行./mongo命令

2、telnet ip 27017

 

 

posted @ 2017-05-04 22:44  点哥儿  阅读(845)  评论(0编辑  收藏  举报