Errors Occur When Using tikv-client-java 3.2.0 to Operate TiKV

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

Original topic: 用tikv-client-java 3.2.0操作tikv一直报错

| username: TiDBer_Xys4hD00

[TiDB Usage Environment] Testing
[TiDB Version] Alibaba Cloud 6.5
[Reproduction Path]

[Encountered Problem: Problem Phenomenon and Impact]
Constantly reporting errors

[Attachments: Screenshots/Logs/Monitoring]

| username: 小于同学 | Original post link

How many TiKV nodes have you started? There might not be enough nodes.

| username: TiDBer_jYQINSnf | Original post link

What version of the SDK are you using? The line numbers in the master code don’t match. You can also check the SDK to get an idea, for example, if it can’t connect to PD or can’t get TiKV from PD. It might be that the SDK doesn’t handle errors well and just panics.

| username: TiDBer_Xys4hD00 | Original post link

TiKV has 3 nodes purchased.

| username: TiDBer_Xys4hD00 | Original post link

Using tikv-client-java version 3.2.0

| username: TiDBer_Xys4hD00 | Original post link

PD can be accessed.

| username: TiDBer_Xys4hD00 | Original post link

It is caused by this error.

| username: 江湖故人 | Original post link

Using tikv-client-java version 3.2.0

There shouldn’t be any issues with using the database client on the application server, right?
Try using a newer version of tikv-client-java.

| username: TiDBer_Xys4hD00 | Original post link

There is no problem operating the database with the client. I’ll try switching to a different version.

| username: TiDBer_Xys4hD00 | Original post link

Changed to version 3.3.5. Reporting this issue. The leader node on Alibaba Cloud is this one.

| username: redgame | Original post link

I couldn’t figure out the error. If changing the version helps, you can try changing it again to find a pattern.

| username: TiDBer_Xys4hD00 | Original post link

Is it because I initially connected to the public network to obtain the address? Later, the client used the internal network to query data, so it couldn’t connect and reported an error. Switching to version 3.5.5 still results in the same error.

| username: TiDBer_jYQINSnf | Original post link

This should not be much related to the SDK. You are connecting to the internal network’s PD from an external network. This PD is not the leader, and when it forwards to the leader, you cannot access the internal network address?

| username: TiDBer_Xys4hD00 | Original post link

I can’t access the intranet. I see the logs directly showing the intranet address.

| username: TiDBer_jYQINSnf | Original post link

So, changing the SDK doesn’t matter much; the key is that the network must be accessible.

I’m not familiar with how to configure Alibaba’s setup, just giving a suggestion.

--advertise-client-urls

--advertise-peer-urls

See if you can configure these two for PD, so that all PDs know what the external network address is. When responding to you, it will reply with the external network address corresponding to the leader.

| username: Billmay表妹 | Original post link

RawKV? Not using TiDB?

| username: TiDBer_Xys4hD00 | Original post link

I placed it on the intranet and it works. I would like to ask, I created a new database test in the database. I created a new table. After inserting data, how can I scan this data?

| username: TiDBer_Xys4hD00 | Original post link

I just want to use TiDB CDC and use TiKV to get data.

| username: TiDBer_jYQINSnf | Original post link

You can search the documentation for how to use the SDK. I haven’t used the SDK either.

| username: 表渣渣渣 | Original post link

Are you running the code locally? Because I see you used localhost, is the TiKV set up locally?