Unable to Initiate OpenSearch After Rebooting HEAL Servers
Unable to Initiate OpenSearch After Rebooting HEAL Servers in OpenSearch Issues.
Unable to Initiate OpenSearch After Rebooting HEAL Servers#
The data collection in UI is hindered and there is no info on the data in any of the screens.
-
Check the status of the server
nomad statusExpected Output:
ID Type Priority Status Submit Date 198.51.100.1_CONTROLCENTER_1 service 50 running 2023- 07-03T11:41:29 +05:30 198.51.100.1_DATARECEIVER_1 service 50 running 2023- 07-03T11:42:20 +05:30 198.51.100.1_UISERVICE_1 service 50 running 2023- 08-05T14:48:04 +05:30 203.0.113.1_SIGNALDETECTOR_1 service 50 running 2023- 07-28T15:21:53 +05:30 A1EventHandler service 50 dead 2023- 08-23T11:56:14 +05:30 MLE service 50 dead 2023- 08-09T17:40:47 +05:30 haproxy service 50 running 2023- 07-12T15:49:49 +05:30 heal-redis-microservice service 50 running 2023- 07-28T12:26:56 +05:30 keycloak service 50 running 2023- 07-03T11:40:20 +05:30 opensearch service 50 dead 2023- 07-03T11:38:55 +05:30 percona service 50 running 2023- 07-28T12:25:28 +05:30 rabbitmq service 50 running 2023- 07-06T13:09:59 +05:30 redis service 50 running 2023- 08-09T16:02:12 +05:30The status of the OpenSearch should be running. If the OpenSearch is not running, proceed as below.
-
Check the OpenSearch standard error logs,
nomad logs -f -stderr <opensearch allocation ID>Expected Output (trimmed to the load-bearing lines):
[opensearch-node1] initialized [opensearch-node1] starting [opensearch-node1] bound or publishing to a non-loopback address, enforcing bootstrap checks ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] <== the failing check ERROR: OpenSearch did not exit normally - check the logs at /usr/share/opensearch/logs/opensearch-cluster.log [opensearch-node1] stoppingIn the above output, the standard error
bootstrap checks failedis observed, driven byvm.max_map_countbeing below the required262144. -
If the error is " bootstrap checks failed" , then the value of " vm.max_map_count" should be checked in " sysctl.conf" file.
Note: Executing the command "sysctl -w vm.max_map_count=262144 " will enable OpenSearch to start. However, this configuration change won't persist after a server reboot. To ensure the change remains effective, you must include "vm.max_map_count=262144 " in the /etc/sysctl.conf file. The modifications to " /etc/sysctl.conf" will only take effect upon server after reboot.
-
Go to the below directory:
vi /etc/sysctl.confExpected Output:
# sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). vm.max_map_count = 262144Check the value of "vm.max_map_count " (it should be 262144).
If the value is different, then update it as 262144 .
-
To update the value, execute the following command:
sysctl -w vm.max_map_count=262144Expected Output:
[root@localhost ~]# sysctl -w vm.max_map_count=262144 vm.max_map_count = 262144 -
Start the OpenSearch
nomad run opensearch -
Make sure OpenSearch should be in running status.
nomad statusExpected Output:
ID Type Priority Status Submit Date 198.51.100.1_CONTROLCENTER_1 service 50 running 2023- 07-03T11:41:29 +05:30 198.51.100.1_DATARECEIVER_1 service 50 running 2023- 07-03T11:42:20 +05:30 198.51.100.1_UISERVICE_1 service 50 running 2023- 08-05T14:48:04 +05:30 203.0.113.1_SIGNALDETECTOR_1 service 50 running 2023- 07-28T15:21:53 +05:30 A1EventHandler service 50 dead 2023- 08-23T11:56:14 +05:30 MLE service 50 dead 2023- 08-09T17:40:47 +05:30 haproxy service 50 running 2023- 07-12T15:49:49 +05:30 heal-redis-microservice service 50 running 2023- 07-28T12:26:56 +05:30 keycloak service 50 running 2023- 07-03T11:40:20 +05:30 opensearch service 50 running 2023- 07-03T11:38:55 +05:30 percona service 50 running 2023- 07-28T12:25:28 +05:30 rabbitmq service 50 running 2023- 07-06T13:09:59 +05:30
Unassigned shards are being observed#
The unassigned shards are detected when:
- The data collection/transaction is not happening.
- If there is no designated zone in OS.
Also, refer Scenarios of unassigned shards
-
Check the Cluster health status, by running the below command:
curl -ku admin:admin -XGET "https://<OpenSearch IP>:<OpenSeach port>/_cluster/health?pretty"For more information, refer to: Status information
For Example:
curl -ku admin:admin -XGET "https://192.0.2.6:9202/_cluster/health?pretty"Expected Output:
{ "cluster_name" : "Heal-OpenSearch-cluster", "status" : "Yellow", "timed_out" : false, "number_of_nodes" : 15, "number_of_data_nodes" : 9, "discovered_master" : true, "active_primary_shards" : 185, "active_shards" : 327, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 10, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0Note: If only replica shards are unassigned, the cluster status will be Yellow (all data is available, but not fully redundant).
If any primary shard is unassigned, the cluster status will be Red (some data is unavailable). Green means every primary and replica shard is assigned. -
Check and run the below command, to identify the reason for the unassigned shards
curl -ku admin:admin -XGET "https:// <opensearch IP>:<opensearch port>/_cluster/allocation/explain" jqFor Example:
curl -ku admin:admin -XGET "https://192.0.2.7:9200/_cluster/allocation/explain" | jqExpected Output:
% Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 100 2172 100 2172 0 0 86880 0 --:--:-- --:- -:-- 90500 { "index": ".opendistro_security", "shard": 0, "primary": false, "current_state": "unassigned", "unassigned_info": { "reason": "CLUSTER_RECOVERED", "at": "2023-07-03T06:11:02.250Z", "last_allocation_status": "no_attempt" }, "can_allocate": "no", "allocate_explanation": "cannot allocate because allocation is not permitted to any of the nodes", "node_allocation_decisions": [ { "node_id": "fagZH0RTTka0PEDpK9Q22g", "node_name": "opensearch-node1", "transport_address": "192.0.2.7:9300", "node_attributes": { "shard_indexing_pressure_enabled": "true" }, "node_decision": "no", "deciders": [ { "decider": "same_shard", "decision": "NO", "explanation": "a copy of this shard is already allocated to this node [[.opendistro_security][0], node[fagZH0RTTka0PEDpK9Q22g], [R], s[STARTED], a[id=j3MB5op6RGW3RUbWAiji3A]]" }, { "decider": "disk_threshold", "decision": "NO", "explanation": "the node is above the low watermark cluster setting [cluster.routing.allocation.disk.watermark.low=85%], using more disk space than the maximum allowed [85.0%], actual free: [12.486401850905986%]" } ] }, { "node_id": "xp18VnnZQFaYn0tEMvp2NA", "node_name": "opensearch-node3", "transport_address": "192.0.2.8:9300", "node_attributes": { "shard_indexing_pressure_enabled": "true" }, "node_decision": "no", "deciders": [ { "decider": "disk_threshold", "decision": "NO", "explanation": "the node is above the low watermark cluster setting [cluster.routing.allocation.disk.watermark.low=85%], using more disk space than the maximum allowed [85.0%], actual free: [13.158171188116674%]" } ] }, { "node_id": "y8GEso2_RmqDJFcBzxL8vw", "node_name": "opensearch-node2", "transport_address": "192.0.2.9:9300", "node_attributes": { "shard_indexing_pressure_enabled": "true" }, "node_decision": "no", "deciders": [ { "decider": "same_shard", "decision": "NO", "explanation": "a copy of this shard is already allocated to this node [[.opendistro_security][0], node[y8GEso2_RmqDJFcBzxL8vw], [P], s[STARTED], a[id=3aEDgIH- RyG5DrNTnNP2uQ]]" }, { "decider": "disk_threshold", "decision": "NO", "explanation": "the node is above the low watermark cluster setting [cluster.routing.allocation.disk.watermark.low=85%], using more disk space than the maximum allowed [85.0%], actual free: [12.82647394562705%]" } ] } ] } -
For Information: Check and run the below command, to identify the unassigned Indexes and the reason.
curl -k -u admin:admin -XGET "https://<opensearch IP>:<opensearch port>/_cat/shards?v&h=index,shard,prirep,state,unassigned.reason" | grep -i 'unassigned'For Example:
curl -k -u admin:admin -XGET "https://192.0.2.7:9200/_cat/shards? v&h=index,shard,prirep,state,unassigned.reason" | grep -i 'unassigned'Expected Output:
% Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 100 11561 100 11561 0 0 268k 0 --:--:-- -- :index shard prirep state unassigned.reason --:-- 268k .opendistro_security 0 r UNASSIGNED CLUSTER_RECOVERED security-auditlog-2023.08.30 0 r UNASSIGNED INDEX_CREATED -
To reassign the unassigned in primary shards, execute the below command:
curl -ku admin:admin -XPOST "https://<opensearch IP>:<opensearch port>/_cluster/reroute?retry_failed=true"For Example:
curl -ku admin:admin -XPOST "https://192.0.2.6:9202/_cluster/reroute?retry_failed=true"Expected Output:
% Total % Received % Xferd Average Speed Time Current Dload Upload Total Spent Left Speed 100 54632 100 54632 0 0 1111k 0 --:--:-- --:- -:-- 1111k { "acknowledged": true, "state": { "cluster_uuid": "Jw9E6D6xSGmfB2T3y-n0EA", "version": 13584, "state_uuid": "zcuLxItDReKAoegXrJeO6w", "master_node": "xp18VnnZQFaYn0tEMvp2NA", "blocks": {}, "nodes": { "xp18VnnZQFaYn0tEMvp2NA": { "name": "opensearch-node3", "ephemeral_id": "gRgJr38zTpiG4FvkD4-n7g", "transport_address": "192.0.2.8:9300", "attributes": { "shard_indexing_pressure_enabled": "true" } }, "fagZH0RTTka0PEDpK9Q22g": { "name": "opensearch-node1", "ephemeral_id": "KTxBqZYbTSODP8QXw-4Xqg", "transport_address": "192.0.2.7:9300", "attributes": { "shard_indexing_pressure_enabled": "true" } }, "y8GEso2_RmqDJFcBzxL8vw": { "name": "opensearch-node2", "ephemeral_id": "LfnOvvgqSZCuXqKK4W-VbQ", "transport_address": "192.0.2.9:9300", "attributes": { "shard_indexing_pressure_enabled": "true" } } }, "routing_table": { "indices": { "heal_error_kpi_a4885d6b-2e2c-485a-b52f- bb0f8af11b56_2023.w14": { "shards": { "0": [ { "state": "STARTED", "primary": true, "node": "y8GEso2_RmqDJFcBzxL8vw", "relocating_node": null, "shard": 0, "index": "heal_error_kpi_a4885d6b-2e2c-485a-b52f- bb0f8af11b56_2023.w14", "allocation_id": { "id": "zTRMcKDgQ7Ot0RcGoK9LOQ" } } ] } }, "heal_health_agent_support": { "shards": { "0": [ { "state": "STARTED", "primary": true, "node": "y8GEso2_RmqDJFcBzxL8vw", "relocating_node": null, "shard": 0, "index": "heal_health_agent_support", "allocation_id": { "id": "a9_zCCkyTa2IesDr0KhTnw" } } ] } }, "heal_error_kpi_a4885d6b-2e2c-485a-b52f- bb0f8af11b56_2023.w24": { "shards": { "0": [ { "state": "STARTED", "primary": true, "node": "y8GEso2_RmqDJFcBzxL8vw", "relocating_node": null, "shard": 0, "index": "heal_error_kpi_a4885d6b-2e2c-485a-b52f- bb0f8af11b56_2023.w24", "allocation_id": { "id": "B_Ph1uVNT7i_A1VagWgbLQ" }