obd has multiple levels of commands, and you can use the -h/--help option at each level to view the help information of subcommands. Similarly, when errors occur during the execution of subcommands at each level, you can use the -v/--verbose option to view the detailed execution process of the command. This topic describes how to use test commands in obd.
Notice
When you execute the commands in this topic, the cluster to be tested must be managed by obd. Otherwise, obd cannot obtain the information of the cluster. By default, clusters deployed by obd are managed by obd. For clusters not deployed by obd, you can perform takeover operations to take over the cluster. For more information, see Take over a cluster.
obd test mysqltest
You can use this command to execute the mysqltest tool on a specified node of OceanBase Database or ODP.
To use mysqltest, you must have already installed OBClient.
obd test mysqltest <deploy name> [--test-set <test-set>] [flags]
# example
obd test mysqltest test --all --auto-retry
The deploy name parameter specifies the name of the deployment, which acts as an alias for the configuration file.
The following table describes the options:
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --component | No | string | Empty by default | The name of the component to be tested. Valid values: obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If this option is not specified, the system checks the components in the order of obproxy, obproxy-ce, oceanbase, and oceanbase-ce. The test is performed on the first component that exists. |
| --test-server | No | string | The first node of the servers in the specified component by default | The name of the server to be tested. The value is the name value in the servers section of the yaml file. If the name value is not specified, the ip value is used. The value must be the name of a node in the specified component. |
| --mode | No | string | both | The test mode. Valid values:
|
| --user | No | string | admin | The username for the test. You do not need to modify this parameter. |
| --password | No | string | admin | The password for the test. |
| --database | No | string | test | The database for the test. |
| --mysqltest-bin | No | string | /u01/obclient/bin/mysqltest | The path of the mysqltest binary file. |
| --obclient-bin | No | string | obclient | The path of the OBClient binary file. |
| --test-dir | No | string | ./mysql_test/t | The directory where the test-file is stored. If the test file is not found, the system tries to find it in the built-in obd. |
| --test-file-suffix | No | string | .test | The suffix of the test-file required by mysqltest. |
| --result-dir | No | string | ./mysql_test/r | The directory where the result-file is stored. If the result file is not found, the system tries to find it in the built-in obd. |
| --result-file-suffix | No | string | .result | The suffix of the result-file required by mysqltest. |
| --record | No | bool | false | Records only the execution result of mysqltest as the record-file. |
| --record-dir | No | string | ./record | The directory where the execution result of mysqltest is recorded. |
| --record-file-suffix | No | string | .record | The suffix of the execution result of mysqltest. |
| --tmp-dir | No | string | ./tmp | The temporary directory of mysqltest, where temporary files generated during the test are stored. |
| --var-dir | No | string | ./var | The directory where the log directory is created and the log directory is passed to mysqltest as the --log-dir parameter. |
| --test-set | No | string | None | The array of test cases. Separate multiple test cases with commas (,). |
| --exclude | No | string | None | The array of test cases to be excluded. Separate multiple test cases with commas (,). |
| --test-pattern | No | string | None | The regular expression for matching test file names. All cases matching the expression will override the test-set option. |
| --suite | No | string | None | The suite array. A suite contains multiple tests, separated by commas (,). |
| --suite-dir | No | string | ./mysql_test/test_suite | The directory where the suite is stored. If the suite directory is not found, it will be searched in the built-in obd. |
| --all | No | bool | false | Execute all cases under --suite-dir. --suite-dir specifies the directory where the suite is stored. |
| --need-init | No | bool | false | Execute the init SQL file. A new cluster may need to execute some initialization files before running mysqltest, such as creating accounts and tenants required for the cases. Default is disabled. |
| --init-sql-dir | No | string | ./ | The directory where the init SQL files are stored. If the SQL file is not found, it will be searched in the built-in obd. |
| --init-sql-files | No | string | The array of init SQL files to execute when needed. Separated by commas (,). If not specified, obd will execute the built-in init based on the cluster configuration when needed. |
|
| --auto-retry | No | bool | false | Automatically retry by redeploying the cluster when a failure occurs. |
| --psmall | No | bool | false | Execute cases in psmall mode. |
| --slices | No | int | Default is empty | The number of groups to divide the cases into. |
| --slice-idx | No | int | Default is empty | The ID of the current group. |
| --slb-host | No | string | Default is empty | The soft load balancing center. |
| --exec-id | No | string | Default is empty | The execution ID. |
| --case-filter | No | string | ./mysql_test/filter.py | The filter.py file, which maintains the cases to be filtered. |
| --reboot-timeout | No | int | 0 | The timeout for rebooting. |
| --reboot-retries | No | int | 5 | The number of retries for reboot failure. |
| --collect-all | No | bool | false | Whether to collect component logs. |
| --log-dir | No | string | Default is $--var-dir/log | The log storage path for mysqltest. |
| --log-pattern | No | string | *.log | The regular expression for matching log file names. Files matching the expression will be collected. |
| --case-timeout | No | int | 3600 | The timeout for a single test in mysqltest. |
| --disable-reboot | No | bool | false | Do not reboot during test execution. |
| --collect-components | No | string | Default is empty | Specifies the components for which logs need to be collected. Multiple components are separated by commas (,). |
| --init-only | No | bool | false | If true, only execute the init SQL. |
obd test sysbench
Run the command to run the Sysbench benchmark on a specified node of OceanBase Database or ODP.
To run the Sysbench benchmark, you must install OBClient and ob-sysbench. Make sure that both components are installed.
Note
This topic describes how to run the Sysbench benchmark by using OBClient.
This topic takes online installation of ob-sysbench as an example. If your machine cannot connect to the Internet, we recommend that you use a machine that is connected to the Internet to visit OceanBase Database and download a package of ob-sysbench for your system. Then, you can upload the package to your machine and use the rpm command to decompress and install the package.
obd test sysbench <deploy name> [flags]
# example
obd test sysbench test --tenant=sysbench --script-name=oltp_read_only.lua,oltp_read_write.lua --table-size=1000000 --threads=32,64,128,256 --rand-type=uniform
The deploy name parameter specifies the deployment name, which can be considered an alias for the configuration file.
The options are described in the following table:
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --component | No | string | Empty by default | The name of the component to be tested. The options are obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If this option is not specified, the system checks the components in the order of obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If a component is found, the system uses the component for the subsequent tests. |
| --test-server | No | string | The first node in the servers list of the specified component by default | The name of the server to be tested. You can specify the name of the server in the servers list of the specified component. If the servers list does not contain the name field, you can specify the ip field. |
| --user | No | string | root | The username for the test. |
| --password | No | string | Empty by default | The password for the test. |
| -t/--tenant | No | string | test | The name of the tenant for the test. Make sure that the tenant has been created. |
| --database | No | string | test | The name of the database for the test. |
| --obclient-bin | No | string | obclient | The path of the OBClient binary file. |
| --sysbench-bin | No | string | sysbench | The path of the sysbench binary file. |
| --script-name | No | string | oltp_point_select.lua | The name of the sysbench script to be executed. You can specify multiple script names, which are separated with commas (,). |
| --sysbench-script-dir | No | string | /usr/sysbench/share/sysbench | The directory where the sysbench scripts are stored. |
| --tables | No | int | 30 | The number of tables to be initialized. |
| --table-size | No | int | 20000 | The number of data rows to be initialized for each table. |
| --threads | No | int | 16 | The number of threads to be started. You can specify multiple values, which are separated with commas (,). |
| --time | No | int | 60 | The test duration in seconds. Set this parameter to 0 to indicate that the test is not time-limited. |
| --interval | No | int | 10 | The time interval in seconds for printing logs during the test. Set this parameter to 0 to indicate that no logs are printed. |
| --mysql-ignore-errors | No | string | 1062 | The error codes to be ignored. You can specify multiple error codes, which are separated with commas (,). If you specify all, all error codes are ignored. |
| --events | No | int | 0 | The maximum number of requests. If you specify this option, you do not need to specify the --time option. |
| --rand-type | No | string | special | The random generation function used to access data. Valid values: special, uniform, gaussian, and pareto. |
| ---skip-trx | No | string | Empty | Specifies whether to enable or disable transactions in read-only tests. |
| --percentile | No | int | Empty | The percentage to calculate in the delay statistics. Valid values: [1,100]. If you set this option to 0, the percentage calculation is disabled. |
| -S/--skip-cluster-status-check | No | bool | false | If you specify this option, the cluster status check is skipped, and nodes can be offline during the test. |
| -O/--optimization | No | int | 1 | The auto-optimization level. Valid values:
|
obd test tpch
You can run the TPC-H benchmark on an OceanBase Database cluster or an ODP component.
To run the TPC-H benchmark, you must have installed OBClient and obtpch.
The TPC-H benchmark requires a target OceanBase Database server. Before running the TPC-H benchmark, obd will transfer the required data files to the specified directory on the target server. These files can be quite large, so ensure that the server has sufficient disk space. Alternatively, you can prepare the data files on the target server in advance and use the --dt/--disable-transfer option to disable the transfer.
Note
This section provides an overview of the command.
This section provides an example of online installation of obtpch. If your server cannot connect to the Internet, we recommend that you use a server that can connect to the Internet to download the required files from this link based on your system version, upload the files to the server where the benchmark will be run, and then install them using the rpm command.
obd test tpch <deploy name> [flags]
# example
obd test tpch test --tenant=tpch -s 100 --remote-tbl-dir=/tmp/tpch100
The deploy name parameter specifies the deployment name, which can be considered an alias for the configuration file.
The options are described in the table below:
Option |
Required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --component | No | string | Empty by default | The name of the component to be tested. Valid values: obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If this option is not specified, the system checks the components in the order of obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If a component is found, the system uses the component for the subsequent test. |
| --test-server | No | string | The first node in the servers list of the specified component by default |
The name of the server to be tested, followed by the name value in the servers list of the yaml file. If the servers list does not contain the name value, the ip value is used. The value must be the name of a node in the specified component. |
| --user | No | string | root | The username of the user who executes the test. |
| --password | No | string | Empty by default | The password of the user who executes the test. |
| -t/--tenant | No | string | test | The name of the tenant to be used for the test. Make sure that the tenant has been created. |
| --database | No | string | test | The name of the database to be used for the test. If the database does not exist, the test program creates it automatically. |
| --obclient-bin | No | string | obclient | The path of the OBClient binary file. |
| --dbgen-bin | No | string | /usr/tpc-h-tools/tpc-h-tools/bin/dbgen | The path of the dbgen binary file. |
| --dss-config | No | string | /usr/tpc-h-tools/tpc-h-tools/ | The directory where the dists.dss file is stored. |
| -s/--scale-factor | No | int | 1 | The scale of the test data to be generated, in GB. |
| --tmp-dir | No | string | ./tmp | The temporary directory for the TPC-H test. The generated test data, automatically optimized SQL files, and test SQL execution logs are stored in this directory. |
| --ddl-path | No | string | Empty by default | The path of the DDL file or directory. If this option is not specified, obd uses its built-in DDL file. |
| --tbl-path | No | string | Empty by default | The path of the TBL file or directory. If this option is not specified, the test data is generated by using dbgen. |
| --sql-path | No | string | Empty by default | The path of the SQL file or directory. If this option is not specified, obd uses its built-in SQL file. |
| --remote-tbl-dir | No | string | Empty by default | The absolute path of the directory where the TBL files are stored on the target OBServer node. Make sure that the startup user of the OBServer node has read and write permissions on this directory. If this option is not specified and --test-only is not enabled, an error is returned. |
| --test-only | No | bool | false | Do not execute the initialization. Execute only the test SQL. |
| --dt/--disable-transfer | No | bool | false | Disable data transfer. If this option is enabled, the system does not transfer the local TBL files to the remote-tbl-dir directory on the remote server. Instead, the system directly uses the tbl files in the remote-tbl-dir directory on the remote server. |
| -S/--skip-cluster-status-check | No | bool | false | Specifies whether to skip the cluster status check. If you set this option to true, nodes can be offline during the test. |
| -O/--optimization | No | int | 1 | Specifies the automatic optimization level. The following table describes the values of this option.
|
| --parallel | No | int | max_cpu * unit_count | Specifies the parallelism for data loading. In the default value, max_cpu specifies the maximum number of CPU cores available to the tenant, and unit_count specifies the number of resource units in the resource pool used by the test tenant. |
| --direct-load | No | bool | false | Specifies whether to enable direct load. |
obd test tpcc
You can run the TPC-C benchmark test for OceanBase Database or ODP components.
To run TPC-C benchmark, you need OBClient and obtpcc. Make sure they have been installed.
Note
This section describes how to install obtpcc online. If your local network does not allow you to access the Internet, you must download and transfer the installation package to your local machine by using an Internet-connected computer. For more information, see link. After the package is transferred to your local machine, you can run the rpm command to decompress and install it.
obd test tpcc <deploy name> [flags]
# example
obd test tpcc test --tenant=tpcc --warehouses 10 --run-mins 1
The deploy name parameter specifies the deploy name, which can be considered an alias for the configuration file.
The description of each option is shown in the table below:
Option |
Required? |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --component | No | string | Empty by default | The name of the component to be tested. Valid values: obproxy, obproxy-ce, oceanbase, and oceanbase-ce. If this option is not specified, the system checks the components in the order of obproxy, obproxy-ce, oceanbase, and oceanbase-ce. The test is performed on the first component that exists. |
| --test-server | No | string | The first node in the servers list of the specified component's YAML file by default | The name of the server to be tested, followed by the name value corresponding to servers in the YAML file. If the name value is not specified, the ip value is used. The server must be a node of the specified component. |
| --user | No | string | root | The username for the test. |
| --password | No | string | Empty by default | The password for the test. |
| -t/--tenant | No | string | test | The name of the tenant for the test. Make sure that the tenant is created. |
| --database | No | string | test | The name of the database for the test. If the database does not exist, it will be automatically created. |
| --obclient-bin | No | string | obclient | The path of the OBClient binary file. |
| --java-bin | No | string | java | The path of the Java binary file. |
| --tmp-dir | No | string | ./tmp | The temporary directory for tpcc. Generated configuration files, automatically optimized SQL files, and test output files are stored in this directory. |
| --bmsql-dir | No | string | Empty by default | The directory of BenchmarkSQL. This option is required only when you compile and install BenchmarkSQL manually. obtpcc does not require this option. |
| --bmsql-jar | No | string | Empty by default | The path of the main jar file of BenchmarkSQL. If this option is not specified, the system uses the default installation path of obtpcc if the --bmsql-dir option is not specified. If the --bmsql-dir option is specified, the system uses the jar file in the <bmsql-dir>/dist directory. |
| --bmsql-libs | No | string | Empty by default | If the --bmsql-dir option is specified, the system uses the jar files in the <bmsql-dir>/lib and <bmsql-dir>/lib/oceanbase directories. obtpcc does not require this option. |
| --bmsql-sql-dir | No | string | Empty by default | The path of the TPC-C SQL files. If this option is not specified, obd uses the generated SQL files. |
| --warehouses | No | int | 10 | The number of warehouses in the TPC-C test set. If this option is not specified, the value is set to the number of CPU cores of the OceanBase cluster multiplied by 20. |
| --load-workers | No | int | Empty by default | The number of concurrent threads for constructing the test dataset. If this option is not specified, the system uses the smaller value between the number of CPU cores of the standalone server and the tenant available memory (GB) divided by 2. |
| --terminals | No | int | Empty by default | The number of virtual terminals for the TPC-C test. If this option is not specified, the system uses the smaller value between the number of CPU cores of the OceanBase cluster multiplied by 15 and the number of warehouses multiplied by 10. |
| --run-mins | No | int | 10 | The test duration, in minutes. |
| --test-only | No | bool | false | Do not construct data. Only perform the test. |
| -S/--skip-cluster-status-check | No | bool | false | If you specify this option, the system skips the cluster status check and allows nodes to be offline during the test. |
| -O/--optimization | No | int | 1 | The automatic optimization level. The following table describes the values.
|
