Class ZkClientClusterStateProvider

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.solr.client.solrj.impl.ClusterStateProvider, org.apache.solr.common.SolrCloseable

    public class ZkClientClusterStateProvider
    extends Object
    implements org.apache.solr.client.solrj.impl.ClusterStateProvider
    Retrieves cluster state from Zookeeper
    • Constructor Detail

      • ZkClientClusterStateProvider

        public ZkClientClusterStateProvider​(ZkStateReader zkStateReader)
      • ZkClientClusterStateProvider

        public ZkClientClusterStateProvider​(Collection<String> zkHosts,
                                            String chroot)
      • ZkClientClusterStateProvider

        public ZkClientClusterStateProvider​(Collection<String> zkHosts,
                                            String chroot,
                                            boolean canUseZkACLs)
      • ZkClientClusterStateProvider

        public ZkClientClusterStateProvider​(String zkHost)
    • Method Detail

      • from

        public static ZkClientClusterStateProvider from​(org.apache.solr.client.solrj.impl.CloudSolrClient client)
        Extracts this from the client, or throws an exception if of the wrong type.
      • createFromJsonSupportingLegacyConfigName

        @Deprecated
        public static org.apache.solr.common.cloud.ClusterState createFromJsonSupportingLegacyConfigName​(int version,
                                                                                                         byte[] bytes,
                                                                                                         Set<String> liveNodes,
                                                                                                         String coll,
                                                                                                         SolrZkClient zkClient)
        Deprecated.
        Create a ClusterState from Json. This method supports legacy configName location
        Parameters:
        bytes - a byte array of a Json representation of a mapping from collection name to the Json representation of a DocCollection as written by MapWriter.write(JSONWriter). It can represent one or more collections.
        liveNodes - list of live nodes
        coll - collection name
        zkClient - ZK client
        Returns:
        the ClusterState
      • getState

        public org.apache.solr.common.cloud.ClusterState.CollectionRef getState​(String collection)
        Specified by:
        getState in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getLiveNodes

        public Set<String> getLiveNodes()
        Specified by:
        getLiveNodes in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • resolveAlias

        public List<String> resolveAlias​(String alias)
        Specified by:
        resolveAlias in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getAliasProperties

        public Map<String,​String> getAliasProperties​(String alias)
        Specified by:
        getAliasProperties in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getClusterProperty

        public Object getClusterProperty​(String propertyName)
        Specified by:
        getClusterProperty in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getClusterProperty

        public <T> T getClusterProperty​(String propertyName,
                                        T def)
        Specified by:
        getClusterProperty in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getClusterState

        public org.apache.solr.common.cloud.ClusterState getClusterState()
        Specified by:
        getClusterState in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getClusterProperties

        public Map<String,​Object> getClusterProperties()
        Specified by:
        getClusterProperties in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getPolicyNameByCollection

        public String getPolicyNameByCollection​(String coll)
        Specified by:
        getPolicyNameByCollection in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • connect

        public void connect()
        Specified by:
        connect in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • getQuorumHosts

        public String getQuorumHosts()
        Specified by:
        getQuorumHosts in interface org.apache.solr.client.solrj.impl.ClusterStateProvider
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface org.apache.solr.common.SolrCloseable
      • getZkHost

        public String getZkHost()
        Returns:
        the zkHost value used to connect to zookeeper.
      • getZkConnectTimeout

        public int getZkConnectTimeout()
      • setZkConnectTimeout

        public void setZkConnectTimeout​(int zkConnectTimeout)
        Set the connect timeout to the zookeeper ensemble in ms
      • getZkClientTimeout

        public int getZkClientTimeout()
      • setZkClientTimeout

        public void setZkClientTimeout​(int zkClientTimeout)
        Set the timeout to the zookeeper ensemble in ms