centos6.x yum安装最新mongodb数据库服务。
来源:互联网 发布:p2psearcher同类软件 编辑:程序博客网 时间:2024/06/05 22:19
安装:
1、配置源
vim /etc/yum.repos.d/mongodb-enterprise.repo
输入以下内容
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/3.4/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
2、安装命令
sudo yum install -y mongodb-enterprise
3、开启、关闭、状态命令:service mongod start/stop/status
4、服务自启:sudo chkconfig mongod on
5、修改配置文件 /etc/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
logRotate: rename
path: /home/var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /home/var/lib/mongo
directoryPerDB: true
journal:
enabled: true
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 16
journalCompressor: zlib
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /home/var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
#bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
maxIncomingConnections: 51200
#security:
# keyFile: /srv/mongodb/keyfile
# authorization: enabled
#operationProfiling:
#replication:
#replication:
# oplogSizeMB: 10000
# replSetName: prophet
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
------------------------------------------------------------------------------------
6、权限管理:
创建管理用户
mongo
show dbs;
use admin
db.createUser({user:"admin", pwd:"admin123098", roles: [{role: "root", db:"admin"}]})
user:用户名 pwd:密码 roles:指定角色
Built-In Roles(内置角色):
1. 数据库用户角色:read、readWrite;
2. 数据库管理角色:dbAdmin、dbOwner、userAdmin;
3. 集群管理角色:clusterAdmin、clusterManager、clusterMonitor、hostManager;
4. 备份恢复角色:backup、restore;
5. 所有数据库角色:readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6. 超级用户角色:root
// 这里还有几个角色间接或直接提供了系统超级用户的访问(dbOwner 、userAdmin、userAdminAnyDatabase)
7. 内部角色:__system
Read:允许用户读取指定数据库
readWrite:允许用户读写指定数据库
dbAdmin:允许用户在指定数据库中执行管理函数,如索引创建、删除,查看统计或访问system.profile
userAdmin:允许用户向system.users集合写入,可以找指定数据库里创建、删除和管理用户
clusterAdmin:只在admin数据库中可用,赋予用户所有分片和复制集相关函数的管理权限。
readAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读权限
readWriteAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读写权限
userAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的userAdmin权限
dbAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的dbAdmin权限。
root:只在admin数据库中可用。超级账号,超级权限
再创建一个可读写的用户(程序中使用)。
7、将配置文件
#security:
# authorization: enabled
取消注释即可开启用户认证
1、配置源
vim /etc/yum.repos.d/mongodb-enterprise.repo
输入以下内容
[mongodb-enterprise]
name=MongoDB Enterprise Repository
baseurl=https://repo.mongodb.com/yum/redhat/$releasever/mongodb-enterprise/3.4/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
2、安装命令
sudo yum install -y mongodb-enterprise
3、开启、关闭、状态命令:service mongod start/stop/status
4、服务自启:sudo chkconfig mongod on
5、修改配置文件 /etc/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
logRotate: rename
path: /home/var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /home/var/lib/mongo
directoryPerDB: true
journal:
enabled: true
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 16
journalCompressor: zlib
collectionConfig:
blockCompressor: zlib
indexConfig:
prefixCompression: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /home/var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
#bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
maxIncomingConnections: 51200
#security:
# keyFile: /srv/mongodb/keyfile
# authorization: enabled
#operationProfiling:
#replication:
#replication:
# oplogSizeMB: 10000
# replSetName: prophet
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
------------------------------------------------------------------------------------
6、权限管理:
创建管理用户
mongo
show dbs;
use admin
db.createUser({user:"admin", pwd:"admin123098", roles: [{role: "root", db:"admin"}]})
user:用户名 pwd:密码 roles:指定角色
Built-In Roles(内置角色):
1. 数据库用户角色:read、readWrite;
2. 数据库管理角色:dbAdmin、dbOwner、userAdmin;
3. 集群管理角色:clusterAdmin、clusterManager、clusterMonitor、hostManager;
4. 备份恢复角色:backup、restore;
5. 所有数据库角色:readAnyDatabase、readWriteAnyDatabase、userAdminAnyDatabase、dbAdminAnyDatabase
6. 超级用户角色:root
// 这里还有几个角色间接或直接提供了系统超级用户的访问(dbOwner 、userAdmin、userAdminAnyDatabase)
7. 内部角色:__system
Read:允许用户读取指定数据库
readWrite:允许用户读写指定数据库
dbAdmin:允许用户在指定数据库中执行管理函数,如索引创建、删除,查看统计或访问system.profile
userAdmin:允许用户向system.users集合写入,可以找指定数据库里创建、删除和管理用户
clusterAdmin:只在admin数据库中可用,赋予用户所有分片和复制集相关函数的管理权限。
readAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读权限
readWriteAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的读写权限
userAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的userAdmin权限
dbAdminAnyDatabase:只在admin数据库中可用,赋予用户所有数据库的dbAdmin权限。
root:只在admin数据库中可用。超级账号,超级权限
再创建一个可读写的用户(程序中使用)。
7、将配置文件
#security:
# authorization: enabled
取消注释即可开启用户认证
0 0
- centos6.x yum安装最新mongodb数据库服务。
- CentOS6.X/RedHat6.X yum安装jenkins
- yum安装最新版本的mongodb
- centos6.x下yum安装mysql
- centos6.x中yum安装nginx
- centos6.x yum安装 apache, php, mysql
- centos yum MongoDb数据库安装
- centos6 ,7 使用yum 安装最新nginx版本
- centos6 ,7 使用yum 安装最新nginx版本
- centos6.x直接yum安装nginx1.10.x
- ubuntu12.4 安装最新mongodb数据库
- CentOS6.x下yum安装MySQL5.5/5.6
- centos6.X在线离线安装最新mysql5.7(RPM)
- centos6 yum 安装memcached
- centos6 yum 安装memcached
- centos6 yum 安装memcached
- centos6 yum 安装memcached
- centos6.5 yum安装
- 行内标签的实现
- 大端小端格式详解
- Google webp
- JavaScript闭包理解
- python matplotlib 图表组织
- centos6.x yum安装最新mongodb数据库服务。
- 笑cry!在镜子面前,沉稳暖心的金毛同学也会瞬间化身逗比!
- Java 中Timer和TimerTask 定时器使用
- 使用display:table-cell元素部分出现空白缝隙的结解决
- Mybatis- foreach用法
- 重装系统后的配置问题
- 摘要算法
- Android 界面类 Activity 和 Fragment 互相传递返回值解析
- Android Studio的Gradle添加重复依赖的问题