Encrypting existing 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 on a 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_name.table_name 
  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_name.table_name 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.

      Requirements:
      • The remote 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 search index.
      2. Run the dsetool command:
        dsetool upgrade_index_files keyspace_name.table_name -h IP_address [options]
        You can specify the following options for offline index encryption:
        keyspace_name.table_name
        Required. The keyspace and table names of the search index. Keyspace and table names are case-sensitive. Enclose names that contain uppercase in double quotation marks.
        -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 port
        The DSE 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. The preserved index file backup is moved to the --workspace directory. When not specified, index files from the current index are deleted.
        --workspace directory
        The workspace directory for the upgrade process. The upgraded index is created in this directory. When not specified, the default directory is the same directory that contains the search index files.
        --index directory
        The data directory that contains the search index files. When not specified, the default directory is inferred from the search index 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 search core on the local node:
    dsetool list_index_files keyspace_name.table_name [--index directory]
    where --index directory specifies the data directory that contains the search index files. When not specified, the default directory is inferred from the search 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.