From 8d3810df548e1edd88b7b8a68703362b590dca6a Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Tue, 16 Oct 2018 17:38:51 +1100 Subject: [PATCH] SOLR-12740: migration docs --- .../src/migrate-to-policy-rule.adoc | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 solr/solr-ref-guide/src/migrate-to-policy-rule.adoc diff --git a/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc b/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc new file mode 100644 index 00000000000..c91e272f2a3 --- /dev/null +++ b/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc @@ -0,0 +1,170 @@ += Migrate to Policy Rules +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +Replica placement rules (legacy) are deprecated in favor of the new policy and preferences syntax (new). This document helps you to migrate your existing replica placement rules to the new syntax. + +Every rule in the legacy framework can be expressed in the new syntax. Please refer to <> document for more details. + + +The following is the legacy syntax for a rule that limits maximum one replica for each shard in any Solr node +[source,text] +---- +replica:<2,node:*,shard:** +---- +The rules are specified along with a collection creation operation as the `rules` parameter + +The equivalent new syntax is +[source,json] +---- +{"replica":"<2","node":"#ANY","shard":"#EACH"} +---- + +The new policy rules have to be created separately using an API call <> + + +=== Rule Operators + +All the following operators can be directly used in the new policy syntax and they mean the same. + +* *equals (no operator required)*: `tag:x` means tag value must be equal to ‘x’ +* *greater than (>)*: `tag:>x` means tag value greater than ‘x’. x must be a number +* *less than (<)*: `tag:` + + +=== Create replicas in nodes with less than 5 cores only + +This rule uses the `replica` condition to define any number of replicas, but adds a pre-defined tag named `core` and uses operators for "less than 5". + +*legacy:* + +[source,text] +---- +cores:<5 +---- + +*new:* + +[source,json] +---- +{"cores":"<5", "node":"#ANY"} +---- + +=== Do not create any replicas in host 192.45.67.3 + +*legacy:* + +[source,text] +---- +host:!192.45.67.3 +---- + +*new:* + +[source,json] +---- +{"replica": 0, "host":"192.45.67.3"} +---- + + +== Defining Rules + +Rules are always defined in along with the collection in the legacy system. The new syntax allows you to specify rules globally as well as on a <>