반응형
1. OpenSearch Operator로 설치할 경우 지원하지않는다. 일반 helm으로 설치시 가능하다.
helm install opensearch-single opensearch/opensearch \
--namespace logging \
--set singleNode=true \
--set persistence.enabled=false \
--set-json 'extraEnvs=[{"name": "OPENSEARCH_INITIAL_ADMIN_PASSWORD", "value": "singleNode1!"}]'
2. 설치 완료 후 접속하여 Cluster 상태를 확인한다.
상태를 확인하면 yellow로 나타는데 이는 Single Node임에도 불구하고 replicas가 1로 설정되어있어서 그렇다
curl -k -u admin:singleNode1! https://localhost:9200/_cluster/health?pretty
{
"cluster_name" : "opensearch-cluster",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"discovered_master" : true,
"discovered_cluster_manager" : true,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"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" : 83.33333333333334
}
# 아래 명령어를 통해 대충 왜 yellow 인지 알 수 있다.
curl -k -u admin:singleNode1! https://localhost:9200/_cluster/allocation/explain?pretty
3. health Status 변경
_all/_settings 명령어를 통해 모든 index 의 replicas 0으로 변경
curl -k -XPUT -u admin:singleNode1! https://localhost:9200/_all/_settings \
-H 'Content-Type: application/json' -d'
{
"index": {
"number_of_replicas": 0
}
}' --cert ./config/kirk.pem --key ./config/kirk-key.pem
# 다시 status 확인
curl -k -u admin:singleNode1! https://localhost:9200/_cluster/health?pretty
{
"cluster_name" : "opensearch-cluster",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"discovered_master" : true,
"discovered_cluster_manager" : true,
"active_primary_shards" : 6,
"active_shards" : 6,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"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.0
}
--cert 와 --key 의 경우 현재 데모인증서를 사용해서 kirk.pem 과 kirk-key.pem을 사용하였다.
데모인증서가아닌 직접 인증서를 설정했으면 설정한대로 해야한다.
또한, 해당 API는 만약 Dashbaord를 사용하면 Dashboard의 devtool로도 적용되지 않는다.
적용되게 할려면 따로 opensearch.yml 에 설정해주어야 함. 아래 url 참고
https://opensearch.org/docs/1.3/security/configuration/system-indexes/
4. 또한 설치시 replicas 0으로 설정할 수 있다. (잘안될때도 있음)
lifecycle 에 index가 replicas 0으로 생성 되도록 template을 추가하는 postStart 를 추가하면된다.
lifecycle:
postStart:
exec:
command:
- bash
- -c
- |
#!/bin/bash
until curl -s "https://localhost:9200/_cluster/heatlh" -k -u admin:singleNode1! | grep -q "green\|yellow; do
sleep 5
done
curl -k -u admin:singleNode1! -XPUT "https://localhost:9200/_index_template/single_init_template"
-H 'Content-Type: application/json' -d'{
"index_patterns": ["*"],
"template": {
"settings": {
"number_of_replicas": 0
}
}
}'
반응형
'Develop > OpenSearch / FluentBit' 카테고리의 다른 글
OpenSearch, OpenSearch Dashboard helm 설치 정리 (0) | 2025.03.06 |
---|---|
OpenSearch Operator Coordinator (0) | 2025.02.18 |
Fluent-Bit Systemd Logging (0) | 2025.02.18 |
opensearch operator read only mode (0) | 2024.12.02 |
OpenSearch Operator Certificate 설정 (0) | 2024.11.28 |