Plasma GitLab Archive
Projects Blog Knowledge

Cmd_plasma_kv



plasma_kv - command-line access to PlasmaKV databases

Synopsis

plasma_kv create   -db file [-max-key-length n]
plasma_kv iterate  -db file [-count]
plasma_kv lookup   -db file ( key ... | -stdin )
plasma_kv insert   -db file ( key | -files | -keys-and-files )
plasma_kv delete   -db file ( key ... | -stdin )
plasma_kv vacuum   -db file

General options for all or many commands:

  -cluster <name> 
  -namenode <host>:<port>
  -rep <n>
  -auth <name>

Description

The utility plasma_kv accesses PlasmaKV database files which are stored in PlasmaFS. For an overview of the system please refer to Plasmakv_intro.

Selecting the cluster

The PlasmaFS cluster to access is determined in the same way as for the plasma command, see Cmd_plasma for documentation. The -cluster and -namenode options work as described there. Also, the ~/.plasmafs file is taken into account.

Authentication

Again, this works in the same ways as for the plasma command.

create subcommand

This command creates a new PlasmaKV database, which consists of three files.

Synopsis:

plasma_kv create   -db file [-max-key-length n]

The file is here an absolute PlasmaFS path without suffix.

Options:

  • -max-key-length n: The limit for the key length is set to n

iterate subcommand

This command iterates over the keys of a PlasmaKV database in lexicographic order, and outputs the keys to stdout.

Synopsis:

plasma_kv iterate  -db file [-count]

Options:

  • -count: Instead of printing the keys, only the number of keys is counted

lookup subcommand

This command looks keys up, and prints the corresponding values.

Synopsis:

plasma_kv lookup   -db file ( key ... | -stdin )

The keys to look up are either given as arguments, or the switch -stdin directs to read the keys from stdin, one key a line.

Options:

  • -not-found <string>: If a key cannot be found, this string is printed instead of the value. The default is "NOT_FOUND".
  • -no-lf: Prevents that a linefeed is appended to the printed values
  • -interval n: In -stdin mode, it is possible that the sequence of lookups take an undefinite period of time. The -interval option directs to check whether the database has been modified every n seconds, and to reopen the database in this case.

insert subcommand

This command inserts new keys, or updates the values of existing keys.

Synopsis:

plasma_kv insert   -db file ( key | -files | -keys-and-files )

If only a key is given on the command-line, the value is read from stdin, and the key/value pair is inserted.

If the switch -files is set, a list of file names is read from stdin, one name a line. The file names are the keys to insert, and the values are the contents of the files.

If the switch -keys-and-files is set, a list of lines is read from stdin. Each line contains the key and a file name, separated by a TAB character. The value of the key on a line are the contents of the file.

delete subcommand

This command deletes keys from the database.

Synopsis:

plasma_kv delete   -db file ( key ... | -stdin )

The keys are either given on the command-line, or the -stdin switch directs to read the keys from stdin, one key a line.

vacuum subcommand

This command reclaims unused space in the database (from deletions).

Synopsis:

plasma_kv vacuum   -db file

The command is implemented by iterating over all entries, and writing a new version of the database where all deleted entries are skipped. It is required that enough PlasmaFS space is available.

A vaccum run can be done in parallel to read accesses.

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml