

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 疑難排解
<a name="bulk-upload-troubleshooting"></a>

資料上傳完成後，請檢查資料列是否已略過。若要這樣做，請導覽至來源 CSV 檔案的來源目錄，並搜尋具有下列名稱的檔案。

```
import_yourcsvfilename.err.timestamp.csv
```

cqlsh 會將任何略過的資料列寫入具有該名稱的檔案中。如果檔案存在於來源目錄中，且其中有資料，則這些資料列不會上傳至 Amazon Keyspaces。若要重試這些資料列，請先檢查上傳期間遇到的任何錯誤，並相應地調整資料。若要重試這些資料列，您可以重新執行程序。



**常見錯誤**  
未載入資料列的最常見原因是容量錯誤和剖析錯誤。

**將資料上傳至 Amazon Keyspaces 時發生無效的請求錯誤**

在下列範例中，來源資料表包含計數器資料欄，從 cqlsh `COPY`命令產生記錄的批次呼叫。Amazon Keyspaces 不支援已記錄的批次呼叫。

```
Failed to import 10 rows: InvalidRequest - Error from server: code=2200 [Invalid query] message=“Only UNLOGGED Batches are supported at this time.“,  will retry later, attempt 22 of 25
```

若要解決此錯誤，請使用 DSBulk 遷移資料。如需詳細資訊，請參閱[教學課程：使用 DSBulk 將資料載入 Amazon Keyspaces](dsbulk-upload.md)。

**將資料上傳至 Amazon Keyspaces 時發生剖析器錯誤**

下列範例顯示由於 而略過的資料列`ParseError`。

```
Failed to import 1 rows: ParseError - Invalid ... – 
```

若要解決此錯誤，您需要確定要匯入的資料符合 Amazon Keyspaces 中的資料表結構描述。檢閱匯入檔案是否有剖析錯誤。您可以使用 `INSERT`陳述式嘗試使用單一資料列來隔離錯誤。

**將資料上傳至 Amazon Keyspaces 時發生容量錯誤**

```
Failed to import 1 rows: WriteTimeout - Error from server: code=1100 [Coordinator node timed out waiting for replica nodes' responses]
 message="Operation timed out - received only 0 responses." info={'received_responses': 0, 'required_responses': 2, 'write_type': 'SIMPLE', 'consistency': 
 'LOCAL_QUORUM'}, will retry later, attempt 1 of 100
```

Amazon Keyspaces 使用 `ReadTimeout`和 `WriteTimeout`例外狀況來指示寫入請求何時因輸送量容量不足而失敗。為了協助診斷容量不足的例外狀況，Amazon Keyspaces 會在 Amazon CloudWatch 中發佈 `WriteThrottleEvents`和 `ReadThrottledEvents`指標。如需詳細資訊，請參閱[使用 Amazon CloudWatch 監控 Amazon Keyspaces](monitoring-cloudwatch.md)。

**將資料上傳至 Amazon Keyspaces 時的 cqlsh 錯誤**

為了協助對 cqlsh 錯誤進行疑難排解，請使用 `--debug`旗標重新執行失敗命令。

使用不相容的 cqlsh 版本時，您會看到下列錯誤。

```
AttributeError: 'NoneType' object has no attribute 'is_up'
Failed to import 3 rows: AttributeError - 'NoneType' object has no attribute 'is_up',  given up after 1 attempts
```

執行下列命令，確認已安裝正確的 cqlsh 版本。

```
cqlsh --version
```

您應該會看到類似以下內容的輸出。

```
cqlsh 5.0.1
```

如果您使用的是 Windows，請將 的所有執行個體取代`cqlsh`為 `cqlsh.bat`。例如，若要在 Windows 中檢查 cqlsh 的版本，請執行下列命令。

```
cqlsh.bat --version
```

cqlsh 用戶端從伺服器收到任何類型的連續三次錯誤後，與 Amazon Keyspaces 的連線會失敗。cqlsh 用戶端失敗，並顯示下列訊息。

```
Failed to import 1 rows: NoHostAvailable - , will retry later, attempt 3 of 100
```

若要解決此錯誤，您需要確定要匯入的資料符合 Amazon Keyspaces 中的資料表結構描述。檢閱匯入檔案是否有剖析錯誤。您可以使用 INSERT 陳述式來隔離錯誤，嘗試使用單一資料列。

用戶端會自動嘗試重新建立連線。