[Mongodb] mongdob-enterprise-4.0安装


本文总阅读量

1、Yum方式安装

1.1配置yum源
cat /etc/yum.repos.d/mongodb-enterprise.repo

1
2
3
4
5
6
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/4.0/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

1.2执行安装命令

1
sudo yum install -y mongodb-enterprise

如果想要指定安装某一个版本的mongodb,需要指定每一个组件的安装版本,如下所示:

1
sudo yum install -y mongodb-enterprise-4.0.0 mongodb-enterprise-server-4.0.0 mongodb-enterprise-shell-4.0.0 mongodb-enterprise-mongos-4.0.0 mongodb-enterprise-tools-4.0.0

1.3mongodb启动、关闭命令:

1
2
3
sudo service mongod start
sudo service mongod stop
sudo service mongod restart

1.4通过yum方式安装完之后,配置文件所在为/etc/mongod.conf

2、tar包方式安装

2.1安装之前需要,安装依赖包:
linux-6:

1
yum install -y cyrus-sasl cyrus-sasl-plain cyrus-sasl-gssapi krb5-libs libcurl libpcap net-snmp openldap openssl

linux-7

1
yum install -y cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs libcurl libpcap lm_sensors-libs net-snmp net-snmp-agent-libs openldap openssl rpm-libs tcp_wrappers-libs

2.2下载mongodb-enterprise软件包

1
wget https://downloads.mongodb.com/linux/mongodb-linux-x86_64-enterprise-rhel70-4.0.0.tgz

2.3解压软件包,修改目录名称,配置环境变量

1
2
3
4
 tar -zxvf mongodb-linux-x86_64-enterprise-rhel70-4.0.0.tgz -C /data/
mv /data/mongodb-linux-x86_64-enterprise-rhel70-4.0.0 /data/mongodb
echo "export PATH=/data/mongodb/bin:\$PATH" >> ~/.bash_profile
source ~/.bash_profile

2.4修改配置文件
cat /data/mongodb/mongodb.conf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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: /data/mongodb/log/mongod.log

# Where and how to store data.
storage:
dbPath: /data/mongodb/data/
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:

# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /data/mongodb/log/mongod.pid # location of pidfile
timeZoneInfo: /usr/share/zoneinfo

# network interfaces
net:
port: 30000
bindIp: 127.0.0.1,10.0.7.51 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:

2.5修改的配置文件中,如果数据目录,日志目录不存在会报错,需要手动配置:

1
mkdir -p /data/mongodb/{log,data}

2.6启动mongodb

1
2
3
4
5
6
shell>/data/mongodb/bin/mongod -f /data/mongodb/mongodb.conf
--------
2018-08-03T08:42:19.873+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
about to fork child process, waiting until server is ready for connections.
forked process: 41022
child process started successfully, parent exiting

2.7查看mongodb进程:

1
2
3
4
 netstat -tunlp|grep 30000
---------
tcp 0 0 10.0.7.51:30000 0.0.0.0:* LISTEN 41022/mongod
tcp 0 0 127.0.0.1:30000 0.0.0.0:* LISTEN 41022/mongod
目录
  1. 1. 1、Yum方式安装
  2. 2. 2、tar包方式安装

Proudly powered by Hexo and Theme by Lap
本站访客数人次
© 2020 zeven0707's blog