mogo
- 下载
1
2
3
4
5wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.6.tgz ./
tar xzvf mongodb-linux-x86_64-rhel70-4.0.6.tgz
mkdir -p data/mongo_data data/logs
配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14touch mongo.conf
#数据目录
dbpath=/home/admin/soft/mongodb/data/mongo_data
logpath=/home/admin/soft/mongodb/data/logs/mongo.log
#后台允许
fork=true
quiet=true
journal=true
logappend=true
#可以外网访问
bind_ip=0.0.0.0
#修改端口
port=27018启动:
1
/bin/mongod -f mongo.conf
创建管理员
1
2
3
4
5
6
7
8
9mongo localhost:27018
>use admin
db.createUser(
{
user: "root",
pwd: "root123",
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
}
)exit
开启权限
vi /etc/mongod.conf1
2
3#security
security:
authorization: enabled
重启mongodb:
1
2pkill mongod
/bin/mongod -f mongo.conf安装GUI
1
2
3
4
5
6
7
8
9#先安装node
brew install node
git clone https://github.com/mrvautin/adminMongo
cd adminMongo
npm install
npm start
#测试地址:http://127.0.0.1:1234后台进程
1
2
3
4#指定name启动
pm2 start app.js --name adminMongo
#删除
pm2 delete adminMongoGUI连接
打开http://127.0.0.1:1234
地址:mongodb://root:root123@192.168.1.41:27018/admin
pm2
1 | npm install pm2 -g |
安装service
1
2yum list | grep initscripts
yum install initscripts -ydocker不能启动问题
Failed to get D-Bus connection: Operation not permitted
解决:1
docker run -d -it --privileged ContainerId /usr/sbin/init