Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How Cenos7 yum installs mongodb and what is the solution to startup errors

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Cenos7 yum how to install mongodb and what is the solution to startup errors, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

The first step is to see if there is a Mongodb configuration yum source

Change to the yum directory cd / etc/yum.repos.d/

View the file ls

There is no add yum source in part II.

Create a file touch mongodb-3.4.repo

Edit the file vi mongodb-3.4.repo

Content:

[mongodb-org-3.4] name=MongoDB Repositorybaseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/gpgcheck=1enabled=1gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc

Gpgcheck=0 can be modified here to omit gpg verification

Then install: yum install-y mongodb-org

View mongo installation location whereis mongod

View the modified configuration file: vi / etc/mongod.conf

Start mongod: systemctl start mongod.service

Stop mongod: systemctl stop mongod,service

To access the public network, you need to disable the firewall:

CentOS 7.0 uses firewall as the firewall by default, which is changed to iptables firewall here.

Turn off firewall:

Systemctl stop firewalld.service # stop firewall

Systemctl disable firewalld.service # prevents firewall from booting

Use mongodb: mongo localhost:27017

> use admin

> show dbs

> show collections

After restarting Mongodb, log in to the admin account and create a super privileged user

Use admin

Db.createUser ({user:'root',pwd:'root',roles: [{"role": "root", "db": "admin"}]})

Solution to startup errors: (for MongoDB installed with yum only) chown-R mongod:mongod / var/lib/mongochown-R mongod:mongod / var/log/mongodbrm / var/run/mongodb/mongod.pid-f

The following error occurred when starting mongodb:

Chown root:root / tmp

Chmod 777 / tmp

Error: pymongo.errors.ServerSelectionTimeoutError: 123.207.61.85 pymongo.errors.ServerSelectionTimeoutError 27017: [WinError 10061] unable to connect due to active refusal of the target computer.

Resolve:

Modify configuration vim / etc/mongodb.conf

After reading the above, have you mastered how Cenos7 yum installs mongodb and what is the solution to startup errors? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report