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

Install mongodb on yum under Centos7

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Brief introduction

MongoDB is a NoSQL database based on distributed file storage.

Written by C++ language, stable operation and high performance

Designed to provide scalable, high-performance data storage solutions for WEB applications

Check out the official website

Characteristics of MongoDB

Schema freedom: documents with different structures can be stored in the same database

Collection-oriented storage: suitable for storing JSON-style files

Full index support: indexable on any attribute

Replication and high availability: support data replication between servers, support master-slave mode and mutual replication between servers. The main purpose of replication is to provide redundancy and automatic failover

Automatic sharding: supports cloud-level scalability: automatic sharding supports horizontal database clusters and can dynamically add additional machines

Rich queries: support rich query expressions. Query instructions use tags in the form of JSON, and you can easily query embedded objects and arrays in documents.

Quick in-place update: the query optimizer parses the query expression and generates an efficient query plan

Efficient traditional storage: supports binary data and large objects (such as photos or pictures)

Packages package description

The MongoDB official source contains the following dependency packages:

Mongodb-org: MongoDB meta-package, which automatically installs the following four component packages during installation:

1.mongodb-org-server: contains the MongoDB daemon and related configuration and initialization scripts.

2.mongodb-org-mongos: a daemon that contains mongos.

3.mongodb-org-shell: contains mongo shell.

4.mongodb-org-tools: tools containing MongoDB: mongoimport, bsondump, mongodump, mongoexport, mongofiles, mongooplog, mongoperf, mongorestore, mongostat, and mongotop.

Installation steps

1. Configure the yum source for MongoDB

Copy the code

Vim / etc/yum.repos.d/mongodb-org-3.4.repo

# add the following:

[mongodb-org-3.4]

Name=MongoDB Repository

Baseurl= https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/

Gpgcheck=1

Enabled=1

Gpgkey= https://www.mongodb.org/static/pgp/server-3.4.asc

# you can modify gpgcheck=0 here to omit gpg verification

[root@localhost ~] # yum makecache

Copy the code

two。 Install MongoDB

Installation commands:

Yum-y install mongodb-org

After installation is complete

Copy the code

Installed:

Mongodb-org.x86_64 0RO 3.4.14-1.el7

Installed as a dependency:

Mongodb-org-mongos.x86_64 0VOR 3.4.14-1.el7 mongodb-org-server.x86_64 0RU 3.4.14-1.el7

Mongodb-org-shell.x86_64 0VOR 3.4.14-1.el7 mongodb-org-tools.x86_64 0RU 3.4.14-1.el7

Over!

[root@adminset yum.repos.d] #

Copy the code

View the mongo installation location:

Whereis mongod

View the modified configuration file:

Vim / etc/mongod.conf

3. Start MongoDB

Start mongodb:

Systemctl start mongod.service

Stop mongodb:

Systemctl stop mongod.service

Check the status of mongodb:

Systemctl status mongod.service

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

Turn off firewall:

Systemctl stop firewalld.service # stop firewall

Systemctl disable firewalld.service # prevents firewall from booting

5. Start Mongo shell

Command:

Mongo

View the database:

Show dbs

6. Set up mongodb remote access:

Edit the mongod.conf comment bindIp and restart mongodb. (this configuration represents that it can only be used locally, so it needs to be noted)

Vim / etc/mongod.conf

Restart mongodb to make the changes take effect:

Systemctl restart mongod.service

You can use mongodb normally at this point.

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

Servers

Wechat

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

12
Report