Issue
- I installed the Elasticsearch license via API. After installation, I am not able to find where the JSON file is stored.
Environment
- Liferay DXP 7.4
Resolution
-
When you install the Elasticsearch license using the API, the license information is stored in the internal cluster state of Elasticsearch, not in a file on the filesystem. That is why you are not seeing any license details in the files within the configuration directory.
The Elasticsearch manages its internal state, including licensing information, within its cluster metadata. This data is stored in the Elasticsearch indices that make up the cluster state and not in the configuration files on disk. The curl command you use to check the license status retrieves the information directly from this internal state, which is kept in the memory and the data nodes of the cluster.
A few points to consider:
How the License Check Works:
Cluster State Storage: The license details are part of Elasticsearch's internal cluster state, which is distributed across the nodes in the cluster.
Persistence in Data Nodes: This internal state is stored persistently in the Elasticsearch data nodes, and it is updated automatically when you install or update a license using the API.
No JSON File: Once a license is installed using the API, it is not stored as a standalone JSON file on the server. Instead, the JSON information you uploaded is processed and stored directly in the Elasticsearch cluster state.
When you run:curl -X GET "http://localhost:9200/_license"
Elasticsearch queries its cluster state and returns the license information from there. This approach ensures that all nodes in the cluster have a consistent view of the license and that the license status is replicated across the cluster.Why the Config Folder is Empty:
The files in the configuration folder (like /etc/elasticsearch/) are generally used for static configurations that need to be read during the Elasticsearch startup, such as elasticsearch.yml, JVM options, and plugins. Since the license information is a dynamic part of the cluster state, it is managed differently and not stored in these configuration files.You don't need to worry about the absence of license details in the file system. The curl command confirms that Elasticsearch is correctly retrieving the license from its cluster state.
If you ever need to back up your cluster, make sure that your backup strategy includes the data nodes since that is where all stateful information, including licenses, is stored.This design allows Elasticsearch to manage licenses dynamically and ensures high availability by replicating the license data across the cluster nodes.