[MongoDB]Common Issues Collection
keywords: MongoDB, Common Issues Collection
Usages
Install MongoDB on CentOS
1, Config Yum repository for MongoDB
sudo vi /etc/yum.repos.d/mongodb-org-4.4.repo
Append following contents:
[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc
2, Install MongoDB
sudo yum install mongodb-org
This command will automatically install MongoDB related components and dependencies.
3, Conifg MongoDB
Enable MongoDB service:
sudo systemctl enable mongod.service
Startup MongoDB service:
sudo systemctl start mongod.service
Stop MongoDB service:
sudo systemctl stop mongod.service
Check MongoDB service status:
sudo systemctl status mongod.service
Modify MongoDB profile path:
/etc/mongod.conf
4, Connect MongoDB
mongo
Origin: centos 安装mongodb
https://www.cnblogs.com/huamoai/p/17496672.html
Change MongoDB data store directory
modify /etc/mongod.conf:
storage:
dbPath: "/usr/local/var/mongodb"
Issues
libc.so.6: version `GLIBC_2.32’ not found
$ mongorestore --version
>> mongorestore: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by mongorestore)
>> mongorestore: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by mongorestore)
Solution:
This’s because the Linux OS version is lower, but the MongoDB version is higher, since MongoDB requires a newer compilation environment.
Although there are many articles saying that GLIBC can be upgraded, it’s not recommended because using a higher GLIBC on a lower Linux system may cause some unexpected problems.
error while loading shared libraries: libcrypto.so.1.1
mongod: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
Solution:
Download openssl 1.1 and compile it.
Then copy so into /usr/local/lib64/:
sudo cp libssl.so.1.1 /usr/local/lib64/
sudo cp libcrypto.so.1.1 /usr/local/lib64/
Then append directory in /etc/ld.so.conf:
sudo vim /etc/ld.so.conf
content:
# include directories
/usr/local/lib64/
Refresh config:
sudo ldconfig
Origin:
https://www.cnblogs.com/tllb/p/16122647.html
NonExistentPath: Data directory /data/db not found
"error":"NonExistentPath: Data directory /data/db not found. Create the missing directory or specify another path using (1) the --dbpath command line option, or (2) by adding the 'storage.dbPath' option in the configuration file."
Solution:
sudo mkdir -p /data/db/
sudo chown $(id -u) /data/db
Origin:
https://askubuntu.com/a/1264578/1476756
战国战争史:秦韩魏伊阙之战
伊阙之战,发生在周赧王二十二年(前293年),石窟开凿前的洛阳龙门。秦国为打开东进中原通道,由大将白起率秦军在伊阙龙门大破魏韩24万联军,彻底扫平秦军东进之路,可谓白起的成名之战。
战争中,秦将白起针对韩、魏两军互相观望,不愿率先出击的弱点,以少量兵力钳制联军的主力韩军,以主力猛攻较弱的魏军。魏军无备,仓促应战,迅即惨败。韩军震慑,且翼侧暴露,遭秦军夹击,溃败而逃。白起乘胜挥师追击,全歼韩魏联军24万人,攻占伊阙,夺取魏城数座及韩国安邑以东大部分地区。魏、韩两国割地求和。
战后,韩国精锐损失殆尽。秦国则以不可抗拒之势向东进击。