Tidb-lightning import error: get TSO failed

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb-lightning 执行导入报错 get TSO failed

| username: CAICAI

[TiDB Usage Environment] Test Environment
[TiDB Version]

Imported configuration file:

[lightning]

Log

level = “info”
file = “seller.log”

Check if the cluster meets the minimum requirements before starting, and check if the available storage space of TiKV is greater than 10% during operation.

check-requirements = true
meta-schema-name = “lightning_metadata”

In a mixed deployment, this size can be configured to 75% of the logical CPU count to limit CPU usage.

region-concurrency = 24

[tikv-importer]

“local”: This mode is used by default, suitable for data volumes above TB level, but the downstream TiDB cannot provide services during the import.

“tidb”: For data volumes below TB level, the tidb backend mode can also be used, and the downstream TiDB can provide services normally. For more information on backend modes, please refer to: https://docs.pingcap.com/tidb/stable/tidb-lightning-backends

backend = “local”

Set the temporary storage location for sorted key-value pairs. The target path must be an empty directory, and the directory space must be larger than the size of the dataset to be imported. It is recommended to set it to a different disk directory from data-source-dir and use flash media. Exclusive IO will achieve better import performance.

sorted-kv-dir = “/data/tidbtest/kvdir1”

The concurrency of writing KV data in physical import mode TiKV. When the network transmission speed between TiDB Lightning and TiKV exceeds 10Gbps, this value can be appropriately increased. The default is 16.

range-concurrency = 60

The number of KVs sent in a single request in physical import mode. The default is 3200.

send-kv-pairs = 6400

Whether to allow importing data into tables that already have data. The default value is false.

When using parallel import mode, since multiple TiDB Lightning instances import a table simultaneously, this switch must be set to true.

incremental-import = true

[mydumper]

Source data directory, i.e., the path where Dumpling saved the data in step 1.

data-source-dir = “/data/tools/sellerdata”
filter = [‘.’, ‘!mysql.', '!sys.’, ‘!INFORMATION_SCHEMA.', '!PERFORMANCE_SCHEMA.’, ‘!METRICS_SCHEMA.', '!INSPECTION_SCHEMA.’]

#[[mydumper.files]]

db schema file

#pattern = ‘(?i)^(?:[^/]*/)*seller-schema-create.sql’
#schema = “seller”
#type = “schema-schema”

#[[mydumper.files]]

table schema file

#pattern = ‘(?i)^(?:[^/]*/)*seller.purchase_buy_attr-schema.sql’
#schema = “seller”
table = “purchase_buy_attr”
#type = “sql”

#[[mydumper.files]]

Only import data files for purchase_buy_attr|purchase_buy_skus|quality_batch_attr|seller_pay_list and ignore other files

#pattern = ‘(?i)^(?:[^/]*/)seller.purchase_buy_attr..sql’
#schema = “seller”
table = “purchase_buy_attr”
#type = “sql”

[tidb]

Information of the target cluster

host = “tidb-tidb.dev.svc.yafex.test”
port = 4000
user = “root”
password = “”

Table schema information is obtained from TiDB’s “status port”.

status-port = 10080

Address of the cluster pd

pd-addr = “tidb-pd.dev.svc.yafex.test:2379”

Error reported at the start of import:
[2023/11/11 10:31:18.485 +08:00] [ERROR] [lightning.go:586] [“restore failed”] [error=“[Lightning:KV:ErrCreateKVClient]create kv client error: [PD:client:ErrClientGetTSO]get TSO failed, tso client is nil”]
[2023/11/11 10:31:18.485 +08:00] [ERROR] [main.go:103] [“tidb lightning encountered error stack info”] [error=“[Lightning:KV:ErrCreateKVClient]create kv client error: [PD:client:ErrClientGetTSO]get TSO failed, tso client is nil”]

The cluster is deployed with k8s. How can this error be resolved?

| username: Fly-bird | Original post link

Did you not obtain the TSO time? Is the PD status normal?

| username: zhanggame1 | Original post link

Can this PD address tidb-pd.dev.svc.yafex.test:2379 be accessed?

| username: CAICAI | Original post link

The status of PD is normal:

root@pu20k8st001001:/data/tools# kubectl get pods -n dev | grep tidb
tidb-discovery-6d4588847f-sbmm7            1/1     Running            0                  8d
tidb-pd-0                                  1/1     Running            1 (15h ago)        15h
tidb-pd-1                                  1/1     Running            0                  15h
tidb-pd-2                                  1/1     Running            1 (15h ago)        15h
tidb-tidb-0                                2/2     Running            0                  99d
tidb-tidb-1                                2/2     Running            0                  119d
tidb-tidb-2                                2/2     Running            0                  109d
tidb-tikv-0                                1/1     Running            10 (17m ago)       99d
tidb-tikv-1                                1/1     Running            74 (17h ago)       119d
tidb-tikv-2                                1/1     Running            111 (15h ago)      109d
tidb-tikv-3                                1/1     Running            91 (16m ago)       111d
tidb-tikv-4                                1/1     Running            1 (38h ago)        107d
| username: CAICAI | Original post link

The address tidb-pd.dev.svc.yafex.test can be pinged on the host.

| username: hey-hoho | Original post link

The machine running Lightning cannot connect to the PD network. Check if there is an issue with the network mapping of the pod.

| username: Jellybean | Original post link

Try replacing the domain addresses for accessing PD with IP addresses.

| username: zhanggame1 | Original post link

You can curl this address, the key is whether the port is accessible.

| username: andone | Original post link

Try using an IP address instead.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.