html_strip = {0|1}
此选项确定是否应从传入的全文数据中去除HTML标记。默认值为0,表示禁用去除。要启用去除,请将值设置为1。
HTML标签和实体被视为标记,并将被处理。
HTML标签被移除,而它们之间的内容(例如,<p>和</p>之间的内容)保持不变。可以选择保留并索引标签属性(例如,A标签中的HREF属性或IMG标签中的ALT属性)。一些常见的内联标签,如A、B、I、S、U、BASEFONT、BIG、EM、FONT、IMG、LABEL、SMALL、SPAN、STRIKE、STRONG、SUB、SUP和TT,将完全移除。所有其他标签被视为块级标签,并用空格替换。例如,文本te<b>st</b>将被索引为单个关键词'test',而te<p>st</p>将被索引为两个关键词'te'和'st'。
HTML实体被解码并替换为其相应的UTF-8字符。去除器支持实体的数字形式(例如ï)和文本形式(例如ó或 ),并支持HTML4标准中指定的所有实体。
去除器旨在与正确形成的HTML和XHTML一起使用,但在处理不规范的输入(例如带有游离的<'s或未关闭的>'s的HTML)时可能会产生意外结果。
请注意,仅移除标签本身以及HTML注释。要移除标签的内容,包括嵌入的脚本,请参阅html_remove_elements选项。标签名称没有限制,这意味着任何看起来是有效标签开始、结束或注释的内容都将被移除。
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- CONFIG
CREATE TABLE products(title text, price float) html_strip = '1'POST /cli -d "
CREATE TABLE products(title text, price float) html_strip = '1'"$index = new \Manticoresearch\Index($client);
$index->setName('products');
$index->create([
'title'=>['type'=>'text'],
'price'=>['type'=>'float']
],[
'html_strip' => '1'
]);utilsApi.sql('CREATE TABLE products(title text, price float) html_strip = \'1\'')await utilsApi.sql('CREATE TABLE products(title text, price float) html_strip = \'1\'')res = await utilsApi.sql('CREATE TABLE products(title text, price float) html_strip = \'1\'');utilsApi.sql("CREATE TABLE products(title text, price float) html_strip = '1'");utilsApi.Sql("CREATE TABLE products(title text, price float) html_strip = '1'");utils_api.sql("CREATE TABLE products(title text, price float) html_strip = '1'", Some(true)).await;table products {
html_strip = 1
type = rt
path = tbl
rt_field = title
rt_attr_uint = price
}html_index_attrs = img=alt,title; a=title;
html_index_attrs选项允许您指定即使其他HTML标记被去除,哪些HTML标记属性也应被索引。默认值为空,表示不会索引任何属性。 该选项的格式是每个标签的可索引属性的枚举,如上例所示。指定属性的内容将被保留并索引,从而提供从全文数据中提取附加信息的方法。
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- CONFIG
CREATE TABLE products(title text, price float) html_index_attrs = 'img=alt,title; a=title;' html_strip = '1'POST /cli -d "
CREATE TABLE products(title text, price float) html_index_attrs = 'img=alt,title; a=title;' html_strip = '1'"$index = new \Manticoresearch\Index($client);
$index->setName('products');
$index->create([
'title'=>['type'=>'text'],
'price'=>['type'=>'float']
],[
'html_index_attrs' => 'img=alt,title; a=title;',
'html_strip' => '1'
]);utilsApi.sql('CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = \'1\'')await utilsApi.sql('CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = \'1\'')res = await utilsApi.sql('CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = \'1\'');utilsApi.sql("CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = '1'");utilsApi.Sql("CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = '1'");utils_api.sql("CREATE TABLE products(title text, price float) html_index_attrs = \'img=alt,title; a=title;\' html_strip = '1'", Some(true)).await;table products {
html_index_attrs = img=alt,title; a=title;
html_strip = 1
type = rt
path = tbl
rt_field = title
rt_attr_uint = price
}html_remove_elements = element1[, element2, ...]
一个HTML元素列表,其内容及其自身将被移除。可选,默认值为空字符串(不移除任何元素的内容)。
此选项允许您移除元素的内容,即移除它们之间的所有内容。这对于移除嵌入的脚本、CSS等非常有用。空元素的简短标签形式(例如<br/>)得到了适当支持,这样的标签后面的文本不会被移除。
值是一个逗号分隔的元素(标签)名称列表,这些元素的内容应被移除。标签名称是不区分大小写的。
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- CONFIG
CREATE TABLE products(title text, price float) html_remove_elements = 'style, script' html_strip = '1'POST /cli -d "
CREATE TABLE products(title text, price float) html_remove_elements = 'style, script' html_strip = '1'"$index = new \Manticoresearch\Index($client);
$index->setName('products');
$index->create([
'title'=>['type'=>'text'],
'price'=>['type'=>'float']
],[
'html_remove_elements' => 'style, script',
'html_strip' => '1'
]);utilsApi.sql('CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = \'1\'')await utilsApi.sql('CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = \'1\'')res = await utilsApi.sql('CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = \'1\'');utilsApi.sql("CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = '1'");utilsApi.Sql("CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = '1'");utils_api.sql("CREATE TABLE products(title text, price float) html_remove_elements = \'style, script\' html_strip = '1'", Some(true)).await;table products {
html_remove_elements = style, script
html_strip = 1
type = rt
path = tbl
rt_field = title
rt_attr_uint = price
}index_sp = {0|1}
控制句子和段落边界的检测和索引。可选,默认值为0(不进行检测或索引)。
此指令启用句子和段落边界的检测和索引,使得SENTENCE 和 PARAGRAPH 操作符可以工作。句子边界检测基于纯文本分析,只需设置index_sp = 1即可启用。段落检测依赖于HTML标记,并在HTML去除过程期间进行。因此,要索引段落边界,必须同时设置index_sp指令和html_strip指令为1。
以下规则用于确定句子边界:
- 问号(?)和感叹号(!)总是表示句子的边界。
- 结尾的点(.)表示句子的边界,除非出现以下情况:
- 后跟一个字母。这被认为是缩写的一部分(例如 "S.T.A.L.K.E.R." 或 "Goldman Sachs S.p.A.")。
- 后跟一个逗号。这被认为是缩写后跟一个逗号(例如 "Telecom Italia S.p.A., founded in 1994")。
- 后跟一个空格和一个小写字母。这被认为是句子中的缩写(例如 "News Corp. announced in February")。
- 前跟一个空格和一个大写字母,后跟一个空格。这被认为是中间名(例如 "John D. Doe")。
段落边界在每个块级HTML标签处检测,包括:ADDRESS, BLOCKQUOTE, CAPTION, CENTER, DD, DIV, DL, DT, H1, H2, H3, H4, H5, LI, MENU, OL, P, PRE, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR, 和 UL。
句子和段落都会使关键词位置计数器增加1。
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- CONFIG
CREATE TABLE products(title text, price float) index_sp = '1' html_strip = '1'POST /cli -d "
CREATE TABLE products(title text, price float) index_sp = '1' html_strip = '1'"$index = new \Manticoresearch\Index($client);
$index->setName('products');
$index->create([
'title'=>['type'=>'text'],
'price'=>['type'=>'float']
],[
'index_sp' => '1',
'html_strip' => '1'
]);utilsApi.sql('CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = \'1\'')await utilsApi.sql('CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = \'1\'')res = await utilsApi.sql('CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = \'1\'');utilsApi.sql("CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = '1'", true);utilsApi.Sql("CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = '1'", true);utils_api.sql("CREATE TABLE products(title text, price float) index_sp = \'1\' html_strip = '1'", Some(true)).await;table products {
index_sp = 1
html_strip = 1
type = rt
path = tbl
rt_field = title
rt_attr_uint = price
}index_zones = h*, th, title
一个字段内的HTML/XML区域列表,用于索引。默认值为空字符串(不会索引任何区域)。
一个“区域”定义为一对匹配的起始和结束标签之间的内容,所有共享相同标签名的span都称为一个“区域”。例如,文档字段中的 <H1> 和 </H1> 之间的内容属于H1区域。
index_zones 指令启用区域索引,但HTML stripper 也必须启用(通过设置 html_strip = 1)。index_zones 的值应为逗号分隔的标签名和通配符(以星号结尾)的列表,用于作为区域进行索引。
区域可以嵌套和重叠,只要每个起始标签都有一个匹配的标签。区域也可以用于与 ZONE 运算符匹配,如 extended_query_syntax 中所述。
- SQL
- JSON
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
- CONFIG
CREATE TABLE products(title text, price float) index_zones = 'h, th, title' html_strip = '1'POST /cli -d "
CREATE TABLE products(title text, price float) index_zones = 'h, th, title' html_strip = '1'"$index = new \Manticoresearch\Index($client);
$index->setName('products');
$index->create([
'title'=>['type'=>'text'],
'price'=>['type'=>'float']
],[
'index_zones' => 'h*,th,title',
'html_strip' => '1'
]);utilsApi.sql('CREATE TABLE products(title text, price float) index_zones = \'h, th, title\' html_strip = \'1\'')await utilsApi.sql('CREATE TABLE products(title text, price float) index_zones = \'h, th, title\' html_strip = \'1\'')res = await utilsApi.sql('CREATE TABLE products(title text, price float) index_zones = \'h, th, title\' html_strip = \'1\'');utilsApi.sql("CREATE TABLE products(title text, price float) index_zones = 'h, th, title' html_strip = '1'", true);utilsApi.Sql("CREATE TABLE products(title text, price float) index_zones = 'h, th, title' html_strip = '1'", true);utils_api.sql("CREATE TABLE products(title text, price float) index_zones = 'h, th, title' html_strip = '1'", Some(true)).await;table products {
index_zones = h*, th, title
html_strip = 1
type = rt
path = tbl
rt_field = title
rt_attr_uint = price
}Manticore 允许创建分布式表,它们的行为类似普通的普通表或实时表,但实际上是用于搜索的子表集合。当向分布式表发送查询时,查询会被分配到集合中的所有表。服务器随后收集并处理响应,必要时对聚合值进行排序和重新计算。
从客户端的角度来看,感觉就像是在查询一个单一的表。
分布式表可以由以下任意组合的表组成:
- 本地存储表(普通表 和 实时表)
- 远程表
- 本地和远程表的组合
- Percolate 表(本地、远程或组合)
- 单个本地表和多个远程表,或任何其他组合
不建议将 percolate 和模板表与普通表和实时表混合使用。
分布式表在配置文件中定义为类型 'distributed',或者通过 SQL 子句 CREATE TABLE 定义。
table foo {
type = distributed
local = bar
local = bar1, bar2
agent = 127.0.0.1:9312:baz
agent = host1|host2:tbl
agent = host1:9301:tbl1|host2:tbl2 [ha_strategy=random retry_count=10]
...
}
CREATE TABLE distributed_index type='distributed' local='local_index' agent='127.0.0.1:9312:remote_table'
分布式表的核心在于其所指向的子表列表。分布式表中有两种类型的子表:
在Manticore Search中,分布式表充当“主节点”,将所需的查询代理到其他表,并提供从接收到的响应中合并的结果。该表本身不存储任何数据。它可以连接到本地表和其他服务器上的表。以下是一个简单的分布式表示例:
- Configuration file
- RT mode
- PHP
- Python
- Python-asyncio
- javascript
- Java
- C#
- Rust
table index_dist {
type = distributed
local = index1
local = index2
...
}CREATE TABLE local_dist type='distributed' local='index1' local='index2';$params = [
'body' => [
'settings' => [
'type' => 'distributed',
'local' => [
'index1',
'index2'
]
]
],
'table' => 'products'
];
$index = new \Manticoresearch\Index($client);
$index->create($params);utilsApi.sql('CREATE TABLE local_dist type=\'distributed\' local=\'index1\' local=\'index2\'')await utilsApi.sql('CREATE TABLE local_dist type=\'distributed\' local=\'index1\' local=\'index2\'')res = await utilsApi.sql('CREATE TABLE local_dist type=\'distributed\' local=\'index1\' local=\'index2\'');utilsApi.sql("CREATE TABLE local_dist type='distributed' local='index1' local='index2'");utilsApi.Sql("CREATE TABLE local_dist type='distributed' local='index1' local='index2'");utils_api.sql("CREATE TABLE local_dist type='distributed' local='index1' local='index2'", Some(true)).await;Manticore Search 中的远程表通过分布式表定义中的 agent 前缀表示。分布式表可以包含本地表和远程表的组合。如果没有提供本地表,分布式表将纯粹是远程的,仅作为代理。例如,您可能有一个监听多个端口并服务不同协议的 Manticore 实例,然后重定向查询到仅通过 Manticore 内部二进制协议接受连接的后端服务器,使用持久连接以减少建立连接的开销。 尽管纯远程分布式表本身不提供本地表,但它仍然消耗机器资源,因为它仍需要执行最终计算,如合并结果和计算最终的聚合值。
agent = address1 [ | address2 [...] ][:table-list]
agent = address1[:table-list [ | address2[:table-list [...] ] ] ]
agent 指令声明每次搜索包含的分布式表时都会被搜索的远程代理。这些代理本质上是指向网络表的指针。指定的值包括地址,也可以包括多个备选(代理镜像),用于仅地址或地址和表列表。
地址规范必须是以下之一:
address = hostname[:port] # eg. server2:9312
address = /absolute/unix/socket/path # eg. /var/run/manticore2.sock
hostname 是远程主机名,port 是远程 TCP 端口号,table-list 是用逗号分隔的表名列表,方括号 [] 表示可选子句。
如果省略表名,假定为定义该行的同一表。换句话说,当为分布式表 'mycoolindex' 定义代理时,可以简单指向地址,默认查询该代理端点上的 mycoolindex 表。
如果省略端口号,默认是 9312。如果定义但无效(例如 70000),则跳过该代理。
可以将每个代理指向一个或多个位于一个或多个网络服务器上的远程表,没有限制。这使得几种不同的使用模式成为可能:
- 在多个代理服务器上分片并创建任意的集群拓扑
- 在多个代理服务器上分片并进行镜像,以实现高可用性和负载均衡
- 在本地主机中分片以利用多个核心(不过,更简单的是使用多个本地表)
所有代理都是并行搜索的。索引列表直接传递给远程代理。该列表在代理内具体如何搜索(顺序或并行)完全取决于代理的配置(参见threads设置)。主控无法远程控制此行为。
需要注意的是,代理查询中会忽略 LIMIT 选项。这是因为每个代理可能包含不同的表,因此客户端负责在最终结果集上应用限制。这就是为何对物理表的查询与对分布式表的查询在查询日志中体现不同。查询不能简单复制原始查询,否则不会产生正确结果。
例如,如果客户端执行查询 SELECT ... LIMIT 10, 10,且有两个代理,第二个代理只有 10 条文档,广播原始 LIMIT 10, 10 查询会导致第二个代理返回 0 条文档。然而,LIMIT 10,10 应该返回结果集中的第10到20条。为解决此问题,必须向代理发送更宽松限制的查询,例如默认 max_matches 值 1000。
比如,若有分布式表 dist 指向远程表 user,客户端查询 SELECT * FROM dist LIMIT 10,10 会被转换为 SELECT * FROM user LIMIT 0,1000 并发送至远程表 user。一旦分布式表收到结果,它将应用 LIMIT 10,10,返回请求的 10 条文档。
SELECT * FROM dist LIMIT 10,10;
查询将被转换为:
SELECT * FROM user LIMIT 0,1000
另外,值可以为每个单独代理指定选项,例如:
- ha_strategy -
random,roundrobin,nodeads,noerrors(针对特定代理覆盖全局ha_strategy设置) conn-pconn,持久连接(相当于在表级设置agent_persistent)blackhole0,1(与代理的 agent_blackhole 设置相同)retry_count整数值(对应 agent_retry_count ,但提供的值不会乘以镜像数量)
agent = address1:table-list[[ha_strategy=value, conn=value, blackhole=value]]
示例:
# config on box1
# sharding a table over 3 servers
agent = box2:9312:shard1
agent = box3:9312:shard2
# config on box2
# sharding a table over 3 servers
agent = box1:9312:shard2
agent = box3:9312:shard3
# config on box3
# sharding a table over 3 servers
agent = box1:9312:shard1
agent = box2:9312:shard3
# per agent options
agent = box1:9312:shard1[ha_strategy=nodeads]
agent = box2:9312:shard2[conn=pconn]
agent = box2:9312:shard2[conn=pconn,ha_strategy=nodeads]
agent = test:9312:any[blackhole=1]
agent = test:9312|box2:9312|box3:9312:any2[retry_count=2]
agent = test:9312|box2:9312:any2[retry_count=2,conn=pconn,ha_strategy=noerrors]
为了获得最佳性能,建议将位于同一服务器上的远程表置于相同记录中。例如,不要:
agent = remote:9312:idx1
agent = remote:9312:idx2
建议使用:
agent = remote:9312:idx1,idx2
agent_persistent = remotebox:9312:index2
agent_persistent 选项允许你持久连接到代理,即查询执行后连接不会断开。该指令语法与 agent 指令相同。但不同的是,主控不会为每个查询打开新连接然后关闭,而是保持连接并重用以进行后续查询。每个代理主机的最大持久连接数由 searchd 部分的 persistent_connections_limit 选项定义。
需要注意的是,必须将 persistent_connections_limit 设置为大于 0 的值才能使用持久代理连接。如果未定义,默认为 0,agent_persistent 指令的行为将与 agent 指令相同。
使用持久主从代理连接可以减少 TCP 端口压力,节省连接握手时间,从而提高效率。
agent_blackhole = testbox:9312:testindex1,testindex2
agent_blackhole 指令允许你将查询转发到远程代理,而无需等待或处理它们的响应。这对于调试或测试生产集群非常有用,因为你可以设置一个单独的调试/测试实例,并从生产主服务器(聚合器)实例转发请求到该实例,而不干扰生产工作。主 searchd 将尝试连接到黑洞代理并像往常一样发送查询,但不会等待或处理任何响应,所有黑洞代理的网络错误将被忽略。该值的格式与常规的 agent 指令相同。
agent_connect_timeout = 300
agent_connect_timeout 指令定义了连接远程代理的超时时间。默认情况下,该值以毫秒为单位,但可以有其他后缀)。默认值为 1000(1 秒)。
连接远程代理时,searchd 最多等待此时间以成功完成连接。如果超时到达但连接未建立,并且启用了 retries,则会进行重试。
agent_query_timeout = 10000 # our query can be long, allow up to 10 sec
agent_query_timeout 设置 searchd 等待远程代理完成查询的时间。默认值为 3000 毫秒(3 秒),但可以通过添加后缀指示不同时间单位。
建立连接后,searchd 将等待最多 agent_query_timeout 时间来完成远程查询。请注意,此超时与 agent_connection_timeout 是独立的,远程代理可能导致的延迟总和为两者之和。如果达到 agent_query_timeout,查询将不会重试,而是产生警告。
请注意,行为还受到reset_network_timeout_on_packet的影响。
agent_retry_count 是一个整数,指定 Manticore 在报告致命查询错误之前,将尝试连接和查询分布式表中的远程代理的次数。它的工作方式类似于配置文件中 “searchd” 部分定义的 agent_retry_count,但专门应用于该表。
mirror_retry_count 的作用与 agent_retry_count 相同。如果两个值都提供,mirror_retry_count 优先,并且会发出警告。
以下选项管理远程代理的整体行为,并在配置文件的 searchd 部分指定。它们为整个 Manticore 实例设置默认值。
agent_connect_timeout—agent_connect_timeout参数的默认值。agent_query_timeout—agent_query_timeout参数的默认值。此值也可以在分布式(网络)表中使用相同设置名称按查询单独覆盖。agent_retry_count是一个整数,指定 Manticore 在报告致命查询错误之前,将尝试连接和查询分布式表中的远程代理的次数。默认值为 0(即不重试)。此值也可以通过查询选项 'OPTION retry_count=XXX' 单独指定。若提供了此查询选项,将优先于配置中的值。
注意,如果你在定义分布式表时使用代理镜像,服务器将在每次连接尝试之前根据指定的ha_strategy选择不同的镜像。在这种情况下,agent_retry_count 将对该集合中所有镜像进行汇总。
例如,如果你有 10 个镜像并设置 agent_retry_count=5,服务器最多尝试 50 次重试(假设每 10 个镜像平均尝试 5 次)。如果选择 ha_strategy = roundrobin,实际上每个镜像会尝试 5 次。
与此同时,在 agent 定义中作为 retry_count 选项提供的值作为绝对限制。换言之,代理定义中的 [retry_count=2] 选项意味着最多会尝试 2 次,无论是否有 1 个或 10 个镜像。
agent_retry_delay 是一个整数值,表示 Manticore Search 在远程代理查询失败后等待重试的时间(毫秒)。可以在 searchd 全局配置中指定,也可以在查询中通过 OPTION retry_delay=XXX 语句单独指定。如果两者都存在,则查询级别选项优先。默认值为 500 毫秒(0.5 秒)。如果 agent_retry_count 或查询选项 OPTION retry_count 为零,则该选项无效。
client_timeout 选项设置使用持久连接时请求间的最大等待时间。该值以秒或带时间后缀的形式表示。默认值为 5 分钟。
示例:
client_timeout = 1h
hostname_lookup 选项定义了主机名的更新策略。默认情况下,代理主机名的 IP 地址在服务器启动时缓存,以避免频繁访问 DNS。然而,在某些情况下(例如云托管环境),IP 会动态变化,可能希望不缓存 IP。将此选项设置为 request 可禁用缓存,每次查询时都会查询 DNS。IP 地址也可以通过 FLUSH HOSTNAMES 命令手动刷新。
listen_tfo 选项允许对所有监听器使用 TCP_FASTOPEN 标志。默认情况下,该选项由系统管理,但可以通过将其设置为 '0' 显式关闭。
有关 TCP Fast Open 扩展的更多信息,请参阅 Wikipedia。简而言之,它允许在建立连接时消除一次 TCP 往返。
在实际应用中,使用 TFO 可以优化客户端与代理之间的网络效率,类似于使用 agent_persistent 时,但无需保持活动连接,也没有最大连接数的限制。
大多数现代操作系统都支持 TFO。Linux(作为较为先进的系统之一)自 2011 年起支持它,内核版本从 3.7 开始支持(服务器端)。Windows 自 Windows 10 的某些版本开始支持该功能。其他系统,如 FreeBSD 和 MacOS,也在支持范围内。
对于 Linux 系统,服务器会检查变量 /proc/sys/net/ipv4/tcp_fastopen 并据此行为。位 0 管理客户端,位 1 管理监听器。默认情况下,系统将此参数设置为 1,即客户端启用,监听器禁用。
persistent_connections_limit = 29 # assume that each host of agents has max_connections = 30 (or 29).
persistent_connections_limit 选项定义了与远程持久代理的最大同时持久连接数。这是一个实例级别的设置,必须在 searchd 配置部分中定义。每当连接到在 agent_persistent 下定义的代理时,我们会尝试重用现有连接(如果存在),或创建新连接并保存以便将来使用。然而,在某些情况下可能需要限制持久连接的数量。该指令定义了限制,并影响所有分布式表中每个代理主机的连接数。
建议将此值设置为不大于代理配置中的 max_connections 选项。
分布式表的一个特殊情况是一张本地表和多张远程表,这种情况专门用于 分布式片段创建,当片段源自文件时。在这种情况下,本地表可作为“模板”表,提供构建片段时的分词设置。
snippets_file_prefix = /mnt/common/server1/
snippets_file_prefix 是一个可选的前缀,可以在生成片段时添加到本地文件名。默认值为当前工作文件夹。
如需了解更多关于分布式片段创建的信息,请参阅 CALL SNIPPETS。
您可以从多个 percolate 表创建一个分布式表。构造此类表的语法与其他分布式表相同,可以包含多个 local 表以及 agents。
对于 DPQ,列出存储查询和通过它们搜索(使用 CALL PQ)操作是透明的,且表现得如同所有表合并成一个本地表。然而,诸如 insert、replace、truncate 之类的数据操作语句不可用。
如果您在代理列表中包含了非预查询表,其行为将无法定义。如果错误代理与 PQ 表的外层架构(id、query、tags、filters)相同,在列出存储的 PQ 规则时不会引发错误,并且可能会用其非 PQ 字符串污染 PQ 表中实际存储的 PQ 规则列表。因此,务必谨慎,并意识到这可能带来的混淆。对该错误代理执行 CALL PQ 将引发错误。
有关对分布式预查询表进行查询的更多信息,请参阅 对分布式预查询表进行查询。