Java客户端工具

Pegasus Java客户端还提供了PegasusCli工具,支持简单的读写操作。

使用mvn编译:

  1. mvn clean package -DskipTests

编译后,在target文件夹下可以找到压缩包pegasus-client-{version}-bin.tar.gz,解压后得到pegasus-client-{version}文件夹,进入该文件夹,就可以找到PegasusCli工具。

用法:

  1. USAGE: PegasusCli <config-path> <table-name> <op-name> ...
  2. <config-path> should be:
  3. - zookeeper path : zk://host1:port1,host2:port2,host3:port3/path/to/config
  4. - local file path : file:///path/to/config
  5. - java resource : resource:///path/to/config
  6. <op-name> should be:
  7. - get <hash-key> <sort-key>
  8. - set <hash-key> <sort-key> <value> [ttl_seconds]
  9. - del <hash-key> <sort-key>
  10. - multi_get <hash_key> [sort_key...]
  11. - multi_get_sort_keys <hash_key>
  12. - multi_set <hash_key> <sort_key> <value> [sort_key value...]
  13. - multi_del <hash_key> <sort_key> [sort_key...]
  14. - incr <hash_key> <sort_key> [increment]
  15. - scan <hash_key> [start_sort_key] [stop_sort_key] [max_count]
  16. - scan_all [max_count]
  17. - copy_data <target_cluster_config_path> <target_table_name> [read_uncompress_type(none|zstd)] [write_compress_type(none|zstd)] [max_count]
  18. For example:
  19. PegasusCli file://./pegasus.properties temp get hash_key sort_key
  20. PegasusCli file://./pegasus.properties temp scan hash_key '' '' 100