浏览 2000 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-03-19
最后修改:2009-03-19
网上的资料很多,关于select-sky.smack文件的正确修改方案也有很多,但就是没找到关于update-select.smack文件的,而只是有提到用命令 super-smack -d mysql update-select.smack 10 1000 update-select.smack文件跟select-sky.smack很相似,只是多了 query "update_by_username" { } 在这里我把正确的select-sky.smack文件附上 引用 // this is will be used in the table section client "admin" { user "root";//mysql 用户名 host "localhost"; db "test";//database name pass "";//password socket "/var/lib/mysql/mysql.sock"; // this only applies to MySQL and is // ignored for PostgreSQL } // ensure the table exists and meets the conditions table "http_auth" { client "admin"; // connect with this client // if the table is not found or does not pass the checks, create it // with the following, dropping the old one if needed create "create table http_auth (username char(25) not null primary key, pass char(25), uid integer not null, gid integer not null )"; min_rows "90000"; // the table must have at least that many rows data_file "http_auth.dat"; // if the table is empty, load the data from //this file gen_data_file "gen-data -n 90000 -f %12-12s%n,%25-25s,%n,%d"; // if the file above does not exist, generate it with the above command } //define a dictionary dictionary "word" { type "rand"; source_type "file"; source "words.dat"; delim " "; // 将","号改为"tab" file_size_equiv "45000"; } //define a query query "select_by_username" { query "select * from http_auth where username = '$word'"; type "select_index"; has_result_set "y"; parsed "y"; } query "update_by_username" { query "update http_auth set pass='$word' where username = '$word'"; type "update_index"; has_result_set "y"; parsed "y"; } // define database client type client "smacker2" { user "root"; //这里的设置同上 pass ""; host "localhost"; db "test"; socket "/var/lib/mysql/mysql.sock"; query_barrel "1 select_by_username 1 update_by_username"; // 运行一次select_by_username 和 query update_by_username //运行次数可根据需要修改 } main { smacker2.init(); //smacker2必须和你上面定义的client type用户名相同 //smacker2.set_num_rounds($2); //原文件多了一行,可能会使你的脚本无法运行,在这里删掉 smacker2.set_num_rounds($2); smacker2.create_threads($1); smacker2.connect(); smacker2.unload_query_barrel(); smacker2.disconnect(); } 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |