Мы можем создать новый сервер с помощью автоматического масштабирования для нашей версии solr cluster 7.4. Но вновь созданный сервер не добавляется в наш кластер solr автоматически. Есть ли какие-либо настройки или конфигурации, которые нам нужно добавить, чтобы автоматически добавлять реплику в кластер для любых коллекций.
используемые команды:
завиток "http://localhost:8983/solr/admin/collections?action=CREATE&name=my_collection_3&numShards=1&replicationFactor=3&autoAddReplicas=true"
В настоящее время 3 узла находятся в нашем кластере, и я пытаюсь добавить 4-й узел, но он не добавляется в версии 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]
1: https://i.stack.imgur.com/DgEbL.png