Class 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 for AffinityPlacementFactory.
    • 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
      • 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 of Replica.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 as node_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 (if spreadAcrossDomains 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 the NODE_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).
      • spreadAcrossDomains

        public Boolean spreadAcrossDomains
        When this property is set to true, Solr will try to place replicas for the same shard in nodes that have different value for the SPREAD_DOMAIN_SYSPROP System property. If more replicas exist (or are being placed) than the number of different values for SPREAD_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 than maxReplicasPerShardInDomain 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 the AffinityPlacementFactory.
        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 the AffinityPlacementFactory.
        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.
      • AffinityPlacementConfig

        public AffinityPlacementConfig​(long minimalFreeDiskGB,
                                       long prioritizedFreeDiskGB,
                                       Map<String,​String> withCollection,
                                       Map<String,​String> collectionNodeType)
    • Method Detail

      • validate

        public void validate()