請根據(ju)實際(ji)信(xin)息,替換數據(ju)庫(ku)、連接IP與用戶(hu)密碼。
- 導入數據。
(1)使用mysql命令登錄數據庫,并創建測試數據庫 “loadtest” 。
psql -h -p5432 "dbname=postgres user=root password=" <<TEST
create database loadtest;
TEST
(2)使用sysbench命令導入測試背景數據到 “loadtest” 數據庫(ku)。 sysbench--test=/usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua--db-driver=pgsql --pgsql-db=loadtest --pgsql-user=root--pgsql-password=****--pgsql-port=5432 --pgsql-host=****--oltp-tables-count=64 --oltp-table-size=10000000 --num-threads=20 prepare**
-
壓測數據。
sysbench--test=/usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua--db-driver=pgsql --pgsql-db=loadtest --pgsql-user=root--pgsql-password=--pgsql-port=5432 --pgsql-host=--oltp-tables-count=64--oltp-table-size=10000000 --max-time=3600 --max-requests=0--num-threads=64 --report-interval=3 --forced-shutdown=1 run
-
清理數據。
sysbench--test=/usr/local/share/sysbench/tests/include/oltp_legacy/oltp.lua--db-driver=pgsql --pgsql-db=loadtest --pgsql-user=root--pgsql-password=****--pgsql-port=5432 --pgsql-host=--oltp-tables-count=64 --oltp-table-size=10000000 --max-time=3600 --max-requests=0 --num-threads=200 cleanup