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一直报错
[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]
How many TiKV nodes have you started? There might not be enough nodes.
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.
TiKV has 3 nodes purchased.
Using tikv-client-java version 3.2.0
It is caused by this error.
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.
There is no problem operating the database with the client. I’ll try switching to a different version.
Changed to version 3.3.5. Reporting this issue. The leader node on Alibaba Cloud is this one.
I couldn’t figure out the error. If changing the version helps, you can try changing it again to find a pattern.
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.
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?
I can’t access the intranet. I see the logs directly showing the intranet address.
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.
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?
I just want to use TiDB CDC and use TiKV to get data.
You can search the documentation for how to use the SDK. I haven’t used the SDK either.
Are you running the code locally? Because I see you used localhost, is the TiKV set up locally?