Cassandra 常用命令之 nodetool repair

來源:互聯網
上載者:User


nodetool repair 顧名思義就是修複,這是nodetool中一個非常重要的操作。當我們對資料有修改或刪除動作時,或定期執行repair操作,以保持各個節點的一致性。 基本格式
nodetool [(-h <host> | --host <host>)] [(-p <port> | --port <port>)]
     [(-pw password | --password password)]
     [(-pwf passwordFilePath | --password-file passwordFilePath)]
     [(-u username | --username username)] repair
     [(-dc specific_dc | --in-dc specific_dc)...]
     [(-dcpar | --dc-parallel)] [(-et end_token | --end-token end_token)]
     [(-full | --full)]
     [(-hosts specific_host | --in-hosts specific_host)...]
     [(-j job_threads | --job-threads job_threads)]
     [(-local | --in-local-dc)] [(-pr | --partitioner-range)]
     [(-seq | --sequential)]
     [(-st start_token | --start-token start_token)] [(-tr | --trace)]
     [--] [keyspace tables...]

這裡要注意的是這些參數是有順序的,有些只能在repair,有些只能在repair後,哥一開始沒注意這些順序,走了很多彎路。
選項

hort Long Description
-h --host Hostname or IP address.
-p --port Port number.
-pwf --password-file Password file path.
-pw --password Password.
-u --username Remote JMX agent username.
-dc specific_dc --in-dc specific_dc Repair to nodes in the named datacenter (specific_dc).
-dcpar --dc-parallel Repair datacenters in parallel, one node per datacenter at a time.
-et end_token --end-tokenend_token Token UUID. Repair a range of nodes starting with the first token (see -st) and ending with this token (end_token). Use -hosts to specify neighbor nodes.
-full --full Do a full repair.
-h host_name --host host_name Node host name or IP address.
-hosts specific_host --in-hostsspecific_host Repair specific hosts.
-j job_threads --job-threadsjob_threads Number of threads (job_threads) to run repair jobs. Usually the number of tables to repair concurrently. Be aware that increasing this setting puts more load on repairing nodes. (Default: 1, maximum: 4)
-local --in-local-dc Use to only repair nodes in the same datacenter.
-pr --partitioner-range Run a repair on the partition ranges that are primary on a replica.
-seq start_token --sequentialstart_token Run a sequential repair.
-st start_token --start-tokenstart_token Specify the token (start_token) at which the repair range starts.
-tr --trace Trace the repair. Traces are logged tosystem_traces.events.
keyspace Name of keyspace.
tables One or more table names, separated by a space.
-- Separates an option from an argument that could be mistaken for a option.

樣本:

在當前節點,順序修複所有的keyspaces
./nodetool repair -seq


修複當前所在的資料中心(data_center),該命令只能在當前資料中心使用。
./nodetool repair -dc DC1


如果想修複某一段ring的資料(相對於全部修複,話費時間更少),就用-st(即start_token) -et(即end_token),這對token必須是同一個node,且有大小順序。查看ring的命令用 repair ring

./nodetool repair -st 7521963415957825786 -et 8097903535872843286


只修複range落在該節點的master資料
./nodetool repair -pr



原文地址:http://docs.datastax.com/en/cassandra/3.0/cassandra/tools/toolsRepair.html 參考文章:http://zhaoyanblog.com/archives/649.html


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.