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

YUM installation and installation Mongodb 3.4 under CentOS7 system

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

Share

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

YUM installation and installation Mongodb 3.4 under CentOS7 system

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:

Cat / etc/yum.repos.d/mongodb-3.4.repos

[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.2.asc

Gpgcheck=0 can be modified here to omit gpg verification

Update all packages before installation: yum update (optional)

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 192.168.60.102pur27017

> 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"}]})

Configuration

Fork=true # # allow programs to run in the background

# auth=true # # start authentication

Logpath=/data/db/mongodb/logs/mongodb.log logappend=true # mode for logging: set to true and append. The default is to overwrite the dbpath=/data/db/mongodb/data/ # # data storage directory

Pidfilepath=/data/db/mongodb/logs/mongodb.pid # process ID. If not specified, there will be no PID file at startup. Default. Default.

Port=27017

# bind_ip=192.168.2.73 # bind address. Default 127.0.0.1, can only be set to true through the local connection #, modify the data directory storage mode, and the files for each database are stored in a different folder in the directory specified by DBPATH. # with this option, configured MongoDB can store data on different disk devices to increase write throughput or disk capacity. The default is false. # it is recommended to configure secondary options at the beginning

Directoryperdb=true # disable logging # enable operation logging for journal to ensure write persistence and data consistency, and create a journal directory under the dbpath directory

Nojournal = true # #

Max connections # maximum number of connections. Default value: depends on the system (that is, the ulimit and file descriptor) limitations. There are no restrictions on its own connections in # MongoDB. When the setting is greater than the system limit, it is invalid, subject to the system limit. # set the value to be higher than the connection pool and the total number of connections to prevent peak connections. # Note: this value cannot be set greater than 20000. MaxConns=1024

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