From 68c0774458f9d0697bf7875e677474bae07dd266 Mon Sep 17 00:00:00 2001 From: Cassandra Targett Date: Mon, 26 Nov 2018 12:15:15 -0600 Subject: [PATCH] SOLR-12740: revise migration docs for clarity and typos --- .../src/migrate-to-policy-rule.adoc | 140 ++++++++++-------- .../src/solrcloud-autoscaling.adoc | 2 +- 2 files changed, 82 insertions(+), 60 deletions(-) diff --git a/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc b/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc index 587147e6a38..38b0cd6baee 100644 --- a/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc +++ b/solr/solr-ref-guide/src/migrate-to-policy-rule.adoc @@ -1,4 +1,4 @@ -= Migrate to Policy Rules += Migrating Rule-Based Replica Rules to Autoscaling Policies // 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 @@ -16,52 +16,83 @@ // 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. +Creating rules for replica placement in a Solr cluster is now done with the <>. +This document outlines how to migrate from the legacy <> to an <>. -Every rule in the legacy framework can be expressed in the new syntax. Please refer to <> document for more details. +The autoscaling framework is designed to fully automate your cluster management. +However, if you do not want actions taken on your cluster in an automatic way, you can still use the framework to set rules and preferences. +With a set of rules and preferences in place, instead of taking action directly the system will suggest actions you can take manually. +The section <> describes the capabilities of an autoscaling policy in detail. +Below we'll walk through a few examples to show how you would express the your legacy rules in the autoscaling syntax. +Every rule in the legacy rule-based replica framework can be expressed in the new syntax. + +== How Rules are Defined + +One key difference between the frameworks is the way rules are defined. + +With the rule-based replica placement framework, rules are defined with the Collections API at the time of collection creation. + +The autoscaling framework, however, has its own <>. +Policies can be configured for the entire cluster or for individual collections depending on your needs. + +The following is the legacy syntax for a rule that limits the cluster to one replica for each shard in any Solr node: -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 +The equivalent rule in the autoscaling policy is: + [source,json] ---- -{"replica":"<2","node":"#ANY","shard":"#EACH"} +{"replica":"<2", "node":"#ANY", "shard":"#EACH"} ---- -The new policy rules have to be created separately using an API call <> +== Differences in Rule Syntaxes + +Many elements of defining rules are similar in both frameworks, but some elements are different. [[rule-operators1]] -== Rule Operators +=== Rule Operators -All the following operators can be directly used in the new policy syntax and they mean the same. +All of the following operators can be directly used in the new policy syntax and they mean the same in both frameworks. -* *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:)*: `tag:>x` means the tag value must be greater than `'x'`. In this case, `'x'` must be a number. +* *less than (<)*: `tag:>. + +The following examples are intended to help you translate your existing rules into new rules that fit the autoscaling framework. + +*Keep less than 2 replicas (at most 1 replica) of this collection on any node* For this rule, we define the `replica` condition with operators for "less than 2", and use a pre-defined tag named `node` to define nodes with any name. -*legacy:* - +.Rule-based replica placement framework: [source,text] ---- replica:<2,node:* ---- -*new:* - +.Autoscaling framework: [source,json] ---- {"replica":"<2","node":"#ANY"} ---- -[[keep-less-than-2-replicas--per-shard]] -=== For a given shard, keep less than 2 replicas on any node + +*For a given shard, keep less than 2 replicas on any node* For this rule, we use the `shard` condition to define any shard, the `replica` condition with operators for "less than 2", and finally a pre-defined tag named `node` to define nodes with any name. -*legacy:* - +.Rule-based replica placement framework: [source,text] ---- shard:*,replica:<2,node:* ---- -*new:* - +.Autoscaling framework: [source,json] ---- {"replica":"<2","shard":"#EACH", "node":"#ANY"} ---- -[[all-replicas-on-shard-730]] -=== Assign all replicas in shard1 to rack 730 +*Assign all replicas in shard1 to rack 730* -This rule limits the `shard` condition to 'shard1', but any number of replicas. We're also referencing a custom tag named `rack`. Before defining this rule, we will need to configure a custom Snitch which provides values for the tag `rack`. - -*legacy:* +This rule limits the `shard` condition to 'shard1', but any number of replicas. We're also referencing a custom tag named `rack`. +.Rule-based replica placement framework: [source,text] ---- shard:shard1,replica:*,rack:730 ---- -*new:* - +.Autoscaling framework: [source,json] ---- {"replica":"#ALL", "shard":"shard1", "sysprop.rack":"730"} ---- -Please note that all your nodes must be started with a system property `-Drack=` +In the rule-based replica placement framework, we needed to configure a custom Snitch which provides values for the tag `rack`. -[[less-than-5-cores]] -=== Create replicas in nodes with less than 5 cores only +With the autoscaling framework, however, we need to start all nodes with a system property to define the rack values. For example, `bin/solr start -c -Drack=`. + +*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:* - +.Rule-based replica placement framework: [source,text] ---- cores:<5 ---- -*new:* - +.Autoscaling framework: [source,json] ---- {"cores":"<5", "node":"#ANY"} ---- -[[do-not-create-on-host]] -=== Do not create any replicas in host 192.45.67.3 -*legacy:* +*Do not create any replicas in host 192.45.67.3* +.legacy syntax: [source,text] ---- host:!192.45.67.3 ---- -*new:* - +.autoscaling framework: [source,json] ---- {"replica": 0, "host":"192.45.67.3"} ---- - -[[defining-rules1]] -== 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 <> diff --git a/solr/solr-ref-guide/src/solrcloud-autoscaling.adoc b/solr/solr-ref-guide/src/solrcloud-autoscaling.adoc index 61b8b6ed1cc..5f9f1487037 100644 --- a/solr/solr-ref-guide/src/solrcloud-autoscaling.adoc +++ b/solr/solr-ref-guide/src/solrcloud-autoscaling.adoc @@ -32,4 +32,4 @@ The following sections describe the autoscaling features of SolrCloud: * <> * <> * <> -* <> +* <>