Creation time: Thursday, August 6, 2020 9:23 pm
Here all the operations are under Manjaro KDE 20.03 operating system. Other versions of Linux operations are similar.
#### first look at a simple one -MongoDB installation and configuration database directory port, etc.
first order to order and install
yay -S mongodb-bin
My configuration file is as follows
Configuration file position:/etc/mongodb.conf
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /home/alair/Sources/Repositories/DBS/MongoDB/Datas
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /home/alair/Sources/Repositories/DBS/MongoDB/Logs/mongod.log
# network interfaces
net:
port: 27027
bindIp: 0.0.0.0
# how the process runs
processManagement:
timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
default MongoDB’s service is not an accidental restart from mongoDB, so add:
service file location:/usr/lib/systemd/system/mongodb.service
Modify as follows:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
This configuration means to restart 10 seconds after the mongoDB is interrupted by accident
Now everyone can see the service fileUser=mongodb
It means that the service is started with MongoDB, so all files MongoDB required for the service must have the right to operate to start success. Therefore For MongoDB users:
sudo chown -R mongodb:mongodb /home/alair/Sources/Repositories/DBS/MongoDB
sudo chown -R mongodb:mongodb /usr/bin/mongod
sudo chown -R mongodb:mongodb /etc/mongodb.conf
If there is any omissions to read the error log, it will be all OK
and the startup of MongoDB, check the service status command, and update the newly modified service command
Open start:
sudo systemctl enable mongodb
View status
sudo systemctl status mongodb
Restart
sudo systemctl restart mongodb
stop
sudo systemctl stop mongodb
heavy load service
sudo systemctl daemon-reload
#### to see a pitfall -the installation and configuration database directory port of MariaDB, etc.
Installation command:
yay -S mariadb
First create a database installation directory:
mkdir -p /home/alair/Sources/Repositories/DBS/MariaDB
sudo chown -R mysql:mysql /home/alair/Sources/Repositories/DBS/MariaDB
Installation database
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/home/alair/Sources/Repositories/DBS/MariaDB
service restart the switch status, etc. Look at MongoDB above, replace mongoDB with Mariadb
The most important thing about,If you want to replace the MariaDB’s database directory to the custom directory, then you have to modify the service in the service
Location:/usr/lib/systemd/system/mariadb.service
# Prevent accessing /home, /root and /run/user
ProtectHome=false
After finishing the market set settings:
sudo /usr/bin/mysql_secure_installation
If you succeed, then [email protected]! Intersection If you do n’t succeed in the service of the service, it will give you a lot of answers
End writing time: Thursday, August 6, 2020 at 10:13 pm