sysbench0.5使用中出现的问题(主键插入重复)

正确方式:

./sysbench --mysql-host=222.222.222.222 --mysql-port=3306 --mysql-user=222 --mysql-password=222 --mysql-db=testdb --test=/usr/sysbench-0.5_build/db/insert.lua --oltp_tables_count=6 --oltp-table-size=5000000 --num-threads=32 --report-interval=600  --max-requests=0 --max-time=14400 --db-ps-mode=auto --oltp_secondary=on --oltp-read-only=off --oltp-auto-inc=off run>t1_32.log

错误1:

没设置--oltp_secondary=on 会导致对表插入的主键存在重复,设置了之后,建表语句如下

CREATE TABLE `sbtest1` (
  `id` int(10) unsigned NOT NULL,
  `k` int(10) unsigned NOT NULL DEFAULT '0',
  `c` char(120) NOT NULL DEFAULT '',
  `pad` char(60) NOT NULL DEFAULT '',
  KEY `xid` (`id`),
  KEY `k_1` (`k`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 MAX_ROWS=1000000
原文地址:https://www.cnblogs.com/Nora-F/p/11775553.html