ソースを参照

HUE-4021 [libsolr] Allow customization of the Solr path in ZooKeeper

Romain Rigaux 9 年 前
コミット
9543e7a113

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -1063,6 +1063,9 @@
   # Choose whether Hue should validate certificates received from the server.
   # Choose whether Hue should validate certificates received from the server.
   ## ssl_cert_ca_verify=true
   ## ssl_cert_ca_verify=true
 
 
+  # Default path to Solr in ZooKeeper.
+  ## solr_zk_path=/solr
+
 
 
 ###########################################################################
 ###########################################################################
 # Settings to configure Solr Indexer
 # Settings to configure Solr Indexer

+ 3 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -1067,6 +1067,9 @@
   # Choose whether Hue should validate certificates received from the server.
   # Choose whether Hue should validate certificates received from the server.
   ## ssl_cert_ca_verify=true
   ## ssl_cert_ca_verify=true
 
 
+  # Default path to Solr in ZooKeeper.
+  ## solr_zk_path=/solr
+
 
 
 ###########################################################################
 ###########################################################################
 # Settings to configure Solr Indexer
 # Settings to configure Solr Indexer

+ 1 - 1
desktop/libs/indexer/src/indexer/conf.py

@@ -85,7 +85,7 @@ SOLRCTL_PATH = Config(
   type=str,
   type=str,
   dynamic_default=solrctl)
   dynamic_default=solrctl)
 
 
-# Deprecated
+# Deprecated and not used anymore
 SOLR_ZK_ENSEMBLE = Config(
 SOLR_ZK_ENSEMBLE = Config(
   key="solr_zk_ensemble",
   key="solr_zk_ensemble",
   help=_t("Zookeeper ensemble."),
   help=_t("Zookeeper ensemble."),

+ 2 - 1
desktop/libs/indexer/src/indexer/controller.py

@@ -25,6 +25,7 @@ from django.utils.translation import ugettext as _
 
 
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from libsolr.api import SolrApi
 from libsolr.api import SolrApi
+from libsolr.conf import SOLR_ZK_PATH
 from libzookeeper.conf import ENSEMBLE
 from libzookeeper.conf import ENSEMBLE
 from libzookeeper.models import ZookeeperClient
 from libzookeeper.models import ZookeeperClient
 from search.conf import SOLR_URL, SECURITY_ENABLED
 from search.conf import SOLR_URL, SECURITY_ENABLED
@@ -42,7 +43,7 @@ ZK_SOLR_CONFIG_NAMESPACE = 'configs'
 
 
 
 
 def get_solr_ensemble():
 def get_solr_ensemble():
-  return '%s/solr' % ENSEMBLE.get()
+  return '%s%s' % (ENSEMBLE.get(), SOLR_ZK_PATH.get())
 
 
 
 
 class CollectionManagerController(object):
 class CollectionManagerController(object):

+ 1 - 4
desktop/libs/indexer/src/indexer/controller2.py

@@ -25,6 +25,7 @@ from django.utils.translation import ugettext as _
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.exceptions_renderable import PopupException
 from desktop.lib.i18n import smart_str
 from desktop.lib.i18n import smart_str
 from indexer.conf import CORE_INSTANCE_DIR
 from indexer.conf import CORE_INSTANCE_DIR
+from indexer.controller import get_solr_ensemble
 from indexer.utils import copy_configs
 from indexer.utils import copy_configs
 from libsolr.api import SolrApi
 from libsolr.api import SolrApi
 from libsentry.conf import is_enabled
 from libsentry.conf import is_enabled
@@ -40,10 +41,6 @@ FLAGS = [('I', 'indexed'), ('T', 'tokenized'), ('S', 'stored'), ('M', 'multivalu
 ZK_SOLR_CONFIG_NAMESPACE = 'configs'
 ZK_SOLR_CONFIG_NAMESPACE = 'configs'
 
 
 
 
-def get_solr_ensemble():
-  return '%s/solr' % ENSEMBLE.get()
-
-
 class IndexControllerException(Exception):
 class IndexControllerException(Exception):
   pass
   pass
 
 

+ 7 - 0
desktop/libs/libsolr/src/libsolr/conf.py

@@ -27,3 +27,10 @@ SSL_CERT_CA_VERIFY = Config(
   dynamic_default=default_ssl_validate,
   dynamic_default=default_ssl_validate,
   type=coerce_bool
   type=coerce_bool
 )
 )
+
+SOLR_ZK_PATH = Config(
+  key="solr_zk_path",
+  help=_t("Default path to Solr in ZooKeeper"),
+  default='/solr',
+  type=str
+)