我们能够通过自动扩展为solr集群7.4版本创建新服务器。但是新创建的服务器不会自动添加到我们的solr集群中。是否需要添加任何设置或配置,以便为任何集合将副本自动添加到群集中。
使用的当前在我们的集群中有3个节点,我正在尝试添加第4个nod,但是在solr 7.4版本中没有添加。相同的方案在solr 7.5版本中工作正常。
使用的扩展策略:
1)
curl http://localhost:8983/solr/admin/autoscaling -H 'Content-type:application/json' -d '{
"set-cluster-policy" : [{
"replica" : "1",
"shard" : "#EACH",
"node" : "#ANY",
}]
}'
2)###Node Added Trigger
curl http://localhost:8983/solr/admin/autoscaling -H 'Content-type:application/json' -d '{
"set-trigger": {
"name" : "node_added_trigger",
"event" : "nodeAdded",
"waitFor" : "5s",
"preferredOperation": "ADDREPLICA",
"enabled" : true,
"actions" : [
{
"name" : "compute_plan",
"class": "solr.ComputePlanAction"
},
{
"name" : "execute_plan",
"class": "solr.ExecutePlanAction"
}
]
}
}'
3)###Node Lost Trigger
curl http://localhost:8983/solr/admin/autoscaling -H 'Content-type:application/json' -d '{
"set-trigger": {
"name" : "node_lost_trigger",
"event" : "nodeLost",
"waitFor" : "5s",
"preferredOperation": "DELETENODE",
"enabled" : true,
"actions" : [
{
"name" : "compute_plan",
"class": "solr.ComputePlanAction"
},
{
"name" : "execute_plan",
"class": "solr.ExecutePlanAction"
}
]
}
}'
请注意,相同的策略(2,3)在7.4中不起作用
错误:
[Mon Apr 08 11:52:00 UTC root@hawkeye-common ~]# curl http://localhost:8983/solr/admin/autoscaling -H 'Content-type:application/json' -d '{
> "set-trigger": {
> "name" : "node_added_trigger",
> "event" : "nodeAdded",
> "waitFor" : "5s",
> "preferredOperation": "ADDREPLICA",
> "enabled" : true,
> "actions" : [
> {
> "name" : "compute_plan",
> "class": "solr.ComputePlanAction"
> },
> {
> "name" : "execute_plan",
> "class": "solr.ExecutePlanAction"
> }
> ]
> }
> }'
{
"responseHeader":{
"status":400,
"QTime":5},
"result":"failure",
"WARNING":"This response format is experimental. It is likely to change in the future.",
"error":{
"metadata":[
"error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
"root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
"details":[{
"set-trigger":{
"name":"node_added_trigger",
"event":"nodeAdded",
"waitFor":"5s",
"preferredOperation":"ADDREPLICA",
"enabled":true,
"actions":[{
"name":"compute_plan",
"class":"solr.ComputePlanAction"},
{
"name":"execute_plan",
"class":"solr.ExecutePlanAction"}]},
"errorMessages":["Error validating trigger config node_added_trigger: TriggerValidationException{name=node_added_trigger, details='{preferredOperation=unknown property}'}"]}],
"msg":"Error in command payload",
"code":400}}
[Mon Apr 08 11:52:09 UTC root@hawkeye-common ~]#
[Mon Apr 08 11:52:16 UTC root@hawkeye-common ~]# curl http://localhost:8983/solr/admin/autoscaling -H 'Content-type:application/json' -d '{
> "set-trigger": {
> "name" : "node_lost_trigger",
> "event" : "nodeLost",
> "waitFor" : "5s",
> "preferredOperation": "DELETENODE",
> "enabled" : true,
> "actions" : [
> {
> "name" : "compute_plan",
> "class": "solr.ComputePlanAction"
> },
> {
> "name" : "execute_plan",
> "class": "solr.ExecutePlanAction"
> }
> ]
> }
> }'
{
"responseHeader":{
"status":400,
"QTime":1},
"result":"failure",
"WARNING":"This response format is experimental. It is likely to change in the future.",
"error":{
"metadata":[
"error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject",
"root-error-class","org.apache.solr.api.ApiBag$ExceptionWithErrObject"],
"details":[{
"set-trigger":{
"name":"node_lost_trigger",
"event":"nodeLost",
"waitFor":"5s",
"preferredOperation":"DELETENODE",
"enabled":true,
"actions":[{
"name":"compute_plan",
"class":"solr.ComputePlanAction"},
{
"name":"execute_plan",
"class":"solr.ExecutePlanAction"}]},
"errorMessages":["Error validating trigger config node_lost_trigger: TriggerValidationException{name=node_lost_trigger, details='{preferredOperation=unknown property}'}"]}],
"msg":"Error in command payload",
"code":400}}
如果在该集群中添加了任何新服务器,则必须将数据(集合)作为副本添加到该集群中。[AddReplica在7.5版中自动添加]