To learn CLI commands type "help".
HammerDB CLI v4.6 Copyright (C) 2003-2022 Steve Shaw Type "help" for a list of commands The xml is well-formed, applying configuration hammerdb>help HammerDB v4.1 CLI Help Index Type "help command" for more details on specific commands below buildschema deleteschema clearscript customscript datagenrun dbset dgset diset distributescript jobs librarycheck loadscript print quit steprun switchmode tcset tcstart tcstatus tcstop vucomplete vucreate vudestroy vurun vuset vustatus hammerdb>
The commands have the following functionality.
Table 9.2. CLI commands
|buildschema||Usage: buildschema||Runs the schema build for the database and benchmark selected with dbset and variables selected with diset. Equivalent to the Build command in the graphical interface. Note that the buildschema command will assume the "yes" reply to the Yes or no prompt to proceed with the schema build. This is to prevent the stalling of CLI scripts during builds.|
|deleteschema||Usage: deleteschema||Runs the schema delete for the database and benchmark selected with dbset and variables selected with diset. Equivalent to the Delete command in the graphical interface.|
|clearscript||Usage: clearscript||Clears the script. Equivalent to the "Clear the Screen" button in the graphical interface.|
|customscript||Usage: customscript scriptname.tcl||Load an external script. Equivalent to the "Open Existing File" button in the graphical interface.|
|datagenrun||Usage: datagenrun||Run Data Generation. Equivalent to the Generate option in the graphical interface.|
|dbset||Usage: dbset [db|bm] value||Sets the database (db) or benchmark (bm). Equivalent to the Benchmark Menu in the graphical interface. Database value is set by the database prefix in the XML configuration.|
|dgset||Usage: dgset [vu|ware|directory]||Set the Datagen options. Equivalent to the Datagen Options dialog in the graphical interface.|
|diset||Usage: diset dict key value||Set the dictionary variables for the current database. Equivalent to the Schema Build and Driver Options windows in the graphical interface. Use "print dict" to see what these variables area and diset to change: Example: hammerdb>diset tpcc count_ware 10 Changed tpcc:count_ware from 1 to 10 for Oracle.|
|distributescript||Usage: distributescript||In Master mode distributes the script loaded by Master to the connected Slaves.|
|jobs (alias job)||Usage: jobs : jobs [jobid|result|timestamp] : jobs format [ text | JSON ] : jobs disable [ 0 | 1 ] : jobs jobid [bm|db|delete|dict|result|status|tcount|timestamp|timing|vuid] : jobs jobid timing vuid||The jobs command can be used to enable or disable jobs functionality. If enabled it records the output, configuration, result, timing and transactions of a workload for retrieval at a later point identified by a jobid.|
|librarycheck||Usage: librarycheck||Attempts to load the vendor provided 3rd party library for all databases and reports whether the attempt was successful.|
|loadscript||Usage: loadscript||Load the script for the database and benchmark set with dbset and the dictionary variables set with diset. Use "print script" to see the script that is loaded. Equivalent to loading a Driver Script in the Script Editor window in the graphical interface.|
|Usage: print [db|bm|dict|script|vuconf |vucreated|vustatus|datagen]||prints the current configuration: db: database bm: benchmark dict: the dictionary for the current database ie all active variables script: the loaded script vuconf: the virtual user configuration vucreated: the number of virtual users created vustatus: the status of the virtual users datagen : the configuration to build when datagen is run|
|quit||Usage: quit Shuts down the HammerDB CLI.||Calls the exit command and terminates the CLI interface|
|steprun||Usage: steprun||Automatically switches into Primary mode, creates and connects the multiple Replicas defined in config/steps.xml and starts the Primary and Replica Virtual Users at the defined intervals creating a step workload. Both Primary and Replicas will exit on completion.|
|switchmode||Usage: switchmode [mode] ?PrimaryID? ?PrimaryHostname?||Changes the remote mode to Primary, Replica or Local. When Master it will report an id and a hostname. Equivalent to the Mode option in the graphical interface. Mode to switch to must be one of Local, Primary or Replica. If Mode is Replica then the ID and Hostname of the Primary to connect to must be given.|
|tcset||Usage: tcset [refreshrate|logtotemp|unique|timestamps]||Configure the transaction counter options. Equivalent to the Transaction Counter Options window in the graphical interface.|
|tcstart||Usage: tcstart||Starts the Transaction Counter.|
|tcstatus||Usage: tcstatus||Checks the status of the Transaction Counter.|
|tcstop||Usage: tcstop||Stops the Transaction Counter.|
|vucomplete||Usage: vucomplete||Returns "true" or "false" depending on whether all virtual users that started a workload have completed regardless of whether the status was "FINISH SUCCESS" or "FINISH FAILED".|
|vucreate||Usage: vucreate||Create the virtual users. Equivalent to the Virtual User Create option in the graphical interface. Use "print vucreated" to see the number created, vustatus to see the status and vucomplete to see whether all active virtual users have finished the workload. A script must be loaded before virtual users can be created.|
|vudestroy||Usage: vudestroy||Destroy the virtual users. Equivalent to the Destroy Virtual Users button in the graphical interface that replaces the Create Virtual Users button after virtual user creation.|
|vurun||Usage: vurun||Send the loaded script to the created virtual users for execution. Equivalent to the Run command in the graphical interface. In the CLI returns a jobid to access the workloads output and configuration.|
|vuset||Usage: vuset [vu|delay|repeat|iterations|showoutput |logtotemp|unique|nobuff|timestamps||Configure the virtual user options. Equivalent to the Virtual User Options window in the graphical interface. vuset expects an integer or the string "vcpu". Where "vcpu" is specified the vu value will be set to the number of logical CPUs detected on the system where HammerDB is running.|
|vustatus||Usage: vustatus||Show the status of virtual users. Status will be "WAIT IDLE" for virtual users that are created but not running a workload,"RUNNING" for virtual users that are running a workload, "FINISH SUCCESS" for virtual users that completed successfully or "FINISH FAILED" for virtual users that encountered an error.|
Note that the runtimer and waittocomplete parameters have been deprecated from v4.6. For this reason an additional configuration parameter of keepalive_margin with a default value of 10 seconds has been added to generic.xml in the commandline section to modify the additional time that HammerDB will wait after completion before terminating the workload. This can be useful if for example gathering timing data for event driven scaling workloads with a large number of asynchronous clients.
The HammerDB commands in Python are identical to the ones in the default Tcl mode except accessed as Python functions with either string or integer arguments.
C:\Program Files\HammerDB-4.6>hammerdbcli py HammerDB CLI v4.6 Copyright (C) 2003-2022 Steve Shaw Type "help()" for a list of commands hammerdb>>>help() HammerDB v4.6 CLI Help Index Type "help command" for more details on specific commands below buildschema deleteschema clearscript customscript datagenrun dbset dgset diset distributescript jobs librarycheck loadscript print quit steprun switchmode tcset tcstart tcstatus tcstop vucomplete vucreate vudestroy vurun vuset vustatus hammerdb>>>vuset('vu',10) hammerdb>>> hammerdb>>>print('vuconf') Virtual Users = 10 User Delay(ms) = 500 Repeat Delay(ms) = 500 Iterations = 1 Show Output = 1 Log Output = 0 Unique Log Name = 0 No Log Buffer = 0 Log Timestamps = 0 hammerdb>>>