cannot kill redis-server on linux
Figured it out! Turns out when I had tried the second answer provided at this SO post, I had done cd /etc/init.d
and then ran redis-server stop
, when I actually should've run /etc/init.d/redis-server stop
. I do not know why this matters though.
How can I stop redis-server?
Either connect to node instance and use shutdown command or if you are on ubuntu you can try to restart redis server through init.d:
/etc/init.d/redis-server restart
or stop/start it:
/etc/init.d/redis-server stop
/etc/init.d/redis-server start
On Mac
redis-cli shutdown
Stop redis server. Neither shutdown nor stop works
I finally got it down.
Get the PID of the process (this worked in Webfaction):
ps -u my_account -o pid,rss,command | grep redis
Then
> kill -9 the_pid
I was able to REPRODUCE this issue:
Start redis-server
Then break it using Pause/Break key
Now it hangs and it won't shutdown normally. Also the Python program trying to set/get a key hangs. To avoid this: Just close the window after starting redis-server. It's now running normally.
How to stop a redis server that was started with --daemonize yes
There are three options for your question from my test.
- Stop redis by stoping redis service. This is the recommend way in most cases.
sudo systemctl stop redis-server
or
sudo service redis-server stop
- connect to this redis-server and shutdown it by redis-cli.
redis-cli
after connected to redis, issue shutdown to turn off redis-server
shutdown
- Kill the redis-server process directly:
ps -ef | grep redis-server
kill -9 (pid)
redis - kill redis-server in google cloud platform
The redis-cli shutdown
works on Mac OS. If you using Debian or Ubuntu, the easiest, way you can shutdown the server is to go into the server and type sudo service redis-server stop
and service redis-server start
to start it again.
Example
test-user@my-server:~$ sudo service redis-server stop
test-user@my-server:~$ ps -f -u redis
UID PID PPID C STIME TTY TIME CMD
test-user@my-server:~$
The question was answered in this community post. You may also see the following community tutorial on "How to Set Up Redis on Google Compute Engine"
shutdown redis-server from command line
Your Redis server is configured with a password apparently. Therefore, when using redis-cli, you'll need to issue the AUTH password
command before any other command or else you'll be getting that error message (replace password
with your server's password).
Alternatively, you can invoke redis-cli
with the -a
switch followed by your password for the same result.
To find the password of your server, open the Redis configuration file (by default /etc/redis/6379.conf
) and look for the line starting with requirepass
- whatever value is next to it, is the password.
Related Topics
In Shellscript Assign Variable Based on Curl Output
Linux Shell Script - Find All Files and Run a Command on Each One of Them
Mq Explorer - Could Not Load Swt Library
How to Open Include File 'Io.Mac' Assembly
Restoring System Directories Permissions
How to Reserve Ip When Provisioning Azure Vm (Resource Manager)
How to Have Chef Reload Global Path
What's The Best Way to Move a Directory into Place in a Makefile Install
How to Run a Bash Function() in a Remote Host? in Ubuntu
Implementation of Function Execve (Unistd.H)
Suppressing Compile Time Linkage of Shared Libraries
Linux Sysfs Gpio: What Re-Arms Interrupt
Different Show Between "Cat" and "Vim"
How to Run The Linux/X86/Shell_Bind_Tcp Payload Stand Alone
Grep,How to Search for Exact Pattern
Cannot Connect to The Docker Daemon at Unix:///Var/Run/Docker.Sock