Create MongoDB cluster with 3 nodes
Edit /etc/hosts file in 3 nodes, add with 3 node ips: In terminal, set root password: Create ssl key then COPY folder to all members for same key. Disable THP: Edit file /etc/mongod.conf, add: Restart mongod for all nodes: Connect to primary node (node 1) with your yourRootPassword Setup replication: Check it: Create new user…
MongoDB error: child process failed, exited with error number
Check all path in /etc/mongod.conf. If files or folders not exist, create them then:
Store compressed data in MongoDB and decompress it
Storing compressed data in MongoDB and decompressing it is a necessary task when you store large data files like Logs. Database schema Interface Upload Controller Method: POST – ‘multipart/form-data‘ Field name: file Type: Use .zip file for lightweight Allows to use multiple text files in a zip file Upload Service Input: file Extract the zip…
MongoServerError: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection [Solved]
Tips for “MongoServerError: Plan executor error during findAndModify :: caused by :: E11000 duplicate key error collection“. Mongo duplicate when findAndModify(), same for findOneAndUpdate() Don’t try to query the dynamic field with the upsert option! The same problem will occur when querying multiple conditions (include some not unique fields), while turn on option upsert=true. This…
Install MongoDB for PHP Laravel
At this moment, php-mongodb support PHP7.2 for Laravel. You need to change PHP-cli to 7.2 (my server use OpenLiteSpeed): Depend on your server OS, your commands like as: Add “extension=mongodb.so” to php72 config (php.ini). Restart your php server: For OpenLiteSpeed: systemctl restart lsws In your project folder, run:
Quick install MongoDB on Centos 8/ Rocky Linux in 1 minute
In Centos/ Rocky Linux terminal, run all bellow command: You can connect your DB by MongoDB Compass app in manual Change your MongoDB port and bind IP in: /etc/mongod.conf