簡體   English   中英

如何使用 Datastax 批量加載程序(Ubuntu)將數據加載到 Apache Cassandra?

[英]How to load data into Apache Cassandra with Datastax Bulk loader (Ubuntu)?

當我想將數據上傳到我的“測試集群”到 Apache Cassandra 中時,我打開終端,然后:

export PATH=/home/mypc/dsbulk-1.7.0/bin:$PATH

source ~/.bashrc

dsbulk load -url /home/mypc/Desktop/test/file.csv -k keyspace_test -t table_test

但...

At least 1 record does not match the provided schema.mapping or schema.query. Please check that the connector configuration and the schema configuration are correct.
Operation LOAD_20201105-103000-577734 aborted: Too many errors, the maximum allowed is 100.

total | failed | rows/s | p50ms | p99ms | p999ms | batches
  104 |    104 |      0 |  0,00 |  0,00 |   0,00 |    0,00

Rejected records can be found in the following file(s): mapping.bad
Errors are detailed in the following file(s): mapping-errors.log
Last processed positions can be found in positions.txt

這是什么意思? 為什么我無法加載?

謝謝!

錯誤是您沒有提供 CSV 數據和表之間的映射。 可以通過兩種方式完成:

  1. 如果 CSV 文件的標題與 Cassandra 中的列名匹配,則使用-header true
  2. 使用-m選項顯式提供映射(請參閱文檔) - 您需要將 CSV 列映射到 Cassandra 列。

關於 DSBulk 使用的不同方面,有一系列非常好的博客文章:

其中前兩個詳細介紹了數據加載

這意味着 CSV 輸入文件中的列與table_test表中的列不匹配。 您可以在mapping-errors.log中獲取架構不匹配的詳細信息,以便了解哪些列存在問題。

由於 CSV 列與表模式不匹配,因此您需要通過指定--schema.mapping標志手動映射它們。

有關詳細信息,請參閱DSBulk 常用選項頁面。 您還可以查看此博客文章中的模式映射示例。 干杯!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM