请教一下,tikv有没有什么好用的可视化工具?
有没有什么查看数据的手段?比如我想看全量数据,或者我不知道key但是看想部分数据?该如何操作呢
目前还没有,不过提供了各种语言的tikv clent实现。
https://github.com/tikv/client-go
可以通过这些客户端实现一下。
1 个赞
好的,了解~thx
请问下如何拉全量数据呢~看tikv的数据~
记录一下:
1.目前没有可视化工具
2.client查看数据可以通过如下方法,如果想要全量的数据 startkey和endkey传null即可全部scan
private Map<String, String> scan(String startKeyStr,String endKeyStr
) throws Exception {
System.out.println("scan/all api");
TiConfiguration conf = TiConfiguration.createRawDefault("xx.xx.xx.xx:2379");
TiSession session = TiSession.create(conf);
RawKVClient client = session.createRawClient();
ByteString startKey = null;
ByteString endKey = null;
if(startKeyStr != null){
startKey = ByteString.copyFromUtf8(startKeyStr);
}
if(endKeyStr != null){
endKey = ByteString.copyFromUtf8(endKeyStr);
}
Map<String, String> res = new HashMap<>();
int limit = 10;
while(true) {
List<Kvrpcpb.KvPair> list = client.scan(startKey, endKey, limit);
Key maxKey = Key.MIN;
for (Kvrpcpb.KvPair pair : list) {
System.out.println(pair);
res.put(pair.getKey().toStringUtf8(), pair.getValue().toStringUtf8());
Key currentKey = Key.toRawKey(pair.getKey());
if(currentKey.compareTo(maxKey) > 0) {
maxKey = currentKey;
}
}
if(list.size() < limit) {
break;
}
startKey = maxKey.next().toByteString();
}
// close
client.close();
session.close();
return res;
}
此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。