How do I stop cassandra server running on a single node in my mac os x?
Cassandra script doesn't have -stop option. Only way other than restart the mac os x, was to do a "ps" and find the java process which had arguments for cassandra and use kill -9 to kill the process.
But trying to restart cassandra after that still throws
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 7199; nested exception is:
java.net.BindException: Address already in use.
Anybody seen it? Any quick solutions?
If you've installed cassandra via homebrew, use brew info cassandra and it will tell you how to load/unload cassandra using launchctl. This worked better for me than the other answers here.
Commands
brew info cassandra To see status of cassandra
brew services start cassandra To start cassandra
brew services stop cassandra To stop cassandra
EDIT: I actually find this much more useful.
Open terminal and type:
$ ps -ax | grep cassandra
gives you a list of pids running with the name cassandra.
Use the PID number to kill the process for example here is a returned value:
708 ttys000 0:03.10 /usr/bin/java -ea -javaagent:Downloads/Web/Cassandra/dsc-cassandra-1.1.0/bin/
$ kill 708
Old post:
After posting my comment I found a stop-server script in the BIN.
You have to open up the script and comment out the code if you want to use that script. But here is what it says inside the script.
echo "please read the stop-server script before use"
# if you are using the cassandra start script with -p, this
# is the best way to stop:
kill `cat <pidfile>`
# otherwise, you can run something like this, but
# this is a shotgun approach and will kill other processes
# with cassandra in their name or arguments too:
# user=`whoami`
# pgrep -u $user -f cassandra | xargs kill -9
Found this solution elsewhere which seems to work!
pkill -f 'java.*cassandra'
Worth a try!
This works on the Ubuntu I have. Not on MacOS!
On Mac one more is ps -af | grep cassandra and then using kill. But, it does not work sometimes!
Another approach is to see which OS process has the Cassandra port open, like this:
lsof -i :9160
Sample output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 30253 aswan 214u IPv4 0xffffff80190dcc20 0t0 TCP *:netlock1 (LISTEN)
Then you can use "kill -9 [pid]" on that process.
You can use Cassandra's nodetool command, as well.
nodetool drain
The documentation doesn't say anything about it shutting down, but it works reliably for me with a single node, local server. It generally takes a few seconds to finish the shutdown, however.
kill -9 ` acx | grep -i cassandra | awk '{print$1}' `
I'm using the new Datastax Enterprise 5.0 version, and it, at least, offers a simple enough command for stopping Cassandra:
dse cassandra-stop
It takes a few moments to shut down, but it works for me.
Related
I am using a scratch file for some Kotlin work.
I accidentally created an endless loop in one of my functions and ran the file, so Intellij is not responding.
There is no button for stopping the execution of the scratch file and even if there were, that wouldn't work because Intellij is not responding to mouse clicks.
How do I force stop or restart Intellij in this case?
You can kill the process by name using
pkill -9 intellij
or by
killall -9 intellij
or even
kill -9 $(ps aux | grep intellij | awk '{print $2}')
You first need to find Intellij's process id:
ps -f | grep -i intellij
and then kill the process id (PID):
kill -9 PID
Already good answers are given above.
Another great way to find IntelliJ PID is to use htop command on Linux.
Install htop with the command: sudo apt install htop
Run htop in terminal
In the tabular format, PID is associated with each process including IntelliJ.
Run kill -9 <pid_of_intellij> to kill the IntelliJ process.
You can use xkill
then move the cursor from X to the window you need for example with (ide)
This works provided that you are not completely frozen OS
I launch Stanford Core NLP server using the following command (on Ubuntu 16.04):
java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
I would like to kill this server once I am done using it. Simply closing terminal does not help. It does not release memory. Is there way to kill it and release memory without rebooting computer?
You can always CTRL-C in the terminal window to stop the server.
You could also ps aux | grep StanfordCoreNLPServer to find the pid and then kill the process manually.
When the server is started it should create a shutdown key and you can send that message to the server to close the server. This isn't working on my Macbook Pro (maybe a permission issue ??) but I've seen it work on other machines.
Here is the command:
wget "localhost:9000/shutdown?key=`cat /tmp/corenlp.shutdown`" -O -
Note the shutdown key is stored at /tmp/corenlp.shutdown
If you use the the -server_id server0 option the shutdown key will be stored at this path /tmp/corenlp.shutdown.server0
If you just want to kill the process. You can use lsof command.
#install lsof if missing
sudo apt install lsof
You can find the pid of CoreNLP using
lsof -i:9000
Replace 9000 with the port you used to run the server.
The output looks like
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 15867 XXXX XXX IPv6 XXXXXX 0t0 TCP *:9000 (LISTEN)
Use the pid from here and run.
kill 15867
PID of my server process is 15867.
I'm working on MINI2440 and building a custom OS for it using buildroot, but for testing purpose I'm using OS downloaded from official website.
So the problem is, I'm using usbpush to push OS images in MINI2440 through USB, but it popups the message when I enter below commond
sudo ./usbpush supervivi-128M 0x30008000
Unable to claim usb interface 1 of device: could not claim interface 0: Device or resource busy
I don't understand one concept that, whenever I assign executable permission to usbpush, it runs automatically in background. It's clearly seen below
ps -ef | grep usb*
silicod+ 2431 2207 0 10:25 pts/10 00:00:00 grep --color=auto usbpush
I tried to kill using
sudo kill -9 2431
But it creates new pid and again run itsellf in background. I tried googling but nothing works for me.
=============================================================
Well, I got my solution. I don't know what is the problem with my usbpush tool, but I downloaded another tool and it works very well. Here is the link to that tool , may it help someone
Friendly_ARM_Mini2440_USBPUSH
Cheers....!
lovely ;-)
well I guess it is actually not running..
ps -ef will give you details about all running processes
grep usb* - (loose the *) will find any lines containing usb
the way unix/linux does it is that grep gets started first and then the "|" connects output of ps -ef to grep's input
so what you are finding is the grep command itself
what you want is ps -ef | grep -v grep | grep usb - this will work unless your "usb" command is something like grepusb or usbgrep or the line contains grep..
While configuring/installing Hadoop cluster we often need to kill a Java Process/Daemon.
We see Java Processes/Daemons running with jps command.
Usually we kill a Java process with its PID. E.g.
kill -9 112224
It is little bit difficult to type the PID. Is there a way to kill the process by its name? In a single command?
Here is the command to kill the Java process by is Process Name instead of its ProcessID.
kill -9 `jps | grep "DataNode" | cut -d " " -f 1`
Let me explain more, about the benefit of this command. Lets say you are working with Hadoop cluster. Its often required that you check java daemons running with jps command. Lets say when you give this command on worker nodes, you see following output.
1915 NodeManager
18119 DataNode
17680 Jps
Usually, if we want to kill DataNode process, we would use following command
kill -9 18119
But, it is little bit difficult to type the PID, to use kill command. By using the command, given in this answer, it is easy to write the name of the process. We can also prepare shell scripts to kill commonly used deamons in hadoop cluster,
or we can prepare one shell script and can use parameter as process name.
How about using
killall firefox
jps -l has helped me killing the process
kill `jps -l | grep "myjarname.jar" | cut -d " " -f 1`
To get the process id of that java process run
netstat -tuplen
Process ID (PID) of that process whom you want to kill and run
kill -9 PID
I am new to the Cassandra database. I have downloaded Cassandra and set the JAVA_HOME. When I try to run, the following exception is thrown:
Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 7199; nested exception is:
java.net.BindException: Address already in use: JVM_Bind.
Can anyone assist me with this issue?
For those who are facing the same problem using Ubuntu OS a solution can be to kill CassandraDaemon :
pkill -f CassandraDaemon
When you launch for the first time the command "cassandra -f" background daemon is running so Ctrl^C doesn't stop the process.
You could check if cassandra is running by checking the port
lsof -i :9160
if you got a result back that means it is running
If you want to kill it , do kill -9 "then the pid you got from the last step"
if you want to see the ongoing log run
cassandra -f when you start cassandra
I appears that Cassandra is already running in the background. Try connecting using cassandra-cli.
ps -ax | grep cassandra, take note of the process id
kill <pid>
sudo ./cassandra
Port 7199 is the default Cassandra's JMX port( used for monitoring).
In case you are trying to run multiple instances on one physical machine, modify $CASSANDRA_HOME/conf/cassandra-env.sh configuration file and set different port, for example 7299
JMX_PORT="7299"
I am writing the same but for windows developer command prompt :
Let say its showing issue with 9042 port
netstat -ano | findstr : 9042
List all the process using port 9042
taskkill /PID 237979 /F
here 237979 is the processid which is using port 9042
Download the TCPView from http://technet.microsoft.com/en-us/sysinternals/bb897437
Open the TCPView application and sort the output by Port
Click on the record which points to Port - 7199
Right click and "End Process"
Now, run the Cassandra.bat and it should work.