在订阅选项方面,原版的刻度脚本不是那么灵活,但不会太深入兔子洞,下面的一些快速更改应该可以让你按照你的要求去做(我没有测试下面的比启动实例更进一步)
.u.sub 更改为以下内容以允许订阅所有表 (`)、表列表或单个表
{$[x~`;.z.s[;y]each t;1<count x;.z.s[;y]each x;[if[not x in t;'x];del[x].z.w;add[x;y]]]};
r.q 更改为以下内容,其中所需的表通过命令行标志传入。我删除了对 .z.x 的引用并解析了各种标志。最后一行以字符串格式构建表列表(不是很优雅,但它是一个快速的解决方案)。
/q tick/r.q [host]:port[:usr:pwd] [host]:port[:usr:pwd]
/2008.09.09 .k ->.q
if[not "w"=first string .z.o;system "sleep 1"];
upd:insert;
args:.Q.opt .z.x;
/ get the ticker plant and history ports, defaults are 5010,5012
/.u.x:.z.x[0],(count .z.x 0)_(":5010";":5012");
/ end of day: save, clear, hdb reload
.u.end:{t:tables`.;t@:where `g=attr each t@\:`sym;.Q.hdpf[`$"::",first args`hdb;`:.;x;`sym];@[;`sym;`g#] each t;};
/ init schema and sync up from log file;cd to hdb(so client save can run)
.u.rep:{if[0>type first x;x:enlist x];(.[;();:;].)each x;if[null first y;:()];-11!y;system "cd ",1_-10_string first reverse y};
/ HARDCODE \cd if other than logdir/db
/ connect to ticker plant for (schema;(logcount;log))
.u.rep .(hopen `$"::",first args`tp)"(.u.sub[`",("`" sv args`tabs),";`];`.u `i`L)";
然后按如下方式启动 RDB
ec2-user@/home/ec2-user $ ## RDB 1 table
ec2-user@/home/ec2-user $ q tick/r.q -tp 5010 -hdb 6000 -tabs trade -q
tables[]
,`trade
ec2-user@/home/ec2-user $ # RDB 2 tables
ec2-user@/home/ec2-user $ q tick/r.q -tp 5010 -hdb 6000 -tabs trade quote -q
tables[]
`quote`trade
ec2-user@/home/ec2-user $ ## RDB all tables
ec2-user@/home/ec2-user $ q tick/r.q -tp 5010 -hdb 6000 -q
tables[]
`s#`other`quote`trade
在 tp 上检查订阅字典
q).u.w
other| ,(9i;`)
quote| ((8i;`);(9i;`))
trade| ((7i;`);(8i;`);(9i;`))
希望这会有所帮助,正如我所说,我还没有测试过这一点
杰森