Redis service is not starting - redis

I built from source and installed Redis on my system following this digital-ocean guide. But after running
$ sudo systemctl status redis
I get this failed status report.
● redis.service - Redis In-Memory Data Store Loaded: loaded
(/etc/systemd/system/redis.service; disabled; vendor preset: enabled)
Active: failed(Result: exit-code) since Tue 2018-04-03 01:51:54
+0530; 1s ago Process: 24974 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=203/EXEC) Main PID: 24974
(code=exited, status=203/EXEC)
systemd[1]: redis.service: Unit entered failed state.
systemd[1]: redis.service: Failed with result 'exit-code'.
systemd[1]: redis.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped Redis In-Memory Data Store.
systemd[1]: redis.service: Start request repeated too quickly.
systemd[1]: Failed to start Redis In-Memory Data Store.
systemd[1]: redis.service: Unit entered failed state.
systemd[1]: redis.service: Failed with result 'exit-code'.
My system is Ubuntu 17.10 x64

Check by typing this:
sudo /usr/local/bin/redis-server /etc/redis/redis.conf
It will tell you where you're wrong.

I always have this kind of trouble. Usually I use the tool on utils package and this problem is solved.
sudo /tmp/redis-stable/utils/install_server.sh
I guess this approach a good way.

Could you please tell me what happen when you exec the following command? redis-server
Please don't forget give more information about your redis.conf file because the root of problem could be there and redis logs too, you can add the following line in your config file to get some error logs.
logfile /path/to/my/log/file.log
After that you should restart or reload the service to get additional information
I hope this information help you!

I have same error and I solved that problem by fixing dir in redis.conf(I guess that is the directory for dump.rdb).
dir /some/directory
So dump.rdb can be located in the directory that the user have permission.

Related

How to restart prometheus?

I have set-up prometheus in my Ubuntu machine and it is running at localhost:9090 now. But, when I run the following command, I get a failed status.
systemctl status prometheus
Output:
● prometheus.service - Prometheus
Loaded: loaded (/lib/systemd/system/prometheus.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2019-11-06 14:58:36 +0530; 8s ago
Main PID: 7046 (code=exited, status=1/FAILURE)
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Service hold-off time over, scheduling restart
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Scheduled restart job, restart counter is at 5
නෙවැ 06 14:58:36 ayesh systemd[1]: Stopped Prometheus.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Start request repeated too quickly.
නෙවැ 06 14:58:36 ayesh systemd[1]: prometheus.service: Failed with result 'exit-code'.
නෙවැ 06 14:58:36 ayesh systemd[1]: Failed to start Prometheus.
I tried to restart prometheus using;
killall -HUP prometheus
sudo systemctl daemon-reload
sudo systemctl restart prometheus
and using;
curl -X POST http://localhost:9090/-/reload
but they did not work for me. I have checked for syntax errors of prometheus.yml using 'promtool' and it passed successfully.
Is there any other way to fix this problem?
Check if it still running on your task manager and then kill it's task from there, that will work.
The output shows a failed start of prometheus. So you shouldn't be able to kill anything. Just check your processes with:
ps -ef | [p]rometheus # the [p] is used to hide the grep process itself
Use the following command to see more log content about prometheus:
journalctl -t prometheus
There might also be more information in your log files in the directory /var/log, especially in /var/log/messages and/or /var/log/syslog.
For debugging purposes just start prometheus in the foreground by executing the following:
$(which prometheus)
This will help to find additional information about the failed start.

Cpanel - Startup Script

How can one go about getting a java command when they reboot their server using Cpanel or WHM? I have a spring boot application running (starting it using java -jar jarname.jar. When I restart Cpanel I have to run the script manually. How Can I make it so the command will automatically run when Cpanel or Centos7 restart? I installed java as the root so I dont know if that means I have to run it as a Centos7 script instead of a Cpanel script of some sort.
The error I am currently getting using a centos7 systemctl service:
blah.service - Startsspring boot
Loaded: loaded (/etc/systemd/system/blah.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Fri 2018-04-27 19:19:47 EDT; 2s ago
Process: 3642 ExecStart=/usr/bin/bash /usr/bin/blah.sh (code=exited, status=0/SUCCESS)
Main PID: 3642 (code=exited, status=0/SUCCESS)
Apr 27 19:19:47 server systemd[1]: Started Starts spring boot.
Apr 27 19:19:47 server systemd[1]: Starting Starts spring boot...
Thats all the help i get says it starts but the service never starts my jar it says inactive :(
startups script:
[Unit]
Description=Starts spring boot
After=network.target
[Service]
ExecStart=/usr/bin/bash /usr/bin/blah.sh
Type=simple
User=root
[Install]
WantedBy=multi-user.target
the .sh file (works fine if i run it command line)
/usr/bin/nohup /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java -jar /home/domain/public_html/jarname.jar &
Thanks,
Brian
I found a solution here. I just did the java command in the systemd service not in a shell script.
https://techdev.io/en/developer-blog/jvm-applications-as-a-service-with-systemd

DCOS navstar service failed to start on agent nodes

I'm setting up DC/OS on dev servers and faced with one of agent node failing to run navstar service:
# journalctl -u dcos-navstar -b
Mar 18 13:45:15 localhost.localdomain systemd[1]: Starting Navstar: A distributed systems & network overlay orchestration engine...
Mar 18 13:45:15 localhost.localdomain check-time[5868]: Checking whether time is synchronized using the kernel adjtimex API.
Mar 18 13:45:15 localhost.localdomain check-time[5868]: Time can be synchronized via most popular mechanisms (ntpd, chrony, systemd-timesyncd, etc.)
Mar 18 13:45:15 localhost.localdomain check-time[5868]: Time is in sync!
Mar 18 13:45:15 localhost.localdomain ping[5870]: ping: ready.spartan: Name or service not known
Mar 18 13:45:15 localhost.localdomain systemd[1]: dcos-navstar.service: control process exited, code=exited status=2
Mar 18 13:45:15 localhost.localdomain systemd[1]: Failed to start Navstar: A distributed systems & network overlay orchestration engine.
The ntpd service is installed and running (service is active). Time synchronization with ntpd works fine. Please advice.
Check 123 port is open and is not blocked by iptables or other firewall. Or try to use chrony as a service to synchronize the system clock with NTP servers (it is more accurate and has more features than ntp).
For CentOS:
yum install chrony
I had the same trouble with DC/OS. But not only navstar.service, but also metronome.service was failed (same time sync issue). Spent lot's of time searching for the grain of problem. Finally migrated to chrony and the problem disappeared.
For long-running tasks use Marathon. For one-time or cron tasks use Chronos. You simply use REST API to place and manage your tasks at DCOS through mentioned above frameworks. And I recommend you to use containers. Here you can read about: micro-services at DCOS

Redis not starting on centos 7

I am migrating my current ec2 environment from amazon linux to centos 7. There have been a few hurdles along the way but I have managed to tweak things here and there and get everything to work. However, I am not stuck on redis.
I have a small redis cluster running as a simple k/v cache. For this migration I have been following these instructions. The install seems to work fine but I check the status in systemctl and see the following:
$ sudo systemctl status redis.service
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
└─limit.conf
Active: failed (Result: exit-code) since Fri 2016-02-26 16:57:43 UTC; 5s ago
Process: 11680 ExecStop=/usr/bin/redis-shutdown (code=exited, status=1/FAILURE)
Process: 11678 ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no (code=exited, status=1/FAILURE)
Main PID: 11678 (code=exited, status=1/FAILURE)
The redis.log is created but empty so it is failing very early on. But I cannot seem to find the cause. Any guidance would be greatly appreciated.
Turns-out that the redis.conf I was putting in-place via ansible using a jinja template was out-of-date. It was causing redis to not start. Would be nice if this was better outlined in the logs. Something like "missing or invalid configuration".

Not able to Start rabbitmq server in centos 7 using systemctl

I am trying to start the rabbitmq server in centos 7. I installed erlang as it is a dependency to rabbitmq-server. Package erlang.x86_64 0:R16B-03.7.el7 .I then Installed rabbitmq using package rabbitmq-server-3.2.2-1.noarch.rpm. Installation was successful. I enabled management console uisng rabbitmq-plugins enable rabbitmq_management. But while starting the service rabbitmq-server it fails.
[root#tve-centos ~]# systemctl start rabbitmq-server.service
Job for rabbitmq-server.service failed. See 'systemctl status rabbitmq-server.service' and 'journalctl -xn' for details.
[root#tve-centos ~]# systemctl status rabbitmq-server.service
rabbitmq-server.service - LSB: Enable AMQP service provided by RabbitMQ broker
Loaded: loaded (/etc/rc.d/init.d/rabbitmq-server)
Active: failed (Result: exit-code) since Fri 2014-09-12 13:07:05 PDT; 8s ago
Process: 20235 ExecStart=/etc/rc.d/init.d/rabbitmq-server start (code=exited, status=1/FAILURE)
Sep 12 13:07:04 tve-centos su[20245]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos su[20296]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos su[20299]: (to rabbitmq) root on none
Sep 12 13:07:05 tve-centos rabbitmq-server[20235]: Starting rabbitmq-server: FAILED - check /var/log/rabbitmq/startup_{log, _err}
Sep 12 13:07:05 tve-centos rabbitmq-server[20235]: rabbitmq-server.
Sep 12 13:07:05 tve-centos systemd[1]: rabbitmq-server.service: control process exited, code=exited status=1
Sep 12 13:07:05 tve-centos systemd[1]: Failed to start LSB: Enable AMQP service provided by RabbitMQ broker.
Sep 12 13:07:05 tve-centos systemd[1]: Unit rabbitmq-server.service entered failed state.
and logs shows /var/log/rabbitmq/startup_log
BOOT FAILED
===========
Error description:
{could_not_start,rabbitmq_management,
{could_not_start_listener,[{port,15672}],eacces}}
Log files (may contain more information):
/var/log/rabbitmq/rabbit#tve-centos.log
/var/log/rabbitmq/rabbit#tve-centos-sasl.log
but no process is using port 15672
But if I try to start it using /usr/sbin/rabbitmq-server .I successfully started the service. But my requirements are to start it using the systemctl.
Better answer would be to actually fix SELinux and the firewall.
Open the port:
firewall-cmd --permanent --add-port=5672/tcp
firewall-cmd --reload
setsebool -P nis_enabled 1
That works for me.
It looks like a port issue. To confirm that
systemctl stop firewalld
systemctl disable firewalld
And disable SELinux for the time being in /etc/selinux/config file
SELINUX=disabled
Try reboot your machine and see whether the issue persists.
After running this command:
[root#gcp-hehe-amqp ~]# /sbin/service rabbitmq-server start
And getting the error:
Redirecting to /bin/systemctl start rabbitmq-server.service
Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details"
After many attempts, I solved the error by following this:
run command:
firewall-cmd --permanent --add-port=5672/tcp
then: firewall-cmd --reload
change this: SELINUX=disabled at /etc/selinux/config
Enable the proxy protocol to true at /etc/rabbitmq/rabbitmq.conf
proxy_protocol = true