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 under Centos7

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MongoDB, written by C++ language, is a database based on distributed file storage, which aims to provide scalable and high-performance data storage solutions for web applications. It is a product between relational database and non-relational database, which is the most functional and most like relational database in non-relational database. It supports a very loose data structure, which is a json-like bjson (the key is a string type and is used to uniquely represent a document; values can be various complex file types. This form of storage, called bjson) format, can store more complex data types.

Its biggest features are set-oriented storage (data is stored in groups in datasets, called collections, each collection has a unique identification name and can contain an unlimited number of documents), and the schema is free (for files stored in mongodb, you do not need to know its structure definition)

Comparison between Relational Database and Mongodb

The traditional relational database is generally composed of database (Database), table (Table) and record (Record), while Mongodb is composed of database (Database), collection (Collection) and document object (Document).

First, install Mongodb

1. Download Mongodb

Cd / usr/local/src

Curl-O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.4.tgz

two。 First create a user and extract it

Useradd mgdb

Tar-zxvf mongodb-linux-x86_64-3.6.4.tgz-C / home/mgdb

Vim / etc/profile

Export PATH=/home/mgdb/mongodb/bin:$PATH

Chown-R mgdb.mgdb mongodb

3. Modify the configuration file

Vim / etc/mongod.conf

# Log storage location

SystemLog:

Destination: file

Path: / home/mgdb/mongodb/mongod.log

LogAppend: true

Storage:

# # journal configuration

Journal:

Enabled: false / / production environment is recommended to enable to maintain data consistency

# # Storage location of data files

DbPath: / home/mgdb/mongodb/data/db

# # whether to have one library and one folder

DirectoryPerDB: true

# # data engine

Engine: wiredTiger

# # WT engine configuration

WiredTiger:

EngineConfig:

# # maximum use of cache for WT (adjust 4x8 according to the actual situation of the server)

# cacheSizeGB: 4

# # whether to store the index separately by database name

DirectoryForIndexes: true

# # Table compression configuration, data compression algorithm. Available values "none", "snappy", "zlib"

CollectionConfig:

BlockCompressor: none

# # Index configuration

IndexConfig:

PrefixCompression: true

# # make the mongo process a system integration (parent id is 1)

ProcessManagement:

Fork: true

PidFilePath: / home/mgdb/mgdbpid/mongod.pid

# # Port configuration, set the default port to 10689 (default is 27017)

Net:

Port: 10689

BindIp: xxx.xxx.xxx.xxx

# maxIncomingConnections: 65536

WireObjectCheck: true

Ipv6: false

# security:

# keyFile: / data/mongokey

# authorization: enabled

# enableLocalhostAuthBypass: true

5. Modify kernel parameters

Echo never > / sys/kernel/mm/transparent_hugepage/enabled

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

Database

Wechat

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

12
Report