Basic Cluster Operations
Cluster Information Acquisition
The cassandra project official did not provide us with a central place to get information about the cluster, but since cassandra is peer to peer and cluster-type nodes can get the whole view of the cluster through gossip, if you want to get the whole view information of the cluster, you can also get the information we will get through the single-node nodetool tool.The following categories:
Displays basic information about the cluster, including: the name of the cluster (configured in cassandra.yaml), the Snitch type, whether to turn on dynamicendpointsnitch, cluster partitioner, schmema version, since we synchronize information through gossip, it is possible that some nodes are inconsistent with another node's schema version at one time and can be determined by this command.
Cluster Information: Name: Test Cluster Snitch: org.apache.cassandra.locator.SimpleSnitch DynamicEndPointSnitch: enabled Partitioner: org.apache.cassandra.dht.Murmur3Partitioner Schema versions: ea63e099-37c5-3d7b-9ace-32f4c833653d: [127.0.0.1]
2../nodetool describering keyspace
Print out the given keyspace and the token ring information associated with it, where my token_number is set to 2 for easy display of information, which can be obtained from this command if we want to know the token information associated with a keyspace.
Schema Version:ea63e099-37c5-3d7b-9ace-32f4c833653d TokenRange: TokenRange(start_token:-7410294471124200252, end_token:2438009623152110684, endpoints:[127.0.0.1], rpc_endpoints:[127.0.0.1], endpoint_details:[EndpointDetails(host:127.0.0.1, datacenter:datacenter1, rack:rack1)]) TokenRange(start_token:2438009623152110684, end_token:-7410294471124200252, endpoints:[127.0.0.1], rpc_endpoints:[127.0.0.1], endpoint_details:[EndpointDetails(host:127.0.0.1, datacenter:datacenter1, rack:rack1)])
Show the gossip information of the cluster. The following shows the output of gossip information related to each node in a three-node cluster:
/192.168.0.250 generation:1578559963 heartbeat:289 STATUS:18:NORMAL,-1000610182680759021 LOAD:273:111238.0 SCHEMA:20:ea63e099-37c5-3d7b-9ace-32f4c833653d DC:6:datacenter1 RACK:8:rack1 RELEASE_VERSION:4:3.11.4 RPC_ADDRESS:3:127.0.0.1 NET_VERSION:1:11 HOST_ID:2:012ed1eb-0dac-4562-9812-415a7b58e6d6 RPC_READY:32:true TOKENS:17:<hidden> /192.168.0.245 generation:1578560055 heartbeat:196 STATUS:58:NORMAL,-112189776392027338 LOAD:153:115665.0 SCHEMA:20:ea63e099-37c5-3d7b-9ace-32f4c833653d DC:6:datacenter1 RACK:8:rack1 RELEASE_VERSION:4:3.11.4 RPC_ADDRESS:3:127.0.0.1 NET_VERSION:1:11 HOST_ID:2:0dbd4aca-7dd4-4833-b3db-c7d9dda0aef9 RPC_READY:68:true TOKENS:57:<hidden> /192.168.0.246 generation:1578559991 heartbeat:260 STATUS:56:NORMAL,-1045048566066926798 LOAD:213:91038.0 SCHEMA:18:ea63e099-37c5-3d7b-9ace-32f4c833653d DC:6:datacenter1 RACK:8:rack1 RELEASE_VERSION:4:3.11.4 RPC_ADDRESS:3:127.0.0.1 NET_VERSION:1:11 HOST_ID:2:3ca695aa-edd2-435c-b9ee-89e143648351 RPC_READY:66:true TOKENS:55:<hidden>
The above information represents the related gossip information corresponding to the three nodes of the cluster species, and the relevant information meaning is explained under the first node:
- The first line, ip 192.168.0.250, represents gossip interactive ip information for the corresponding node.
- Generation represents the associated generation information for each node, which is part of the interactive information, initially in seconds of the current time (from UTC time in 1970 to now);
- Heatbeat indicates how many gossip interactions have been performed under the current generation. By default, the gossip interaction task is active every 1s, which seems to be 289 seconds.
- The rest is information about the state of the cluster: Inside Cassandra are VersionedValue s in applicationstate, as shown in the following figure:
What we can see is that the next modules are string0:number0:string1, where string0 is in the format of STATUS, LOAD, SCHEMA, and so on. Number0 is the version number that adds 1 to each change of these states. We mainly introduce the meaning of string1; however, string0 and number0 are not important.
- STATUS: Represents the state of the corresponding ip node, there are nine states (version 3.11.4 code), BOOT, BOOT_REPLACE, NORMAL, shutdown, removing, removed, LEAVING, LEFT, MOVING;
- LOAD: Represents the disk storage capacity of the node corresponding to the node in byte;
- SCHEMA: All table s under schema keyspace above the corresponding node are converted into a UUID by sequentially calculating an md5 value;
- DC: The datacenter to which the corresponding section belongs;
- RACK: the rack to which the corresponding node belongs;
- RELEASE_VERSION: The release package version number of the node machine;
- RPC_ADDRESS: Address of RPC
- NET_VERSION: This is mainly our network version number. If force uses 3.0 protocol version, it is 10, otherwise it is 11;
- HOST_ID: The hostid of the node, calculated based on ip, etc. of the corresponding node
- RPC_READY: If port 9042 or port 9142 (ssl) rpc is ready to be initialized, the receive response is true;
- tokens: tokens originally responsible for the corresponding node, but hindden when shown here.
Show the token ring ring ring ring information for the cluster, and since I use the default 256 for the vnode here, only some of the data is listed:
Datacenter: datacenter1 ========== Address Rack Status State Load Owns Token 9171192753316195244 192.168.0.245 rack1 Up Normal 266.49 KiB 64.99% -9183757132875531958 192.168.0.250 rack1 Up Normal 242.16 KiB 70.75% -9159199665119898622 192.168.0.250 rack1 Up Normal 242.16 KiB 70.75% -9135911702874518408 192.168.0.250 rack1 Up Normal 242.16 KiB 70.75% -9120077450536389482 192.168.0.246 rack1 Up Normal 238.16 KiB 64.26% -9106101311114100850 192.168.0.246 rack1 Up Normal 238.16 KiB 64.26% -9069141338515824351
- Datacenter: The name of the corresponding datacenter, which is used by default;
- Address, Rack: Represents the corresponding node and subordinate rack information;
- Status, State: The state of the corresponding node: Up, Down;Normal, leaving, and so on;
- Load: Load information for the corresponding node of the cluster, refer to the output information of gossip info above;
- Owns: What percentage of the entire data range is the tokens that this ip is responsible for
- Token: Which tokens are responsible for