I recently installed mongodb on my vps, but it returned an error for me:
Jan 31 01:35:47 servidor-1 mongod[6960]: Error reading config file: No
such file or directory Jan 31 01:35:47 servidor-1 mongod[6960]: try
'/usr/bin/mongod --help' for more information
service mongodb status
I'm using Ubuntu 18.04
Please do check or create this file.
/etc/systemd/system/mongodb.service
It specifies the location of the configuration file. It should either be /etc/mongodb.conf or /etc/mongod.conf depending on your machine.
#Unit contains the dependencies to be satisfied before the service is started.
[Unit]
Description=MongoDB Database
After=network.target
Documentation=https://docs.mongodb.org/manual
# Service tells systemd, how the service should be started.
# Key `User` specifies that the server will run under the mongodb user and
# `ExecStart` defines the startup command for MongoDB server.
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongodb.conf
# Install tells systemd when the service should be automatically started.
# `multi-user.target` means the server will be automatically started during boot.
[Install]
WantedBy=multi-user.target
After this run basic commands to check.
sudo systemctl enable mongodb.service
sudo systemctl start mongodb
sudo systemctl stop mongodb
sudo systemctl status mongodb
sudo systemctl restart mongodb
Related
I created a VM instance on Oracle Cloud, using Oracle Linux 8.6. I added TCP 3389 port in VCN on OCI before installing GUI.
I want to install GUI and allow RDP connection to VM instance, so I installed GNome GUI and XRDP with the following commands (# is I use root user):
# dnf groupinstall "Server with GUI" -y
# systemctl set-default graphical
# reboot
Then uncomment the following line in the /etc/gdm/custom.conf file to ensure that VNC uses X.org instead of Wayland:
WaylandEnable=False
After that, I installed TigerVNC Server and XRDP:
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y
# yum install tigervnc-server xrdp -y
# systemctl start xrdp
# systemctl enable xrdp
# firewall-cmd --permanent --add-port=3389/tcp
# firewall-cmd --reload
Then, I proceeded to set the VNC password, configure VNC service and set up the VNC service as instructed on Oracle's document page.
Finally, I proceeded to connect to VM Instance via Remote Desktop Connection, but I received An authentication error has occurred. The function requested is not supportted:
After that, I revised the port field in the /etc/xrdp/xrdp.ini file into port=tcp://:3389 and then restarted the XRDP service via service xrdp restart command, then check the status of XRDP service through systemctl status xrdp command:
But when I tried to reconnect, the above error still happened. I conducted a check of XRDP service, and it appeared the following errors:
After that, I tried to change the ssl_protocols field in /etc/xrdp/xrdp.ini from ssl_protocols=TLSv1.2, TLSv1.3 to ssl_protocols=TLSv1, TLSv1.1 and then restart the XRDP service. Nothing changes, the same error still happens and the situation of XRDP service is the same!
Something is not right here, maybe I did something missing or was wrongly configured?
I installed Redis server on ubuntu 20.04 with this article step by step. After setting password and other configuration, I run sudo systemctl restart redis.service but changes not be applied. Also, while Redis server was running, I got status with this command sudo systemctl status redis and It said me below message:
What's the problem?!
I searched a lot and found that I should use below commands (using systemctl or service):
with systemctl:
sudo systemctl start redis-server.service to start Redis server
sudo systemctl status redis-server.service to get status of Redis server
sudo systemctl stop redis-server.service to stop Redis server
sudo systemctl restart redis-server.service to apply the changes of config file (sudo nano /etc/redis/redis.conf)
with service:
sudo service redis-server start to start Redis server
sudo service redis-server status to get status
active status:
stop status:
sudo service redis-server stop to stop Redis server
sudo service redis-server restart to apply the changes of config file (sudo nano /etc/redis/redis.conf)
I just updated my mac to Catalina 10.15.2 and I can't running MongoDB.
When I send the command mongo I receive this message
Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
and the only way to make Mongo work is to restart the Mac.
If I check the process with the command ps I don't see the process already on and the port 27017 is available.
I already tried to run the follow command:
brew tap mongodb/brew
brew reinstall mongodb-community
brew services restart mongodb-community
and if I run the follow command:
ps aux | grep -v grep | grep mongod
no results.
I tried to run mongod before mongo as well and the result is:
2019-12-18T12:17:45.916+0100 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] MongoDB starting : pid=9375 port=27017 dbpath=/data/db 64-bit host=Marcos-MacBook-Pro.local
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] db version v4.2.1
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] allocator: system
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] modules: none
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] build environment:
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] distarch: x86_64
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] target_arch: x86_64
2019-12-18T12:17:45.920+0100 I CONTROL [initandlisten] options: {}
2019-12-18T12:17:45.920+0100 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2019-12-18T12:17:45.920+0100 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 693
2019-12-18T12:17:45.920+0100 F - [initandlisten]
***aborting after fassert() failure
Someone can help me please? I appreciate it
An alternative way to fix this Catalina Mac OS root & mongodb connection issue, do the following:
Install Homebrew, if you have it, reinstall it again
run the following commands in the terminal
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew untap mongodb/brew && brew tap mongodb/brew
brew install mongodb-community#4.2
The issue is mongo cannot find /db/data because there is no directory, so you have to create one:
cd ~ (this should take you to your Users folder)
from the Users folder make your own db/data folder by running the follow commands:
mkdir db & cd inside db folder
inside the db folder run: mkdir data & cd inside data folder
run this command: mongod --dbpath ~/data/db
(inside the Users/data/db/ folder you just created)
Now open a new terminal tab &
run: cd ~ (brings you back to Users) -> now run : cd .. & cd .. again (do this twice)
(now you should be in the folder before Users)
(now find tmp folder) cd into the /tmp folder
delete the sock file (this is giving you connection issues)
delete it by running: rm -rf mongodb-27017.sock
now run command: mongo (this should work now)
inside mongo shell run command: db.verion()
if you see a version, your connection works.
From now on to run mongodb database & connection you will have to have two separate tabs open at all times whenever you want to work on your projects
Example:
in one terminal tab run command -> mongod --dbpath ~/data/db
(this starts the connection)
in the other terminal tab run command: mongo
(this starts the shell)
These both have to be running..
Side Note:
you no longer need to start
the connection by running
brew services start mongo-community anymore.
remember mongod --dbpath ~/data/db is basically -> mongod command now.. The Mac OS Catalina Update created root permission problems, that is why mongod command alone never worked before.
Hope this helped you. Goodluck.
Faced a similar issue with macOS Big Sur. After trying all the approaches mentioned above including
updating homebrew
reinstalling MongoDB, MongoDB community and setting up a /System/Volumes/Data/data/dbfolder
This command worked for me mongod --dbpath=/System/Volumes/Data/data/db
reference: https://medium.com/codespace69/mongodb-troubleshooting-errors-for-beginners-and-macos-catalina-31befd99f6c8
This error is caused due to ownership issues.
Here we are changing the ownership to 'mongodb' user.
Command 1: deletes the /tmp/mongodb-27017.sock file
$sudo rm -rf /tmp/mongodb-27017.sock
Command 2: starts mongod service
$sudo service mongod start
Command 3: shows the file with its ownership details
ls -lsah /tmp/mongodb-27017.sock
output
0 srwx------ 1 mongodb mongodb 0 Aug 24 04:01 /tmp/mongodb-27017.sock
Got the same issue after upgrading to Catalina. Tried lots of ways to solve the issue, what eventually helped was reinstalling brew, and then following steps listed on official mongodb site.
So:
Uninstall brew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)
Install it again:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Follow steps to install and run monbo service:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
I have a 8GB droplet on digitalocean. We launched our site today and we got intense traffic, we have about 3000 concurrent users.
I tried to raise the amount of concurrent connections (with the advice of apache2buddy) but the suggested MaxRequestWorkers to be 482. Here is the file:
<IfModule mpm_prefork_module>
ServerLimit 482
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 482
MaxConnectionsPerChild 0
</IfModule>
Apache2 uses mdm_prefork and we have read that it's better if we use mdm_worker.
So i tried to disable mdm_prefork, so that I can enable mdm_worker:
a2dismod mpm_prefork
And I got the following error:
ERROR: The following modules depend on mpm_prefork and need to be disabled first: php7.3
What do I have to do to enable mpm_worker?
I found the possible solution to resolve this on my ubuntu server, dont know whether you are running ubuntu as well on your side, but I feel that the steps that I have taken will be the same for almost all distros with change in 1 step where you need to install a new package and the command for that may change based on the distro that you are using.
so the first step is
$ sudo a2dismod php7.3 mpm_prefork
This will disable the prefork module but before that it will disable the php7.3 module to stop the dependency error from occurring.
Next, we enable the worker module
$ sudo a2enmod mpm_worker
Now, the output would suggest that you restart the apache web-server. So, we do the same
$ sudo systemctl restart apache2
Now, if you go to check your website homepage, it may either throw an error or may load a blank page.
So, how do we resolve that; I scoured multiple community forums and found a solution related to the same but it was for freebsd platform so tried the same on ubuntu with some tweaks required to be made on ubuntu side for the steps to work.
The Solution based on ubuntu OS :
First of all, we enable the proxy, proxy_fcgi and setenvif module followed with a php-fpm package installation corresponding to your php version
$ sudo a2enmod proxy
$ sudo a2enmod proxy_fcgi
$ sudo a2enmod setenvif
$ sudo apt-get install php7.3-fpm -y
the php7.3-fpm installation command is the one where you may need to check the installation steps based on the Distro you are using.
Once, php-fpm service is installed you need to make sure that it gets enabled and then start it, so for that
$ sudo a2enconf php7.3-fpm
$ sudo systemctl enable php7.3-fpm.service
$ sudo systemctl start php7.3-fpm.service
Once, the php-fpm service starts successfully, just restart apache service to make sure all the made changes take effect properly
$ sudo systemctl restart apache2
After these steps are taken, please check/refresh your website homepage and the error page or the blank page will change to the proper website page.
The End-Result; your website has shifted from using prefork module to worker module to handle requests.
Also, if you want to switch to event module instead of worker module; just enable event module in place of worker module in the second step; the one that you will take after disabling php7.3 and prefork module
replace
$ sudo a2enmod mpm_worker
with
$ sudo a2enmod mpm_event
rest all steps after that remain the same irrespective of enabling worker or event module.
These steps helped me switch from prefork module to worker module on my server so hoping it may help you as well as help others who stumble on this issue.
I installed apache solr on CentOS 7 to follow this link https://computingforgeeks.com/install-apache-solr-on-centos-fedora/
After Completing installation, solr status is
After running this command
sudo systemctl enable solr
Show below message
solr.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig solr on
I ran the command to create testcollection.
sudo su - solr -c "/opt/solr/bin/solr create -c testcollection -n data_driven_schema_configs"
After running the command, error is showing below
ERROR: Error CREATEing SolrCore 'testcollection': Unable to create core [tpcollection3] Caused by: null
Can I get any suggestion for creating collection or core successfully.
Question are
1. Why cannot enable solr on centos 7?
2. Why cannot create collection or core?
/sbin/chkconfig solr on is a command fallback to systemctl enable solr, it achieves the same task that is to enable Solr at startup. That said, there is a service installation script that should help install Solr as a service : /opt/solr/bin/install_solr_service.sh.
Ensure you have set the right permissions on Solr directories and restart Solr, also I don't think you need the sudo su part :
chown -R solr:solr /var/solr/
./solr restart
./solr create -c testcollection
Actually I solved to follow another way.
You can extract your desired directory. I made a directory /solr
mkdir /solr
Download latest version solr from latest release of Apache Solr
Extract it
tar -xvf solr-8.2.0.tgz
Add a User
useradd solr
Give permission
chown -R solr:solr solr-8.2.0
Go to your created user
su - solr
Go to Extracted solr bin file
cd solr-8.2.0/bin
Start Solr, check solr status and create solr core Or collection
./solr start
./solr status
./solr create -c testcollection -n data_driven_schema_configs
You will see your created collection or core successful message.
Created new core 'testcollection'