All Products
Search
Document Center

ApsaraDB for HBase:Update the configuration set

Last Updated:Jan 22, 2024

Prerequisites

HBase Shell is installed and the whitelist is configured for the HBase cluster. For more information, see Use HBase Shell to access the Search service.

Download the default template of the configuration set

Launch HBase Shell to download the default configuration set named _indexer_default and add custom business configurations based on the default configuration set.

cd alisolr-7.3.8-bin/bin
./solr zk ls /configs         # Query the existing configuration sets.
./solr zk downconfig -d . -n _indexer_default     # Download _indexer_default to the current directory.

After the preceding command is run, a directory named conf is generated in the current directory, which contains the following files: managed-schema and solrconfig.xml.

Create a configuration set

The following example shows how to create a configuration set.

  • Open the managed-schema file

  • Add two index column definitions

    <field name="name" type="string" indexed="true" stored="true" required="false" multiValued="false" />
    <field name="age" type="pint" indexed="true" stored="true" docValues="true"  multiValued="false" />

    The name column is of the STRING type. The age column is of the INT type. pint indicates INT, and plong indicates LONG. indexed=true indicates that the indexes are created for both columns. stored=true indicates that the original data needs to be stored.

You must define each new column in the file. When a large number of columns need to be added, the operation can require a lot of time. In this case, you can use the dynamicField method that is provided by the Search service, such as the definitions of dynamicField in the managed-schema file in the following figure. You need to only specify a suffix for the column name that matches a definition of dynamicField when you write the data. You do not need to define each column. For example, name_s can automatically match *_s and age_i can automatically match *_i.

  • Upload the configuration set

After you complete the modification, you can create your own configuration set. We recommend that you use one configuration set for each collection. You can run the following command to upload the configuration set:

./solr zk upconfig -d conf/ -n myconf
  • Check whether the configuration set is uploaded in the Solr web console.myconf

Recommendations

  • We recommend that you use the dynamicField method instead of separately defining each index column. This way, you can avoid frequent modifications to the managed-schema file.

  • Each index must have a configuration set. We recommend that you do not use one configuration set for multiple indexes.

  • If you need to customize a configuration set, download the _indexer_default configuration set and modify it.