Class AffinityPlacementConfig
- java.lang.Object
-
- org.apache.solr.cluster.placement.plugins.AffinityPlacementConfig
-
- All Implemented Interfaces:
PlacementPluginConfig
,org.apache.solr.common.MapSerializable
,org.apache.solr.common.MapWriter
,org.apache.solr.common.NavigableObject
,org.apache.solr.common.util.ReflectMapWriter
,org.noggit.JSONWriter.Writable
public class AffinityPlacementConfig extends Object implements PlacementPluginConfig
Configuration bean forAffinityPlacementFactory
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AVAILABILITY_ZONE_SYSPROP
Name of the system property on a node indicating which (public cloud) Availability Zone that node is in.Map<String,String>
collectionNodeType
This property defines an additional constraint that the collection must be placed only on the nodes of the correct "node type".static AffinityPlacementConfig
DEFAULT
static long
DEFAULT_MINIMAL_FREE_DISK_GB
static long
DEFAULT_PRIORITIZED_FREE_DISK_GB
Integer
maxReplicasPerShardInDomain
Determines the maximum number of replicas of a particular type of a particular shard that can be placed within a single domain (as defined by the @link #SPREAD_DOMAIN_SYSPROP} System property.long
minimalFreeDiskGB
If a node has strictly less GB of free disk than this value, the node is excluded from assignment decisions.static String
NODE_TYPE_SYSPROP
Name of the system property on a node indicating the arbitrary "node type" (for example, a node more suitable for the indexing work load could be labeled asnode_type: indexing
).long
prioritizedFreeDiskGB
Replica allocation will assign replicas to nodes with at least this number of GB of free disk space regardless of the number of cores on these nodes rather than assigning replicas to nodes with less than this amount of free disk space if that's an option (if that's not an option, replicas can still be assigned to nodes with less than this amount of free space).static String
REPLICA_TYPE_SYSPROP
Name of the system property on a node indicating the type of replicas allowed on that node.static String
SPREAD_DOMAIN_SYSPROP
Name of the system property on a node indicating the spread domain group.Boolean
spreadAcrossDomains
When this property is set totrue
, Solr will try to place replicas for the same shard in nodes that have different value for theSPREAD_DOMAIN_SYSPROP
System property.static String
UNDEFINED_AVAILABILITY_ZONE
This is the "AZ" name for nodes that do not define an AZ.Map<String,String>
withCollection
This property defines an additional constraint that primary collections (keys) should be located on the same nodes as the secondary collections (values).Map<String,String>
withCollectionShards
Same aswithCollection
but ensures shard to shard correspondence.
-
Constructor Summary
Constructors Constructor Description AffinityPlacementConfig()
Zero-arguments public constructor required for deserialization - don't use.AffinityPlacementConfig(long minimalFreeDiskGB, long prioritizedFreeDiskGB)
Configuration for theAffinityPlacementFactory
.AffinityPlacementConfig(long minimalFreeDiskGB, long prioritizedFreeDiskGB, Map<String,String> withCollection, Map<String,String> collectionNodeType)
AffinityPlacementConfig(long minimalFreeDiskGB, long prioritizedFreeDiskGB, Map<String,String> withCollection, Map<String,String> withCollectionShards, Map<String,String> collectionNodeType)
Configuration for theAffinityPlacementFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
validate()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
DEFAULT_MINIMAL_FREE_DISK_GB
public static final long DEFAULT_MINIMAL_FREE_DISK_GB
- See Also:
- Constant Field Values
-
DEFAULT_PRIORITIZED_FREE_DISK_GB
public static final long DEFAULT_PRIORITIZED_FREE_DISK_GB
- See Also:
- Constant Field Values
-
DEFAULT
public static final AffinityPlacementConfig DEFAULT
-
AVAILABILITY_ZONE_SYSPROP
public static final String AVAILABILITY_ZONE_SYSPROP
Name of the system property on a node indicating which (public cloud) Availability Zone that node is in. The value is any string, different strings denote different availability zones.Nodes on which this system property is not defined are considered being in the same Availability Zone
UNDEFINED_AVAILABILITY_ZONE
(hopefully the value of this constant is not the name of a real Availability Zone :).- See Also:
- Constant Field Values
-
REPLICA_TYPE_SYSPROP
public static final String REPLICA_TYPE_SYSPROP
Name of the system property on a node indicating the type of replicas allowed on that node. The value of that system property is a comma separated list or a single string of value names ofReplica.ReplicaType
(case insensitive). If that property is not defined, that node is considered accepting all replica types (i.e. undefined is equivalent to"NRT,Pull,tlog"
).- See Also:
- Constant Field Values
-
NODE_TYPE_SYSPROP
public static final String NODE_TYPE_SYSPROP
Name of the system property on a node indicating the arbitrary "node type" (for example, a node more suitable for the indexing work load could be labeled asnode_type: indexing
). The value of this system property is a comma-separated list or a single label (labels must not contain commas), which represent a logical OR for the purpose of placement.- See Also:
- Constant Field Values
-
SPREAD_DOMAIN_SYSPROP
public static final String SPREAD_DOMAIN_SYSPROP
Name of the system property on a node indicating the spread domain group. This is used (ifspreadAcrossDomains
is set to true) to indicate this placement plugin that replicas for a particular shard should spread across nodes that have different values for this system property.- See Also:
- Constant Field Values
-
UNDEFINED_AVAILABILITY_ZONE
public static final String UNDEFINED_AVAILABILITY_ZONE
This is the "AZ" name for nodes that do not define an AZ. Should not match a real AZ name (I think we're safe)- See Also:
- Constant Field Values
-
minimalFreeDiskGB
public long minimalFreeDiskGB
If a node has strictly less GB of free disk than this value, the node is excluded from assignment decisions. Set to 0 or less to disable.
-
prioritizedFreeDiskGB
public long prioritizedFreeDiskGB
Replica allocation will assign replicas to nodes with at least this number of GB of free disk space regardless of the number of cores on these nodes rather than assigning replicas to nodes with less than this amount of free disk space if that's an option (if that's not an option, replicas can still be assigned to nodes with less than this amount of free space).
-
withCollection
public Map<String,String> withCollection
This property defines an additional constraint that primary collections (keys) should be located on the same nodes as the secondary collections (values). The plugin will assume that the secondary collection replicas are already in place and ignore candidate nodes where they are not already present.
-
collectionNodeType
public Map<String,String> collectionNodeType
This property defines an additional constraint that the collection must be placed only on the nodes of the correct "node type". The nodes can specify what type they are (one or several types, using a comma-separated list) by defining theNODE_TYPE_SYSPROP
system property. Similarly, the plugin can be configured to specify that a collection (key in the map) must be placed on one or more node type (value in the map, using comma-separated list of acceptable node types).
-
withCollectionShards
public Map<String,String> withCollectionShards
Same aswithCollection
but ensures shard to shard correspondence. should be disjoint withwithCollection
.
-
spreadAcrossDomains
public Boolean spreadAcrossDomains
When this property is set totrue
, Solr will try to place replicas for the same shard in nodes that have different value for theSPREAD_DOMAIN_SYSPROP
System property. If more replicas exist (or are being placed) than the number of different values forSPREAD_DOMAIN_SYSPROP
System property in nodes in the cluster, Solr will attempt to distribute the placement of the replicas evenly across the domains but will fail the placement if more thanmaxReplicasPerShardInDomain
are placed within a single domain. Note that the domain groups are evaluated within a particular AZ (i.e. Solr will not consider the placement of replicas in AZ1 when selecting candidate nodes for replicas in AZ2). Example usages for this config are:- Rack diversity: You want replicas in different AZs but also, within the AZ you want them in different racks
- Host diversity: You are running multiple Solr instances in the same host physical host. You want replicas in different AZs but also, within an AZ you want replicas for the same shard to go in nodes that run in different hosts
-
maxReplicasPerShardInDomain
public Integer maxReplicasPerShardInDomain
Determines the maximum number of replicas of a particular type of a particular shard that can be placed within a single domain (as defined by the @link #SPREAD_DOMAIN_SYSPROP} System property.
-
-
Constructor Detail
-
AffinityPlacementConfig
public AffinityPlacementConfig()
Zero-arguments public constructor required for deserialization - don't use.
-
AffinityPlacementConfig
public AffinityPlacementConfig(long minimalFreeDiskGB, long prioritizedFreeDiskGB)
Configuration for theAffinityPlacementFactory
.- Parameters:
minimalFreeDiskGB
- minimal free disk GB.prioritizedFreeDiskGB
- prioritized free disk GB.
-
AffinityPlacementConfig
public AffinityPlacementConfig(long minimalFreeDiskGB, long prioritizedFreeDiskGB, Map<String,String> withCollection, Map<String,String> withCollectionShards, Map<String,String> collectionNodeType)
Configuration for theAffinityPlacementFactory
.- Parameters:
minimalFreeDiskGB
- minimal free disk GB.prioritizedFreeDiskGB
- prioritized free disk GB.withCollection
- configuration of co-located collections: keys are primary collection names and values are secondary collection names.collectionNodeType
- configuration of reequired node types per collection. Keys are collection names and values are comma-separated lists of required node types.
-
-