0

間違って投稿した場合は、ここにお知らせください。(注: KairosDB は Cassandra の上にあります。Hector を使用します)。

KairosDB Java クライアントを使用して、大量のサンプル データをデータストアにダンプしています。私は現在600万を投棄しており、次の方法ですべてを削除しようとしています:

public static void purgeData(String metricsType, HttpClient c, int num, TimeUnit units){
    try {
        System.out.println("Beginning method");
        c = new HttpClient("http://localhost:8080/api/v1/datapoints/delete");
        QueryBuilder builder = QueryBuilder.getInstance();
        System.out.println("Preparing to delete info");
        builder.setStart(20, TimeUnit.MONTHS).setEnd(1, TimeUnit.SECONDS).addMetric(metricsType);
        System.out.println("Attempted to delete info");
        QueryResponse response = c.query(builder);
        //System.out.println("JSON: " + response.getJson());

    } catch (Exception e) {
        System.out.println("Adding data points produced an error");
        e.printStackTrace();
    }
}

一度にすべてのデータを削除しようとするためだけに、時間間隔パラメーターを削除したことに注意してください。

このメソッドを実行すると、ポイントは削除されないように見えます。JSON 形式のデータを使用してクエリをカールすることを選択し、「すべてのホスト プールがダウンとマークされました。再試行の負荷がクライアントにプッシュされました」という HectorException を受け取りました。

私の個人的な結論は、一度に削除するには 600 万は多すぎるということです。一度にピースを削除することを考えていましたが、KDB Java クライアント側から削除する行数を制限する方法がわかりません。KairosDB が本番環境で使用されていることは知っています。Java クライアントを使用して大量のデータを効果的に削除するにはどうすればよいですか?

ありがとうございました!

4

2 に答える 2

0

6 million datapoints to delete at once should not make any problem.

This exception is weird, it utually means tht Hector could not communicate with cassandra. Did you check that everything's all right ion KairosDB and cassandra log files? Are all configured coordinators in kairosdb.properties of the cluster alive?

If it's not due to cassandra, I recommend raisning an issue on KairosDB github for your problem, associating your JSON of the query and the log of KairosDB.

There are two ways of deleting data in kairosDB.

A) If you need to delete all datapoints for a given metric, you can just use the delete metric API, it calls the same method in the background so expecte the same results. However it will be much faster because you make sure all matching rows are deleted from Cassandra instead of individual cells.

B) If you need to delete only some datapoints for one metric, then you are already using the right method.

Before going further, I see that you don't define tags in your delete query so you would delete all datapoints for all series of this metric during the time interval... Is it what you want to do?

Last, to answer your questions, we are doing delete operations on large amounts of data (batch reinserts of millions of samples, we delete all the matching series for the time interval then we reinsert). Our operations work on large amounts of metrics (thousands of them), so the delete query is very large but works pretty well, we did not handle millions of points on the same metric, but unless you really have only one series the results should be the same.

If the millions samples to delete appear to be the problem (I doubt it) you can try the following : split your delete query by several time intervals (put several times the same metric in your delete query but with fractions of the total time interval), so you would reduce the amount of samples to delete in one batch.

I hope this helps.

Loic

于 2015-07-29T07:53:09.583 に答える
0

cqlsh または cassandra-cli を使用して、KairosDB テーブル (data_points、row_key_index、string_index) を切り捨てることができます。それが問題を引き起こすかどうかを知るには、私は KairosDB に十分に精通していません。

> truncate {your keyspace}.data_points;

完了するまでに数秒かかる場合があります。

于 2015-07-23T22:11:15.870 に答える