如何在SOLR云中指定搜索者和索引器?(How to designate searcher and indexer in SOLR cloud?)
我目前有一个2节点solr(4.10.3)云集群,配置为1个分片,有2个副本(带3个节点的外部zookeeper集合)。 我怎样才能设置solr cloud来使用一个框进行搜索,一个框只用于索引?
它是否像将客户端指向其特定节点一样简单?
例如,如果我们有solr01(索引器)和solr02(搜索器)。 我们将所有客户端指向solr02何时执行搜索,以及所有客户端在需要添加新数据时指向solr01。 我可以看到的主要缺点是它会减少冗余。
有没有办法配置solr cloud来自动处理?
I currently have a 2 node solr (4.10.3) cloud cluster configured as 1 shard with 2 replicas (with a 3 node external zookeeper ensemble). How can I setup solr cloud to use one box just for searching, and one box just for indexing?
Is it as simple as pointing clients to their specific nodes?
For example if we have solr01(indexer) and solr02(searcher). We point all clients to solr02 when to perform a search, and all clients to solr01 when they need to add new data. The main downside that I can see to this is that it would reduce redundancy.
Is there some way to configure solr cloud to do handle this automatically?
原文:https://stackoverflow.com/questions/29933072
最满意答案
除非给出
__len
元方法,否则仅在表是序列时定义表t
的长度,即,对于某些非负整数n
,其正数字键的集合等于{1..n}
。 在这种情况下,n
是它的长度。在你的例子中:
local myTab = {1,2,3,nil,5,nil,7}
#mytab
未定义,因为myTab
不是序列,有或没有myTab["test"] = try
。local myT = {123,456,789}
myT
是一个序列,长度为3
,有或没有myT["test"] = 10
The rule is simple, from the length operator:
Unless a
__len
metamethod is given, the length of a tablet
is only defined if the table is a sequence, that is, the set of its positive numeric keys is equal to{1..n}
for some non-negative integern
. In that case,n
is its length.In your example:
local myTab = {1,2,3,nil,5,nil,7}
#mytab
is undefined becausemyTab
isn't a sequence, with or withoutmyTab["test"] = try
.local myT = {123,456,789}
myT
is a sequence, and the length is3
, with or withoutmyT["test"] = 10
相关问答
更多-
下面是一个应该做你想要的功能。 function gen_table(str, existing) local root = existing or {} local tbl = root for p in string.gmatch(str, "[^.]+") do local new = tbl[p] or {} tbl[p] = new tbl = new end return root end 用法: local t = gen_table("x.y.z ...
-
Lua来自Sol,一种专为石油工程师设计的语言,没有在计算机程序设计方面进行正规培训。 没有接受过计算机训练的人认为开始从零开始算起来很奇怪。 通过采用基于1的阵列和字符串索引,Lua设计师避免了混淆其第一批客户和赞助商的期望。 虽然我一开始也发现他们很奇怪,但我已经学会了喜欢基于0的数组。 但是我可以通过Lua的1 ipairs得到,特别是通过使用Lua的通用循环和ipairs操作符,我通常可以避免担心数组如何被索引。 Lua is descended from Sol, a language desig ...
-
字符串到Lua中的表(String to Table in Lua)[2022-05-24]
你可以使用loadstring来创建一个你可以执行的lua块。 eventData = [[ months = { 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', } ]] loadstring(eventData)( ... -
更改此功能以满足您的需求,并使用堆栈顶部的表调用它。 void luaAccess(lua_State * L)// call this function with the table on the top of the stack { lua_pushnil(L); while(lua_next(L, -2)) { switch(lua_type(L, -2)) { ...
-
你必须使用luaL_dostring https://www.lua.org/manual/5.1/manual.html#luaL_dostring 如果你正在使用Lua 5.1,请确保正确定义了luaL_dostring 。 请参阅: http : //lua-users.org/lists/lua-l/2006-04/msg00218.html 在Lua 5.1中, luaL_dostring被定义为luaL_loadstring(L, s) || lua_pcall(L, 0, 0, 0) luaL ...
-
从长度运算符来看,规则很简单: 除非给出__len元方法,否则仅在表是序列时定义表t的长度,即,对于某些非负整数n ,其正数字键的集合等于{1..n} 。 在这种情况下, n是它的长度。 在你的例子中: local myTab = {1,2,3,nil,5,nil,7} #mytab未定义,因为myTab不是序列,有或没有myTab["test"] = try 。 local myT = {123,456,789} myT是一个序列,长度为3 ,有或没有myT["test"] = 10 The rule ...
-
在大多数GC中,当没有对象引用时会收集对象。 将参考链的顶部设置为零可删除对子级的引用。 如果这是唯一的参考,那么孩子们将被收集。 In most GC an object will be collected when there are no references to it. Setting the top of your reference chain to nil removes a reference to the children. If that was the only reference ...
-
lua_getfield是你可以自己做的一系列命令的语法糖: lua_pushstring(L, variablename); lua_gettable(L -1 - 1); //The second minus one represents the fact that your table is actually one index below the top now. 您将密钥推入堆栈,然后使用lua_gettable访问它。 无论它是什么类型的钥匙都是如此。 您必须回答的唯一问题是如何实际获得该密 ...
-
lua,从文件导入时将字符串与表内的变量组合在一起(lua, combining strings with variables inside tables when imported from file)[2022-03-31]
通过设计, require缓存返回值。 因此,如果使用相同的字符串调用require ,则不会再次执行该脚本。 它只会返回先前返回的值。 require是用于加载模块。 模块不应该根据其他全局状态更改其返回值。 您可能正在寻找的功能是dofile 。 这将始终加载并执行该文件(但它没有require的路径搜索属性)。 或者,您可以使用loadfile将文件作为函数加载,然后执行该函数以随时重新生成表。 也: 我在表中的变量有问题。 表中没有“变量”。 或者至少不是你的意思。 期望对变量进行更改以影响其他值, ... -
表格中的Lua表(Lua tables within tables)[2021-10-19]
也许这有助于您了解如何遍历数据: for k,v in ipairs(coordTable[1].loc) do for i,w in ipairs(v) do print(k,i,w) end end 或者,如果每个子表中总是有三个数字: for k,v in ipairs(coordTable[1].loc) do print(v[1],v[2],v[3]) end 要直接获取第二个子表中的三个数字,请使用 print(coordTable[1].loc[2] ...