For MySQL
This section uses the TPC-H model for MySQL as an example.
- Switch to the installation directory.
cd HammerDB-3.2

- Run the test tool.
You can run the help command to view the help information.
1./hammerdbcli

Table 1 Common commands Command
Description
buildschema
Creates a database table and imports data based on the configuration.
datagenrun
Generates the tbl data list.
dbset
Configures database options, including the database type and test model.
dgset
Configures the tbl data parameters, including the number of concurrent data generation tasks, data volume, and data storage path.
diset
Configures table creation parameters, such as database server addresses and database validation information, data volume, and so on.
librarychek
Performs the dependency verification.
loadscript
Loads the test parameters.
print
Prints the configuration information.
quit
Quits the tool. The original configuration is automatically cleared when you exit the tool after configuration on the CLI.
vucreate
Creates a task.
vudestroy
Stops a task.
vurun
Runs a task.
vuset
Sets task running parameters, such as the number of concurrent tasks and log configuration.
vustatus
Views the task execution status.
- Run the following commands in sequence to load data:
dbset db mysql dbset bm tpc-h diset connection mysql_host 127.0.0.1 diset tpch mysql_tpch_user root diset tpch mysql_tpch_pass 123456 diset tpch mysql_tpch_storage_engine innodb diset tpch mysql_tpch_dbase mysql_tpch diset tpch mysql_scale_fact 1 diset tpch mysql_num_tpch_threads 30
Command
Description
dbset db mysql
Configures the database type.
dbset bm tpc-h
Configures the test model.
diset connection mysql_host 127.0.0.1
Configures the database service address. The default value is 127.0.0.1.
diset tpch mysql_tpch_user root
Configures the database administrator. The default value is root.
diset tpch mysql_tpch_pass 123456
Configures the password of the database administrator.
diset tpch mysql_tpch_storage_engine innodb
The default database engine is MyISAM.
diset tpch mysql_tpch_dbase mysql_tpch
Configures the database for the database administrator.
diset tpch mysql_scale_fact 1
Configures data volume. The default value is 1.
diset tpch mysql_num_tpch_threads 30
Configures the concurrency.

- View the configuration information.
print dict

mysql_tpch_user, mysql_tpch_pass, and mysql_tpch_dbase are default test databases. Ensure that no user or database with the same name exists on the database server. If such a user or database exists, delete it or run the diset command to modify related parameters.
buildschema

If message "ALL VIRTUAL USERS COMPLETE" is returned, the data is imported successfully.
- Run the following command:
vustatus vudestroy

- View the configuration information.
- Perform the test.
vuset vu 5 vuset showoutput 1 vuset logtotemp 1 vuset unique 1 print vuconf
Command
Description
vuset vu 5
Configures the number of concurrent tasks.
vuset showoutput 1
Enables logging.
vuset logtotemp 1
Enables the function of automatically saving logs to /tmp.
vuset unique 1
Configures log uniqueness, that is, the log cannot be overwritten.
print vuconf
Views the configuration of a task.

- Load configurations.
loadscript

- Create a task.
vucreate

- Run the task.
vurun

If "SUCCESS" is returned, use the execution duration as the test metric.
- Load configurations.