Rad4
Rad4

Reputation: 2384

Correct usage of nodetool repair command

What is the right method to run nodetool repair command? In a 3-node Cassandra cluster in single datacenter, should we run nodetool repair or nodetool repair -pr ?

As per the Cassandra apache document http://cassandra.apache.org/doc/latest/operating/repair.html,

"By default, repair will operate on all token ranges replicated by the node you’re running repair on, which will cause duplicate work if you run it on every node. The -pr flag will only repair the “primary” ranges on a node, so you can repair your entire cluster by running nodetool repair -pr on each node in a single datacenter."

Running "nodetool repair" takes more than 5 mins.But running "nodetool repair -pr" takes lesser time.So,I want to know if "nodetool repair -pr" is the correct choice for 3-node Cassandra cluster in single datacenter. Please advice.

Upvotes: 1

Views: 1135

Answers (2)

Zhong  Hu
Zhong Hu

Reputation: 272

Notice that if you use -pr, do not use -inc at the same time because these two are not recommended to be used together. So basically like other people suggests, before 2.2, on each node you can just run nodetool repair -pr; whereas, after 2.2, you'd better use nodetool repair -pr -full to suppress the incremental repair.

Upvotes: 1

Horia
Horia

Reputation: 2982

If you run repair periodically, the best way is to run -pr option, thus repairing only the primary token range. In that way, the whole ring will be repaired.

But if you didn't run repair until now, probably the best way will be to run a full repair and then maintenance repairs using -pr option.

Also, note that depending on your cassandra version, the repair behavior is changed. The default repair in 2.2 and afterwards is incremental. If you want to trigger a full repair you have to explicitly use -full option. For versions prior to 2.2, check the documentation.

Upvotes: 0

Related Questions