The core in SOLR is like a table in the database, used to manage indexes and related configurations.
I. Example Core
The downloaded SOLR package contains the solr-4.7.0 \ example \ multicore. The folder contains two example cores: core0 and core1, for example:
Copy the package to $ solr_home $, $ solr_home $, where is the Web in your SOLR web service. xml configuration, as shown in the following configuration, where: D: \ workspace \ Lucene \ solr_home is my $ solr_home $.
<Env-entry> <Env-entry-Name> SOLR/home </env-entry-Name> <Env-entry-value> D: \ workspace \ Lucene \ solr_home </env-entry-value> <Env-entry-type> JAVA. Lang. String </env-entry-type> </Env-entry> |
Here we copy core0 to our $ solr_home $.
Now let's take a look at what is under core0. At this time, there is a conf folder, and there is nothing in it. In core0/Conf, there are two XML files, schema. xml and solrconfig. xml;
Schema. xml defines the field type and name of core0. The field is like a database field. The field type is like a database field type. The field name is like a database field name;
Solrconfig. xml describes the core0 management configuration, such as specifying the storage location of the index file, the storage location of the log file, and the manager used.
Start the SOLR service and enter the SOLR management interface. Select the core admin column, for example:
Click the Add core button to change the value of name and instancedir to core0 in the pop-up interface, that is, the name of the core0 folder copied to $ solr_home $, click the blue add core button.
We successfully added a new core to the SOLR server.
Now let's go back to $ solr_home $/core0 and find that there is an additional data folder and a core. properties file. These two things are created by SOLR itself when we operate on the SOLR Management page. Why can we see core0 on the Management page? How does the SOLR service know that there is a core0 under $ solr_home $? In fact, core. properties is still playing a role. In fact, you can manually write core. properties to create a new core.
Core. Properties
# Written by corepropertieslocator # Sat Mar 15:49:01 CST 2014 Name = core0 Config = solrconfig. xml Schema = schema. xml Datadir = Data |
2. manually create a core
Create a clj_core folder in $ solr_home $, and create a conf folder under the clj_core folder, copy the two XML files under conf In the example core0 to the newly created clj_core/conf folder. We will create a core under clj_core. the properties file is configured as follows:
Name = core1 Config = solrconfig. xml Schema = schema. xml Datadir = Data |
Restart the SOLR service and we will see our new core1 on the solr Management page. Note that the core name and the core folder can be different, but it is best to define the same name for convenient management. The core folder name is clj_core, which we created manually above. This design is unfriendly to maintenance. You 'd better change the folder name to core1 or change the core name to clj_core.
Solr4.7 New Core