public class CoreContainer extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CoreContainer.CoreLoadFailure |
Modifier | Constructor and Description |
---|---|
|
CoreContainer()
Create a new CoreContainer using system properties to detect the solr home
directory.
|
|
CoreContainer(NodeConfig config)
Create a new CoreContainer using the given SolrResourceLoader,
configuration and CoresLocator.
|
|
CoreContainer(NodeConfig config,
Properties properties) |
|
CoreContainer(NodeConfig config,
Properties properties,
boolean asyncSolrCoreLoad) |
|
CoreContainer(NodeConfig config,
Properties properties,
CoresLocator locator) |
|
CoreContainer(NodeConfig config,
Properties properties,
CoresLocator locator,
boolean asyncSolrCoreLoad) |
protected |
CoreContainer(Object testConstructor)
This method allows subclasses to construct a CoreContainer
without any default init behavior.
|
|
CoreContainer(SolrResourceLoader loader)
Create a new CoreContainer using the given SolrResourceLoader.
|
|
CoreContainer(String solrHome)
Create a new CoreContainer using the given solr home directory.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelCoreRecoveries() |
boolean |
checkTragicException(SolrCore solrCore) |
SolrCore |
create(String coreName,
Map<String,String> parameters)
Creates a new core, publishing the core state to the cluster
|
SolrCore |
create(String coreName,
Path instancePath,
Map<String,String> parameters,
boolean newCollection)
Creates a new core in a specified instance directory, publishing the core state to the cluster
|
static CoreContainer |
createAndLoad(Path solrHome) |
static CoreContainer |
createAndLoad(Path solrHome,
Path configFile)
Create a new CoreContainer and load its cores
|
protected <T> T |
createHandler(String path,
String handlerClass,
Class<T> clazz) |
protected void |
finalize() |
Collection<String> |
getAllCoreNames()
get a list of all the cores that are currently known, whether currently loaded or not
|
AuditLoggerPlugin |
getAuditLoggerPlugin() |
AuthenticationPlugin |
getAuthenticationPlugin() |
AuthorizationPlugin |
getAuthorizationPlugin() |
BlobRepository |
getBlobRepository() |
CollectionsHandler |
getCollectionsHandler() |
NodeConfig |
getConfig() |
ConfigSetsHandler |
getConfigSetsHandler() |
Properties |
getContainerProperties() |
SolrCore |
getCore(String name)
Gets a core by name and increase its refcount.
|
CoreDescriptor |
getCoreDescriptor(String coreName) |
List<CoreDescriptor> |
getCoreDescriptors()
Get the CoreDescriptors for all cores managed by this container
|
Map<String,CoreContainer.CoreLoadFailure> |
getCoreInitFailures()
Returns an immutable Map of Exceptions that occurred when initializing
SolrCores (either at startup, or do to runtime requests to create cores)
keyed off of the name (String) of the SolrCore that had the Exception
during initialization.
|
Path |
getCoreRootDirectory() |
Collection<SolrCore> |
getCores() |
CoresLocator |
getCoresLocator() |
ExecutorService |
getCoreZkRegisterExecutorService() |
HealthCheckHandler |
getHealthCheckHandler() |
String |
getHostName() |
InfoHandler |
getInfoHandler() |
Collection<String> |
getLoadedCoreNames()
Gets the cores that are currently loaded, i.e.
|
LogWatcher |
getLogging() |
String |
getManagementPath()
Gets the alternate path for multicore handling:
This is used in case there is a registered unnamed core (aka name is "") to
declare an alternate way of accessing named cores.
|
SolrMetricManager |
getMetricManager() |
MetricsHandler |
getMetricsHandler() |
MetricsHistoryHandler |
getMetricsHistoryHandler() |
CoreAdminHandler |
getMultiCoreHandler() |
Collection<String> |
getNamesForCore(SolrCore core)
This method is currently experimental.
|
NodeConfig |
getNodeConfig() |
PackageLoader |
getPackageLoader() |
PackageStoreAPI |
getPackageStoreAPI() |
PKIAuthenticationPlugin |
getPkiAuthenticationPlugin() |
OrderedExecutor |
getReplayUpdatesExecutor() |
SolrRequestHandler |
getRequestHandler(String path) |
PluginBag<SolrRequestHandler> |
getRequestHandlers() |
SolrResourceLoader |
getResourceLoader() |
ShardHandlerFactory |
getShardHandlerFactory()
The default ShardHandlerFactory used to communicate with other solr instances
|
String |
getSolrHome() |
long |
getStatus() |
TransientSolrCoreCache |
getTransientCache() |
CoreDescriptor |
getUnloadedCoreDescriptor(String cname)
Gets a solr core descriptor for a core that is not loaded.
|
UpdateShardHandler |
getUpdateShardHandler() |
ZkController |
getZkController() |
boolean |
isCoreLoading(String name) |
boolean |
isLoaded(String name)
Determines whether the core is already loaded or not but does NOT load the core
|
boolean |
isLoadedNotPendingClose(String name) |
boolean |
isSharedFs(CoreDescriptor cd) |
boolean |
isShutDown() |
boolean |
isZooKeeperAware() |
void |
load()
Load the cores defined for this CoreContainer
|
BackupRepository |
newBackupRepository(Optional<String> repositoryName)
This method instantiates a new instance of BackupRepository.
|
void |
queueCoreToClose(SolrCore coreToClose) |
protected SolrCore |
registerCore(CoreDescriptor cd,
SolrCore core,
boolean registerInZk,
boolean skipRecovery) |
void |
reload(String name)
Recreates a SolrCore.
|
void |
rename(String name,
String toName) |
boolean |
repairCoreProperty(CoreDescriptor cd,
String prop) |
void |
runAsync(Runnable r)
Run an arbitrary task in it's own thread.
|
void |
securityNodeChanged() |
void |
shutdown() |
void |
swap(String n0,
String n1)
Swaps two SolrCore descriptors.
|
void |
unload(String name)
Unload a core from this container, leaving all files on disk
|
void |
unload(String name,
boolean deleteIndexDir,
boolean deleteDataDir,
boolean deleteInstanceDir)
Unload a core from this container, optionally removing the core's data and configuration
|
void |
waitForLoadingCore(String name,
long timeoutMs) |
void |
waitForLoadingCoresToFinish(long timeoutMs)
If using asyncSolrCoreLoad=true, calling this after
load() will
not return until all cores have finished loading. |
protected final Map<String,CoreContainer.CoreLoadFailure> coreInitFailures
protected volatile CoreAdminHandler coreAdminHandler
protected volatile CollectionsHandler collectionsHandler
protected volatile HealthCheckHandler healthCheckHandler
protected volatile ConfigSetsHandler configSetsHandler
protected volatile Properties containerProperties
protected final ZkContainer zkSys
protected volatile ShardHandlerFactory shardHandlerFactory
protected volatile LogWatcher logging
protected final NodeConfig cfg
protected final SolrResourceLoader loader
protected final String solrHome
protected final CoresLocator coresLocator
protected volatile SecurityConfHandler securityConfHandler
protected volatile SolrMetricManager metricManager
protected volatile String metricTag
protected volatile SolrMetricsContext solrMetricsContext
protected MetricsHandler metricsHandler
protected volatile MetricsHistoryHandler metricsHistoryHandler
protected volatile MetricsCollectorHandler metricsCollectorHandler
protected volatile AutoscalingHistoryHandler autoscalingHistoryHandler
public static final long LOAD_COMPLETE
public static final long CORE_DISCOVERY_COMPLETE
public static final long INITIAL_CORE_LOAD_COMPLETE
protected volatile AutoScalingHandler autoScalingHandler
public CoreContainer()
load()
public CoreContainer(SolrResourceLoader loader)
loader
- the SolrResourceLoaderload()
public CoreContainer(String solrHome)
solrHome
- a String containing the path to the solr home directoryload()
public CoreContainer(NodeConfig config)
config
- a ConfigSolr representation of this container's configurationload()
public CoreContainer(NodeConfig config, Properties properties)
public CoreContainer(NodeConfig config, Properties properties, boolean asyncSolrCoreLoad)
public CoreContainer(NodeConfig config, Properties properties, CoresLocator locator)
public CoreContainer(NodeConfig config, Properties properties, CoresLocator locator, boolean asyncSolrCoreLoad)
protected CoreContainer(Object testConstructor)
testConstructor
- pass (Object)null.public BackupRepository newBackupRepository(Optional<String> repositoryName)
repositoryName
- The name of the backup repository (Optional).
If not specified, a default implementation is used.public ExecutorService getCoreZkRegisterExecutorService()
public SolrRequestHandler getRequestHandler(String path)
public PluginBag<SolrRequestHandler> getRequestHandlers()
public static CoreContainer createAndLoad(Path solrHome)
public static CoreContainer createAndLoad(Path solrHome, Path configFile)
solrHome
- the solr home directoryconfigFile
- the file containing this container's configurationpublic Properties getContainerProperties()
public PKIAuthenticationPlugin getPkiAuthenticationPlugin()
public SolrMetricManager getMetricManager()
public MetricsHandler getMetricsHandler()
public MetricsHistoryHandler getMetricsHistoryHandler()
public OrderedExecutor getReplayUpdatesExecutor()
public PackageLoader getPackageLoader()
public PackageStoreAPI getPackageStoreAPI()
public void load()
public void securityNodeChanged()
public boolean isShutDown()
public void shutdown()
public void cancelCoreRecoveries()
protected void finalize() throws Throwable
public CoresLocator getCoresLocator()
protected SolrCore registerCore(CoreDescriptor cd, SolrCore core, boolean registerInZk, boolean skipRecovery)
public SolrCore create(String coreName, Map<String,String> parameters)
coreName
- the core nameparameters
- the core parameterspublic SolrCore create(String coreName, Path instancePath, Map<String,String> parameters, boolean newCollection)
coreName
- the core nameinstancePath
- the instance directoryparameters
- the core parameterspublic boolean isSharedFs(CoreDescriptor cd)
public Collection<SolrCore> getCores()
public Collection<String> getLoadedCoreNames()
Put another way, this will not return any names of cores that are lazily loaded but have not been called for yet or are transient and either not loaded or have been swapped out.
public Collection<String> getNamesForCore(SolrCore core)
public Collection<String> getAllCoreNames()
public Map<String,CoreContainer.CoreLoadFailure> getCoreInitFailures()
While the Map returned by this method is immutable and will not change once returned to the client, the source data used to generate this Map can be changed as various SolrCore operations are performed:
public void reload(String name)
name
- the name of the SolrCore to reloadpublic void unload(String name)
name
- the name of the core to unloadpublic void unload(String name, boolean deleteIndexDir, boolean deleteDataDir, boolean deleteInstanceDir)
name
- the name of the core to unloaddeleteIndexDir
- if true, delete the core's index on closedeleteDataDir
- if true, delete the core's data directory on closedeleteInstanceDir
- if true, delete the core's instance directory on closepublic List<CoreDescriptor> getCoreDescriptors()
public CoreDescriptor getCoreDescriptor(String coreName)
public Path getCoreRootDirectory()
public SolrCore getCore(String name)
name
- the core nameSolrCoreInitializationException
- if a SolrCore with this name failed to be initializedSolrCore.close()
public BlobRepository getBlobRepository()
public void waitForLoadingCoresToFinish(long timeoutMs)
load()
will
not return until all cores have finished loading.timeoutMs
- timeout, upon which method simply returnspublic void waitForLoadingCore(String name, long timeoutMs)
public CoreAdminHandler getMultiCoreHandler()
public CollectionsHandler getCollectionsHandler()
public HealthCheckHandler getHealthCheckHandler()
public InfoHandler getInfoHandler()
public ConfigSetsHandler getConfigSetsHandler()
public String getHostName()
public String getManagementPath()
public LogWatcher getLogging()
public boolean isLoaded(String name)
public boolean isLoadedNotPendingClose(String name)
public void queueCoreToClose(SolrCore coreToClose)
public CoreDescriptor getUnloadedCoreDescriptor(String cname)
cname
- - name of the unloaded core descriptor to load. NOTE:public String getSolrHome()
public boolean isZooKeeperAware()
public ZkController getZkController()
public NodeConfig getConfig()
public ShardHandlerFactory getShardHandlerFactory()
public UpdateShardHandler getUpdateShardHandler()
public SolrResourceLoader getResourceLoader()
public boolean isCoreLoading(String name)
public AuthorizationPlugin getAuthorizationPlugin()
public AuthenticationPlugin getAuthenticationPlugin()
public AuditLoggerPlugin getAuditLoggerPlugin()
public NodeConfig getNodeConfig()
public long getStatus()
public TransientSolrCoreCache getTransientCache()
public boolean repairCoreProperty(CoreDescriptor cd, String prop)
cd
- CoreDescriptor, presumably a deficient oneprop
- The property that needs to be repaired.See SOLR-11503, This can be removed when there's no chance we'll need to upgrade a Solr installation created with legacyCloud=true from 6.6.1 through 7.1
public boolean checkTragicException(SolrCore solrCore)
solrCore
- the core against which we check if there has been a tragic exceptionIndexWriter.getTragicException()
public void runAsync(Runnable r)
WARNING: Solr wil not be able to shut down gracefully until this task completes!
A significant upside of using this method vs creating your own ExecutorService is that your code
does not have to properly shutdown executors which typically is risky from a unit testing
perspective since the test framework will complain if you don't carefully ensure the executor
shuts down before the end of the test. Also the threads running this task are sure to have
a proper MDC for logging.
Normally, one uses SolrCore.runAsync(Runnable)
if possible, but in some cases
you might need to execute a task asynchronously when you could be running on a node with no
cores, and then use of this method is indicated.
r
- the task to runCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.