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)
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?
Apache/2.4.25, PHP 7.3.17 Greetings I am looking to change from prefork to worker and I follow the following steps:
a2dismod php7.3
systemctl restart apache2
a2dismod mpm_prefork
a2enmod mpm_worker
systemctl restart apache2
a2enmod php7.3
After the last step above I get the error:
Considering dependency mpm_prefork for php7.3:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
ERROR: Module mpm_worker is enabled - cannot proceed due to conflicts. It needs to be disabled first!
ERROR: Could not enable dependency mpm_prefork for php7.3, aborting
What can I do to make the worker work?
If you want to use mpm_event or mpm_worker, php7.3 i.e the php module for apache will not work.
You must install an alternative such as PHP-FPM. Make sure you have atleast 2 GB of RAM for PHP-FPM
To install PHP-FPM, do the following:
a2dismod php7.3
a2dismod mpm_prefork
a2enmod mpm_worker
systemctl restart apache2
apt install php-fpm -y
a2enmod proxy_fcgi setenvif
a2enconf php7.3-fpm
systemctl start php7.3-fpm
systemctl restart apache2
https://www.php.net/manual/en/faq.installation.php#faq.installation.apache2
PHP-FPM actually provides you with way better performance than the PHP module.
redis dir is /var/lib/redis and dbfilename is dump.rdb and I have restore.rdb backup whichi is from another machine, I tried to replace dump.rdb with restore.rdb but after starting redis it is overwritten to previous steps , so I have changed my dbfilename to restore.rdb and restarted the server but dbfilename is same as before if check in redis-cli
steps I followed
sudo /etc/init.d/redis-server stop
sudo mv /var/lib/redis/dump.rdb /var/lib/redis/dump.rdb.bak
sudo cp restore.rdb /var/lib/redis/dump.rdb
sudo redis-server config/redis.conf
Once server is started dump.rdb is overwritten to previous state. So, instead replace dump.rdb I tried alternative method
sudo /etc/init.d/redis-server stop
sudo cp restore.rdb /var/lib/redis/dump.rdb
and then changed dbfilename to restore.rdb in redis.conf
then restarted the redis
sudo redis-server config/redis.conf.
then I entered into redis-cli and to check config and I realised that config hasn't changed
redis server version:
Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3
the issue is redis server is running in background even after killing it with below command
sudo /etc/init.d/redis-server stop
so you need to make sure you stop redis server is killed
sudo /etc/init.d/redis-server stop
ps aux | grep redis-server | awk '{ print $2 }'| xargs kill -9
above commands will kill all redis related server then
sudo mv /var/lib/redis/dump.rdb /var/lib/redis/dump.rdb.bak
sudo cp restore.rdb /var/lib/redis/dump.rdb
sudo redis-server config/redis.conf
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
I am experiencing the following problem using mongodb.
This is the error, when I check the status:
Screenshot of the error (mongodb.service, status 14)
Screenshot of code in the mongod.config file
Screenshot of the log file
I have tried uninstalling mongodb following every step from the website and install everything again and when I check the status I still get the same error. I have posted the screenshot of the error.
I am using MacBook pro if this matters.
Would really appreciate, if someone can help me fix this.
By changing the owner to monogdb user of
/var/lib/mongodb and /tmp/mongodb-27017.lock has worked for me.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
It seems from the log you have a unclean shutdown before. Or, it could also indicates that mongod is already running.
First, make sure mongod is not running already
ps aux | grep mongod
If it's not, remove the file:
rm /tmp/mongodb-27017.sock
Then try systemctl start mongod to start MongoDB again.
After rebooting in the command line,it fixed to problem,don’t know why after stopping mongo and uninstalling and installing it didn’t fix the problem, but after reboot everything is working fine.
This worked for me on Ubuntu 18.04
Go to the TMP directory: cd /tmp
Check if you have the mongodb sock file: ls *.sock
Change the user:group permission: chown mongodb:mongodb <YOUR_SOCK>
Start MongoDB: sudo service mongod start
Check the MongoDB status: sudo service mongod status
If this does not work you can try
sudo reboot
Please see here : https://medium.com/#gabrielpires/mongodb-ubuntu-16-04-code-exited-status-14-aws-lightsail-problem-417ffc78cb11
I had a similar issue and even though the permissions were all okay, the service failed to start. I had a look at the mongodb log
sudo tail -40 /var/log/mongodb/mongod.log
It said that the database was shutdown unexpectedly and needed to be repaired. I ran
sudo mongod --repair --config /etc/mongod.conf
This fixed the database, but now changed the permissions. You will need to do the chown steps again.
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown mongodb:mongodb /tmp/mongodb-27017.sock
Start the mongod service. It would be up & running now.
Same happended with CentOS Stream 8
the user for mongodb service is mongo and group is also mongo
sudo chown mongod:mongod /tmp/mongodb-27017.sock
Resolved, after checking the logfile, showing mongodb-27017.sock failed to start.
I have a similar issue. Was a SELinux blocking the normal execution.
So, I did:
# ausearch -c 'mongod' --raw | audit2allow -M my-mongod
# semodule -X 300 -i my-mongod.pp
and then:
$ sudo systemctl start mongod
and check:
sudo systemctl status mongod
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock