# cd /usr/local/apache-cassandra-4.0.1/bin# ./cassandra -R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@cassandra /]# cd /usr/local/apache-cassandra-4.0.1/bin
[root@cassandra bin]# ll
total 152
-rwxr-xr-x. 1 root root 10542 Aug 30 2021 cassandra
-rw-r--r--. 1 root root 5667 Aug 30 2021 cassandra.in.sh
-rwxr-xr-x. 1 root root 2995 Aug 30 2021 cqlsh
-rwxr-xr-x. 1 root root 95408 Aug 30 2021 cqlsh.py
-rwxr-xr-x. 1 root root 1894 Aug 30 2021 debug-cql
-rwxr-xr-x. 1 root root 3491 Aug 30 2021 nodetool
-rwxr-xr-x. 1 root root 1770 Aug 30 2021 sstableloader
-rwxr-xr-x. 1 root root 1778 Aug 30 2021 sstablescrub
-rwxr-xr-x. 1 root root 1778 Aug 30 2021 sstableupgrade
-rwxr-xr-x. 1 root root 1781 Aug 30 2021 sstableutil
-rwxr-xr-x. 1 root root 1778 Aug 30 2021 sstableverify
-rwxr-xr-x. 1 root root 1175 Aug 30 2021 stop-server
1
2
3
4
5
[root@cassandra bin]# ./cassandra -R[root@cassandra bin]# OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
CompileCommand: dontinline org/apache/cassandra/db/Columns$Serializer.deserializeLargeSubset(Lorg/apache/cassandra/io/util/DataInputPlus;Lorg/apache/cassandra/db/Columns;I)Lorg/apache/cassandra/db/Columns;
CompileCommand: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubset(Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;ILorg/apache/cassandra/io/util/DataOutputPlus;)V
CompileCommand: dontinline org/apache/cassandra/db/Columns$Serializer.serializeLargeSubsetSize(Ljava/util/Collection;ILorg/apache/cassandra/db/Columns;I)I
输入命令来查看正在运行的cassandra的 pid
1
ps -ef|grep cassandra
显示如图,pid 是 1818:
3.关闭Cassandra
刚才已经查到了 pid,现在可以使用命令杀掉这个pid对应的进程
1
kill-9 1818
4.查看状态
运行bin 目录下的 nodetool
1
2
3
4
[root@localhost bin]# ./nodetool status
# nodetool -Dcom.sun.jndi.rmiURLParsing=legacy status# ./nodetool -h ::FFFF:127.0.0.1 status
# 问题[root@cassandra bin]# ./nodetool status
nodetool: Failed to connect to '127.0.0.1:7199' - URISyntaxException: 'Malformed IPv6 address at index 7: rmi://[127.0.0.1]:7199'.# 解决办法[root@cassandra bin]# ./nodetool -Dcom.sun.jndi.rmiURLParsing=legacy status
[root@cassandra bin]# ./nodetool -h ::FFFF:127.0.0.1 status
5.客户端连接服务器
进入Cassandra的 bin 目录,输入
1
2
3
4
5
6
7
8
9
10
./cqlsh 192.168.202.156 9042
[root@cassandra bin]# ./cqlsh 192.168.202.156 9042
Python 2.7 support is deprecated. Install Python 3.6+ or set CQLSH_NO_WARN_PY2 to suppress this message.
Connected to Test Cluster at 192.168.202.156:9042
[cqlsh 6.0.0 | Cassandra 4.0.1 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cqlsh>