Console

Overview

The AtlasDB Console is intended for use by engineers interested in examining the internals of a running AtlasDB instance. It supports both simple and complex queries on all tables in AtlasDB, as well as put/get/delete requests, tabular pretty print, and transactions. The primary high-level goals for AtlasDB Console are simplicity and ease of use. You can query AtlasDB Console using a Groovy shell or write scripts as needed to obtain the information you are interested in. There is a lot of functionality built into this interface and you are able to perform both safe and destructive (read dangerous) operations.

Using Groovy in AtlasDB Console

This section contains tips and tricks for navigating GroovyShell and using Groovy to its fullest extent in AtlasDB Console.

  • Type :help or :h to get usage help.

  • Type help() to examine all AtlasDB related functions available.

  • Type :exit or :x to exit GroovyShell.

  • Type :clear or :c to exit a command block.

  • To use an external editor to write a script without exiting GroovyShell, type :edit. Before you use this command for the first time, you will need to set your default editor (either vim or emacs) using the command :set editor vim or :set editor emacs.

  • To load and run a Groovy script, type :load <PATH-TO-FILE>/<FILENAME>.groovy. The file you load must end with the .groovy extension.

  • To record your AtlasDB Console session, type :record start <PATH-TO-RECORD-FILE>/<FILENAME>.txt. You can also just type :record start and GroovyShell will save your session to a .txt file in your /tmp directory. GroovyShell will record anything typed on the command line or returned by a command to the file. You can end the recording by typing :record stop or review the name of the record file and its current size by typing :record status.

  • To view a list of all of the commands you have executed so far, type :history.

  • If you want the editor to print out the last result (e.g. printing the results of a command like table('my_table').getRange() without a print or pp command), type :set show-last-result true to turn it on. This option is disabled by default.

  • You can run scripts on load by setting the –script flag like this: ./bin/unix/atlasDBConsole-script <PATH-TO-FILE>/<FILENAME>.groovy. The script you load must end with the .groovy extension. This will load the script, run it, and exit the console. To keep the console running after the script executes, run ./bin/unix/atlasDBConsole <PATH-TO-FILE>/<FILENAME>.groovy (without the -script flag).

Writing Scripts in Groovy

You can find a quick introduction to Groovy here. For a more in-depth guide, see the latest official Groovy docs.