停止mac os x上的cassandra服务器

bsc*_*han 17 cassandra

如何阻止cassandra服务器在我的mac os x中的单个节点上运行?Cassandra脚本没有-stop选项.除了重新启动mac os x之外,唯一的方法是执行"ps"并找到具有cassandra参数的java进程并使用kill -9来终止进程.

但在此之后尝试重启cassandra仍然会抛出

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.

有谁见过吗?快速解决方案吗?

Mic*_*ael 19

编辑:我实际上发现这更有用.

打开终端并输入:

$ ps -ax | grep cassandra

给出了一个名为cassandra的pids列表.

使用PID号来终止进程,例如这里是返回值:708 ttys000 0:03.10/usr/bin/java -ea -javaagent:Downloads/Web/Cassandra/dsc-cassandra-1.1.0/bin /

$ kill 708


老帖子:

发表评论后,我在BIN中找到了一个停止服务器脚本.

如果要使用该脚本,则必须打开脚本并注释掉代码.但这就是它在剧本中所说的内容.

 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
Run Code Online (Sandbox Code Playgroud)


小智 18

在其他地方找到这个解决方案似乎有效!

pkill -f 'java.*cassandra'

值得一试!这适用于我有的Ubuntu.不在MacOS上!

在Mac上还有一个ps -af | grep cassandra然后使用kill.但是,它有时不起作用!


sly*_*rel 16

如果你已经通过自制软件安装了cassandra,请使用brew info cassandra它,它将告诉你如何使用launchctl加载/卸载cassandra.这对我来说比这里的其他答案更好.

命令

brew info cassandra 查看cassandra的状态

brew services start cassandra 开始cassandra

brew services stop cassandra 停止卡桑德拉

  • `brew services stop cassandra`对我来说非常适合 (6认同)