Home > Topics > Pagoda Panel > body text

Detailed graphic explanation of how to configure mongodb in Pagoda

藏色散人
Release: 2022-10-26 17:27:11
forward
3738 people have browsed it

This article is provided by the tutorial column of Pagoda Panel to introduce to you how to configure mongodb in Pagoda. I hope it will be helpful to you if you need it!

Detailed graphic explanation of how to configure mongodb in Pagoda

1. Install mongodb in the pagoda software store

2. Modify the mongodb configuration

bindIp from 127.0.0.1 to 0.0 .0.0, release IP restrictions\

authorization default is disabled, if permission verification is required, change it to enabled (note to keep the space after the colon)

Detailed graphic explanation of how to configure mongodb in Pagoda

3. Pagoda releases port 27017

4. Alibaba Cloud Server, Network and Security-Security Group-Configure Rules, releases port 27017

5. Configure username and password

pass Pagoda terminal link mongodb

cd /www/server/mongodb/bin
mongo
Copy after login

Switch to the admin database, set the administrator account password

use admin 
db.createUser({user:'root',pwd:'123456',roles:['root']})
Copy after login

Verify whether the addition is successful, db.auth (user name, user password)

db.auth('root', '123456')
Copy after login

Create a role for a certain database

use mydata 
db.createUser({user:'username',pwd:'123456',roles:['readWrite']})
Copy after login

Verification

db.auth('username', '123456')
Copy after login

6. Modify the background project connection database configuration

Detailed graphic explanation of how to configure mongodb in Pagoda

7. Upload the backend Project

Enter the www/wwwroot directory, create a new relevant folder, and upload it to the directory

Detailed graphic explanation of how to configure mongodb in Pagoda

8. Install PM2 management in the Pagoda software store Explorer, start project

Add project, select the startup file path of your background project in the startup file. Other items will be filled in automatically

Detailed graphic explanation of how to configure mongodb in Pagoda

9. Verify the interface

Go to postman to verify whether the interface request can be successful.

If the request fails, try restarting pm2 and check the project running log to see if there are any errors.

If you encounter mongoDB startup failure

//方案一:
mongod -f /www/server/mongodb/config.conf\
或者修改MongoDB的启动文件\

/etc/init.d/mongodb
Copy after login

Detailed graphic explanation of how to configure mongodb in Pagoda

//方案二:
改了配置文件,用更高的权限运行这条命令启动服务:
sudo mongod -f /www/server/mongodb/config.conf      
把-f后面的路径改成你配置文件的路径即可
Copy after login
//方案三:
cd /www/server/mongodb/bin
输入命令:`mongod`
Copy after login

The above is the detailed content of Detailed graphic explanation of how to configure mongodb in Pagoda. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template