Encrypting existing DSE Search indexes

Steps to encrypt existing DSE Search index files.

Encrypting DSE Search indexes turns on encryption only for new files. Additional steps are required to encrypt existing data. When you encrypt existing DSE Search indexes, a node restart is required.

There are several ways to encrypt existing DSE Search indexes. Choose the method that is appropriate for your environment.

Prerequisites

When using TDE secure local file system. Encryption keys are stored remotely with KMIP encryption or locally with on-server encryption.

Procedure

Encryption is enabled per core.

  1. To enable encryption for an existing core, edit the solrconfig.xml file to change the class for directoryFactory to solr.EncryptedFSDirectoryFactory:
    <directoryFactory name="DirectoryFactory" class="solr.EncryptedFSDirectoryFactory"/>
  2. Upload the changed solrconfig.xml file.
    For example, you can use dsetool to upload the changed resource file:
    dsetool reload_core keyspace.table 
    reload_core keyspace.table [option ...]
    Supports Cassandra password authentication with [-l username -p password].
    Reloads a Solr core with the specified keyspace and table name. This command preserves the case of keyspace and table names. You must use the correct case for the keyspace and table names. Reloads a core with the following options:
    Option Settings Default Description
    schema= filepath n/a Path of the schema file
    solrconfig= filepath n/a Path of the solrconfig.xml file
    distributed= true or false true
    • true - distributes and applies the reload operation to all nodes in the local DC.
    • false - applies the reload operation only to the node it was sent to.
    reindex= true or false false Works on a datacenter level. Run once per Solr-enabled datacenter.
    • true - reindexes the data.
    • false - does not reindex the data.
    deleteAll= true or false false
    • true - deletes the already existing index before reindexing; search results will return either no or partial data while the index is rebuilding.
    • false - does not delete the existing index, causing the reindex to happen in-place; search results will return partially incorrect results while the index is updating.
    Note: To reload the core and prevent reindexing, accept the default values reindex=false and deleteAll=false.

    During reindexing, a series of criteria routes sub-queries to the nodes most capable of handling them. See Shard routing for distributed queries.

  3. Restart the DataStax Enterprise node.
    Enabling encryption does not require a node restart. However, the directoryFactory changes require a node restart.
    Encryption is on only for new files. Additional steps are required to encrypt existing data.
  4. To encrypt existing files, use one of these methods:
    • Slowest option: Use dsetool to reload the core and reindex while the node is running
      dsetool reload_core keyspace.table deleteAll=true reindex=true
    • Fastest option: Requires that the local node is offline

      When your DataStax Enterprise cluster has a second remote node that is running, use dsetool to encrypt index files on the local offline node. The encryption configuration is read from the remote node. The node that contains the encryption configuration must be running. The local node is offline. The user that runs this command must have read and write permissions to the directory that contains the index files.

      1. Enable encryption for all nodes that have a Solr index.
      2. Run the dsetool command:
        dsetool upgrade_index_files keyspace.table -h IP_address [options]
        You can specify the following options for offline index encryption:
        • -h IP_address - Required. Node hostname or IP address of the remote node that contains the encryption configuration that is used for index encryption. The remote node must be running.
        • -c cassandra_port - The Cassandra port on the remote node that contains the encryption configuration.
        • --backup - Preserves the index files from the current index as a backup after successful upgrade. When not specified, index files from the current index are deleted.
        • --workspace directory - Specifies the workspace directory for the upgrade process. The upgraded index is created in this directory. When --backup is specified, the preserved index file backup is moved here. When not specified, the default directory is the same directory that contains the Solr index files.
        • --index directory - Specifies the data directory that contains the Solr index files. When not specified, the default directory is inferred from the Solr core name.
    • Simple option: But eventual and uncertain

      Just wait. As new data is added to your index, encryption occurs when indexes are compacted or merged. Since new files are encrypted, your files will eventually be encrypted.

  5. To verify which files are encrypted, use this command to list all DSE Search index files for the specified Solr core on the local node:
    dsetool list_index_files keyspace.table [--index directory]
    where --index directory specifies the data directory that contains the Solr index files. When not specified, the default directory is inferred from the Solr core name.
  6. After you verify which files are encrypted, you can encrypt existing files using a different option.

What's next

To disable encryption, disable encryption for the backing CQL table. No node restart is required.