{"id":30047589,"url":"https://github.com/tmax-cloud/install-opensearch","last_synced_at":"2026-03-01T16:33:49.340Z","repository":{"id":38205283,"uuid":"436508852","full_name":"tmax-cloud/install-opensearch","owner":"tmax-cloud","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-14T09:02:32.000Z","size":7366,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T09:57:50.198Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tmax-cloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-09T06:36:37.000Z","updated_at":"2023-11-23T08:57:25.000Z","dependencies_parsed_at":"2023-02-05T00:33:20.953Z","dependency_job_id":null,"html_url":"https://github.com/tmax-cloud/install-opensearch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tmax-cloud/install-opensearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmax-cloud%2Finstall-opensearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmax-cloud%2Finstall-opensearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmax-cloud%2Finstall-opensearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmax-cloud%2Finstall-opensearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tmax-cloud","download_url":"https://codeload.github.com/tmax-cloud/install-opensearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tmax-cloud%2Finstall-opensearch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29974746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:18:32.386Z","status":"ssl_error","status_checked_at":"2026-03-01T16:18:04.258Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-07T09:56:33.873Z","updated_at":"2026-03-01T16:33:49.328Z","avatar_url":"https://github.com/tmax-cloud.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Opensearch 기능 가이드\n* [Opensearch 기본 가이드](https://github.com/tmax-cloud/install-opensearch/blob/main/docs/README-basic.md)\n* [Opensearch Plugin 가이드](https://github.com/tmax-cloud/install-opensearch/blob/main/docs/README-plugin.md)\n* [EFK-OpenSearch Migration 및 Snapshot 가이드](https://github.com/tmax-cloud/install-opensearch/blob/main/docs/README-snapshot.md)\n* [Opensearch Role 설정 가이드](https://github.com/tmax-cloud/install-opensearch/blob/main/docs/README-roles.md)\n* [Opensearch Trace_Analytics 사용 가이드](https://github.com/tmax-cloud/install-opensearch/blob/main/docs/README-trace_analytics.md)\n\n# Opensearch 설치 가이드\n\n## 개요\n* Opensearch Stack은 Opensearch, Opensearch-Dashboards, Fluentd로 구성된 플랫폼 조합이다.\n* K8S 클러스터로부터 Fluentd가 수집한 로그를 Opensearch에 적재하면, Opensearch는 수집된 로그를 저장하고 요청에 따라 검색 기능을 제공한다. 그리고 Opensearch-Dashboards를 통해 Opensearch에 적재된 데이터를 시각화한다.\n\n## 구성 요소 및 버전\n* Opensearch ([opensearchproject/opensearch:1.3.7](https://hub.docker.com/r/opensearchproject/opensearch))\n* Opensearch dashboard ([opensearchproject/opensearch-dashboards:1.3.7](https://hub.docker.com/r/opensearchproject/opensearch-dashboards))\n* Busybox ([busybox:1.32.0](https://hub.docker.com/layers/busybox/library/busybox/1.32.0/images/sha256-414aeb860595d7078cbe87abaeed05157d6b44907fbd7db30e1cfba9b6902448?context=explore))\n* Fluentd ([docker.io/tmaxcloudck/hypercloud:fluentd-v1.15.3-debian-elasticsearch-1.0](https://hub.docker.com/layers/tmaxcloudck/hypercloud/fluentd-v1.15.3-debian-elasticsearch-1.0/images/sha256-14539981f57cbac47ef53e38ac23419b9a0614803c120d9d38b3db50c0295c54?context=explore))\n    * elasticsearch plugin이 적용된 최신 버전 fluentd와 동일한 이미지에 opensearch output plugin을 추가하여 생성한 이미지\n* Rightsizing Plugin ([docker.io/tmaxcloudck/rightsizing-opensearch-plugin:demo](https://hub.docker.com/repository/docker/tmaxcloudck/rightsizing-opensearch-plugin))\n\n## Prerequisites\n* 필수 모듈\n  * [RookCeph](https://github.com/tmax-cloud/hypersds-wiki/) \n  * [Hyperauth](https://github.com/tmax-cloud/hyperauth)\n  * [Cert-manager](https://github.com/tmax-cloud/install-cert-manager)\n\n## 폐쇄망 설치 가이드\n* 설치를 진행하기 전 아래의 과정을 통해 필요한 이미지 및 yaml 파일을 준비한다.\n* 그 후, Install Step을 진행하면 된다.\n1. 사용하는 image repository에 Opensearch 설치 시 필요한 이미지를 push한다. \n\n    * 작업 디렉토리 생성 및 환경 설정\n    ```bash\n    $ mkdir -p ~/opensearch-install\n    $ export OS_HOME=~/opensearch-install\n    $ cd $OS_HOME\n    $ export OS_VERSION=1.3.7\n    $ export DASHBOARD_VERSION=1.3.7\n    $ export PG_IMAGE_PATH=rightsizing-opensearch-plugin:demo\n    $ export BUSYBOX_VERSION=1.32.0\n    $ export FLUENTD_VERSION=fluentd-v1.15.3-debian-elasticsearch-1.0\n    $ export REGISTRY={ImageRegistryIP:Port}\n    ```\n    * 외부 네트워크 통신이 가능한 환경에서 필요한 이미지를 다운받는다.\n    ```bash\n    $ sudo docker pull opensearchproject/opensearch:${OS_VERSION}\n    $ sudo docker save opensearchproject/opensearch:${OS_VERSION} \u003e opensearch_${OS_VERSION}.tar\n    $ sudo docker pull opensearchproject/opensearch-dashboards:${DASHBOARD_VERSION}\n    $ sudo docker save opensearchproject/opensearch-dashboards:${DASHBOARD_VERSION} \u003e dashboard_${DASHBOARD_VERSION}.tar\n    $ sudo docker pull busybox:${BUSYBOX_VERSION}\n    $ sudo docker save busybox:${BUSYBOX_VERSION} \u003e busybox_${BUSYBOX_VERSION}.tar\n    $ sudo docker pull docker.io/tmaxcloudck/${PG_IMAGE_PATH}\n    $ sudo docker save docker.io/tmaxcloudck/${PG_IMAGE_PATH} \u003e ${PG_IMAGE_PATH}.tar\n    $ sudo docker pull docker.io/tmaxcloudck/hypercloud:${FLUENTD_VERSION}\n    $ sudo docker save docker.io/tmaxcloudck/hypercloud:${FLUENTD_VERSION} \u003e fluentd_${FLUENTD_VERSION}.tar\n    ```\n  \n2. 위의 과정에서 생성한 tar 파일들을 폐쇄망 환경으로 이동시킨 뒤 사용하려는 registry에 이미지를 push한다.\n    ```bash\n    $ sudo docker load \u003c opensearch_${OS_VERSION}.tar\n    $ sudo docker load \u003c dashboard_${DASHBOARD_VERSION}.tar\n    $ sudo docker load \u003c busybox_${BUSYBOX_VERSION}.tar\n    $ sudo docker load \u003c ${PG_IMAGE_PATH}.tar\n    $ sudo docker load \u003c fluentd_${FLUENTD_VERSION}.tar\n    \n    $ sudo docker tag opensearchproject/opensearch:${OS_VERSION} ${REGISTRY}/opensearchproject/opensearch:${OS_VERSION}\n    $ sudo docker tag opensearchproject/opensearch-dashboards:${DASHBOARD_VERSION} ${REGISTRY}/opensearchproject/opensearch-dashboards:${DASHBOARD_VERSION}\n    $ sudo docker tag busybox:${BUSYBOX_VERSION} ${REGISTRY}/busybox:${BUSYBOX_VERSION}\n    $ sudo docker tag docker.io/tmaxcloudck/${PG_IMAGE_PATH} ${REGISTRY}/${PG_IMAGE_PATH}\n    $ sudo docker tag docker.io/tmaxcloudck/hypercloud:${FLUENTD_VERSION} ${REGISTRY}/hypercloud:${FLUENTD_VERSION}\n    \n    $ sudo docker push ${REGISTRY}/opensearchproject/opensearch:${OS_VERSION}\n    $ sudo docker push ${REGISTRY}/opensearchproject/opensearch-dashboards:${DASHBOARD_VERSION}\n    $ sudo docker push ${REGISTRY}/busybox:${BUSYBOX_VERSION}\n    $ sudo docker push ${REGISTRY}/${PG_IMAGE_PATH}\n    $ sudo docker push ${REGISTRY}/hypercloud:${FLUENTD_VERSION}\n    ```\n\n## Step 0. opensearch.config 설정\n* 목적 : `yaml/opensearch.config 파일에 설치를 위한 정보 기입`\n* 순서: \n\t* 환경에 맞는 config 내용 작성\n\t\t* OS_VERSION\n\t\t\t* OpenSearch 의 버전\n\t\t\t* ex) 1.3.7\n\t\t* DASHBOARD_VERSION\n\t\t\t* Opensearch-Dashboards 의 버전\n\t\t\t* ex) 1.3.7\n\t\t* BUSYBOX_VERSION\n\t\t\t* Busybox 의 버전\n\t\t\t* ex) 1.32.0\n        * HYPERAUTH_URL\n            * Hyperauth 의 URL\n            * ex) hyperauth.tmaxcloud.org\n        * OPENSEARCH_CLIENT_SECRET\n            * Hyperauth 에 생성된 opensearch client 의 secret\n            * ex) 22a985f7-c12d-4812-bd4e-bd598e1df7e8\n        * RS_PLUGIN\n            * OpenSearch-Dashboards의 Rightsizing plugin 사용 유무, boolean\n            * ex) true\n        *  PG_IMAGE_PATH\n            * OpenSearch-Dashboards Plugin 이미지 레포와 버전\n            * ex) rightsizing-opensearch-plugin:demo\n        *  CUSTOM_DOMAIN_NAME\n            * Ingress로 접근 요청할 사용자 지정 도메인 이름\n            * ex) tmaxcloud.org\n\t\t* FLUENTD_VERSION\n\t\t\t* FLUENTD_VERSION 의 버전\n\t\t\t* ex) fluentd-v1.15.3-debian-elasticsearch-1.0\n\t\t* BUSYBOX_VERSION\n\t\t\t* BUSYBOX_VERSION 의 버전\n\t\t\t* ex) 1.32.0\n\t\t* STORAGECLASS_NAME\n\t\t\t* OpenSearch가 사용할 StorageClass 의 이름\n            * {STORAGECLASS_NAME} 그대로 유지시 default storageclass 사용\n\t\t\t* ex) csi-cephfs-sc\n\t\t* REGISTRY\n\t\t\t* 폐쇄망 사용시 image repository의 주소\n\t\t\t* 폐쇄망 아닐시 {REGISTRY} 그대로 유지\n\t\t\t* ex) 192.168.171:5000\n## Hyperauth 연동\n* 목적: `Opensearch-dashboards와 Hyperauth 연동`\n* 순서:\n    *  hyperauth에서 client 생성\n    \t* Client protocol = openid-connect\n    \t* Access type = confidential \n    \t* Standard Flow Enabled = On \n    \t* Direct Access Grants Enabled = On\n    \t* Valid Redirect URIs: '*'\n    * Client \u003e opensearch \u003e Credentials \u003e client_secret 복사 후 OPENSEARCH_CLIENT_SECRET을 채운다.\n    * Client \u003e opensearch \u003e Mappers \u003e add builtin 클릭 후 'client roles'에 체크하여 Add selected 클릭\n    * Client \u003e opensearch \u003e Mappers \u003e client roles 선택 후 설정 변경\n        * Client ID = opensearch\n    \t* Token Claim Name = roles\n    \t* Add to ID token = On\n    \t* Add to access token = On\n    \t* Add to userinfo = On\n    * Client \u003e opensearch \u003e roles \u003e add role 클릭 후 'opensearch-admin' role 생성\n    * Opensearch-Dashboards를 사용하고자 하는 사용자의 계정의 Role Mappings 설정에서 Client Roles에서 'opensearch' 선택 후 'opensearch-admin'을 적용한다.\n\n    * client 생성\n    ![image](figure/client-page.png)\n    * mapper 생성\n    ![image](figure/client-mapper.png)\n    * role-mapping\n    ![image](figure/mapping.png)\n\n## Step 1. installer 실행\n* 목적 : `설치를 위한 shell script 실행`\n* 순서: \n\t* 권한 부여 및 실행\n\t``` bash\n\t$ sudo chmod +x yaml/install.sh\n\t$ sudo chmod +x yaml/uninstall.sh\n\t$ ./yaml/install.sh\n\t```\n\n## 비고\n* Dashboard의 서비스 타입 변경을 원하는 경우\n    * yaml/02_opensearch-dashboards.yaml 파일에서 Service의 spec.type 수정\n\n## 삭제 가이드\n* 목적 : `삭제를 위한 shell script 실행`\n* 순서: \n\t* 실행\n\t``` bash\n\t$ ./yaml/uninstall.sh\n\t```\n\n## 수동 설치 가이드\n## Prerequisites\n1. Namespace 생성\n    * Opensearch를 설치할 namespace를 생성한다.\n    ```bash\n    $ kubectl create ns kube-logging\n    ```\n2. 변수 export\n    * 다운 받을 버전을 export한다. \n    ```bash\n    $ export OS_VERSION=1.3.7\n    $ export DASHBOARD_VERSION=1.3.7\n    $ export FLUENTD_VERSION=fluentd-v1.15.3-debian-elasticsearch-1.0\n    $ export BUSYBOX_VERSION=1.32.0\n    $ export PG_IMAGE_PATH=rightsizing-opensearch-plugin:demo\n    $ export STORAGECLASS_NAME=csi-cephfs-sc\n    ```\n    * Hyperauth 연동 관련 및 기타 스펙을 export 한다.\n    ```bash\n    $ export RS_PLUGIN=true #disable 시 false\n    $ export HYPERAUTH_URL=hyperauth.tmaxcloud.org\n    $ export OPENSEARCH_CLIENT_SECRET=22a985f7-c12d-4812-bd4e-bd598e1df7e8\n    $ export CUSTOM_DOMAIN_NAME=tmaxcloud.org\n    ```\n3. Plugin 설정을 위한 plugin-setting.sh를 실행한다.\n   ```bash\n   $ sudo chmod +x yaml/plugin-setting.sh\n   $ ./yaml/plugin-setting.sh\n   ```\n* 비고  \n    * 이하 인스톨 가이드는 StorageClass 이름이 csi-cephfs-sc 라는 가정하에 진행한다.\n    * 재설치 시 Rightsizing plugin 설정을 변경할 경우\n        * ex) rightsizing plugin disable로 변경 시 \n        * export RS_PLUGIN=false 로 변수를 새로 export 후 plugin-setting.sh을 실행한다.\n\n## Install Steps\n0. [Opensearch yaml 수정](https://github.com/chaejin-lee/install-opensearch/blob/master/README.md#step-0-opensearch-yaml-%EC%88%98%EC%A0%95)\n1. [OpenSearch 설치](https://github.com/chaejin-lee/install-opensearch/blob/master/README.md#step-1-opensearch-%EC%84%A4%EC%B9%98)\n2. [OpenSearch-Dashboards 설치](https://github.com/chaejin-lee/install-opensearch/blob/master/README.md#step-2-opensearch-dashboards-%EC%84%A4%EC%B9%98)\n3. [Fluentd 설치](https://github.com/chaejin-lee/install-opensearch/blob/master/README.md#step-3-fluentd-%EC%84%A4%EC%B9%98)\n\n## Step 0. opensearch-stack yaml 수정\n* 목적 : `opensearch-stack yaml에 이미지 registry, 버전 및 노드 정보를 수정`\n* 생성 순서 : \n    * 아래의 command를 사용하여 사용하고자 하는 image 버전을 입력한다.\n\t```bash\n\t$ sed -i 's/{BUSYBOX_VERSION}/'${BUSYBOX_VERSION}'/g' 01_opensearch.yaml\n\t$ sed -i 's/{OS_VERSION}/'${OS_VERSION}'/g' 01_opensearch.yaml\n\t$ sed -i 's/{HYPERAUTH_URL}/'${HYPERAUTH_URL}'/g' 01_opensearch.yaml\n\t$ sed -i 's/{STORAGECLASS_NAME}/'${STORAGECLASS_NAME}'/g' 01_opensearch.yaml\n    $ sed -i 's/{DASHBOARD_VERSION}/'${DASHBOARD_VERSION}'/g' 02_opensearch-dashboards.yaml\n    $ sed -i 's/{PG_IMAGE_PATH}/'${PG_IMAGE_PATH}'/g' 02_opensearch-dashboards.yaml\n    $ sed -i 's/{HYPERAUTH_URL}/'${HYPERAUTH_URL}'/g' 02_opensearch-dashboards.yaml\n    $ sed -i 's/{OPENSEARCH_CLIENT_SECRET}/'${OPENSEARCH_CLIENT_SECRET}'/g' 02_opensearch-dashboards.yaml\n    $ sed -i 's/{CUSTOM_DOMAIN_NAME}/'${CUSTOM_DOMAIN_NAME}'/g' 02_opensearch-dashboards.yaml\n\t$ sed -i 's/{FLUENTD_VERSION}/'${FLUENTD_VERSION}'/g' 03_fluentd.yaml\n  \t$ sed -i 's/{FLUENTD_VERSION}/'${FLUENTD_VERSION}'/g' 03_fluentd_cri-o.yaml\n\t```\n* 비고 :\n    * `폐쇄망에서 설치를 진행하여 별도의 image registry를 사용하는 경우 registry 정보를 추가로 설정해준다.`\n\t```bash\n\t$ sed -i 's/docker.io\\/opensearchproject\\/opensearch/'${REGISTRY}'\\/opensearchproject\\/opensearch/g' 01_opensearch.yaml\n\t$ sed -i 's/busybox/'${REGISTRY}'\\/busybox/g' 01_opensearch.yaml\n\t$ sed -i 's/docker.io\\/opensearchproject\\/opensearch-dashboards/'${REGISTRY}'\\/opensearchproject\\/opensearch-dashboards/g' 02_opensearch-dashboards.yaml\n\t$ sed -i 's/docker.io\\/tmaxcloudck/'${REGISTRY}'/g' 02_opensearch-dashboards.yaml\n\t$ sed -i 's/docker.io\\/tmaxcloudck/'${REGISTRY}'/g' 03_fluentd.yaml\n\t$ sed -i 's/docker.io\\/tmaxcloudck/'${REGISTRY}'/g' 03_fluentd_cri-o.yaml\n\t```    \n    \n## Step 1. OpenSearch 설치\n* 목적 : `OpenSearch 설치`\n* 생성 순서 : \n    * [01_opensearch.yaml](yaml/01_opensearch.yaml) 실행\n\t```bash\n\t$ kubectl apply -f 01_opensearch.yaml\n\t```     \n* 비고 :\n    * StorageClass 이름이 csi-cephfs-sc가 아니라면 환경에 맞게 수정해야 한다.\n\n## Step 2. OpenSearch-Dashboards 설치\n* 목적 : `Opensearch의 UI 모듈인 Opensearch-Dashboards를 설치`\n* 생성 순서 : [02_opensearch-dashboards.yaml](yaml/02_opensearch-dashboards.yaml) 실행 \n    ```bash\n    $ kubectl apply -f 02_opensearch-dashboards.yaml\n    ```\n![image](figure/dashboards.png)\n* 비고 :\n    * Dashboard pod 가 running 임을 확인한 뒤 https://opensearch-dashboards.${CUSTOM_DOMAIN_NAME}/ 에 접속한다.\n    * Hyperauth에서 설정한 사용자 계정으로 로그인하여 정상 작동을 확인한다.\n\n## Step 3. fluentd 설치\n* 목적 : `EFK의 agent daemon 역할을 수행하는 fluentd를 설치`\n* 생성 순서 : 03_fluentd~.yaml 실행  \n  1. Container Runtime이 cri-o 인 경우  \n    * [03_fluentd_cri-o.yaml](yaml/03_fluentd_cri-o.yaml) 실행\n      ``` bash\n      $ kubectl apply -f 03_fluentd_cri-o.yaml\n      ```\n  2. Container Runtime이 docker 인 경우  \n    * [03_fluentd.yaml](yaml/03_fluentd.yaml) 실행 \n      ```bash\n      $ kubectl apply -f 03_fluentd.yaml\n      ```\n  3. Kubernetes pod 별로 index 생성하고자 할 경우\n    * [03_fluentd_multiple_index.yaml](yaml/03_fluentd_multiple_index.yaml) 실행 \n      ```bash\n      $ kubectl apply -f 03_fluentd_multiple_index.yaml\n      ```\n      \n    * 비고: Kubernetes namespace 별로 index 생성하고자 할 경우 [03_fluentd_multiple_index.yaml](yaml/03_fluentd_multiple_index.yaml)의 configmap인 fluentd-config에서 pod_name으로 설정된 부분을 namespace_name으로 변경하여 적용한다.\n    \n    ![image](figure/fluentd_module_index.png)\n    \n## Opensearch HA 구성 가이드\n* 목적: Opensearch와 Opensearch-Dashboards 파드에 대하여 각각 Active-Active 방식으로 기동하기 위한 설정이다.\n* Opensearch 구성\n    * Opensearch의 경우 master node 후보를 3개 이상의 홀수 개를 생성하는 것을 권장한다.\n    1. [01_opensearch.yaml](yaml/01_opensearch.yaml)의 statefulset에서 replicas와 env 설정을 변경한다.\n     ```\n    spec:\n      serviceName: opensearch\n      selector:\n        matchLabels:\n          app: opensearch\n      replicas: 3 ## 1에서 3으로 변경\n     \n    ...\n    \n    - name: discovery.seed_hosts\n      value: \"os-cluster-0.opensearch, os-cluster-1.opensearch, os-cluster-2.opensearch\" ## 증가된 만큼 수정\n    - name: cluster.initial_master_nodes\n      value: \"os-cluster-0, os-cluster-1, os-cluster-2\" ## 증가된 만큼 수정\n    \n    ```\n    2. opensearch-config의 opensearch.yml에 설정을 변경 및 추가한다.\n    ```\n    data:\n      opensearch.yml: |\n        cluster.name: \"os-cluster\"\n        network.host: \"0.0.0.0\"\n        discovery.seed_hosts: [ \"os-cluster-0.opensearch\", \"os-cluster-1.opensearch\", \"os-cluster-2.opensearch\" ] ## 증가된 만큼 수정\n        cluster.initial_master_nodes: os-cluster-0, os-cluster-1, os-cluster-2 ## 증가된 만큼 수정\n    ```\n* Opensearch-Dashboards 구성\n    * Opensearch-Dashboards의 경우 Dashboards replicas: 2로 수정한다.\n    ```\n    spec:\n      replicas: 2 ## 1에서 2로 변경\n      selector:\n        matchLabels:\n          app: opensearch-dashboards\n      template:\n        metadata:\n          labels:\n            app: opensearch-dashboards\n    ```\n\n### Opensearch multi node 환경에서 single node 환경으로 변경하여 재기동 시 주의 사항\n*  opensearch data(PVC)에 master node 관련 설정이 저장되기 때문에 지워지는 노드에 대하여 master node 후보에서 제외시킨 후에 opensearch 재기동 필요\n* Dashboards UI Dev tools에서 설정\n```\nPOST /_cluster/voting_config_exclusions/node_name={NODE_NAME} # os-cluster-1, os-cluster-2 각각 실행\n```\n\n## 비고\n* Fluentd에서 수집하는 로그 필드 설정\n    * fluentd.yaml 파일 Configmap의 kubernetes.conf에 filter 설정을 추가로 적용하여 로그 필드를 삭제할 수 있다.\n    * 주의: 삭제된 로그 필드는 opensearch에 적재되지 않는다.\n    * 예시) kubernetes.container_image_id에 대한 로그 필드를 삭제\n    ```\n    \u003cfilter kubernetes.**\u003e\n      @type record_transformer\n      enable_ruby true\n      remove_keys $.kubernetes.container_image_id\n    \u003c/filter\u003e\n\n    ```\n### Opensearch와 Opensearch-Dashboards, fluentd 모듈의 log level 설정\n* Opensearch: Apache Log4j를 사용하며 TRACE, DEBUG, INFO, WARN, ERROR, FATAL 총 6단계로, default로 설정된 log level은 INFO이다.\n     * log level 설정은 config를 수정하는 방법과 opensearch-dashboards ui에서 query를 보내어 설정하는 방법, log4j2.properties를 수정하는 방법이 있다.\n     * 현재 opensearch-config를 수정하는 방법과 dashboards ui에서 접근하여 설정하는 방법이 제대로 적용되지 않는 것을 확인하여 log4j2.properties를 수정하는 방법을 안내한다.  \n     * log4j2.properties를 수정하는 방법: [opensearch-log4j2-config](yaml/opensearch-log4j2-config.yaml) Configmap을 예시와 같이 원하는 로그 레벨로 입력하여 추가시킨 후, opensearch에 mount시켜 적용한다.\n\nex1) log4j-config (log4j2.properies) Configmap 예시\n             \n\t     \n\t     ```\n             log4j2.properties: |\n               status = error\n\n               appender.console.type = Console\n               appender.console.name = console\n               appender.console.layout.type = PatternLayout\n               appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] [%node_name]%marker %m%n\n\n               rootLogger.level = error  ### 원하는 로그 레벨로 변경\n               rootLogger.appenderRef.console.ref = console\n\t       \n\t     ```\n\t\t\n\t\nex2) 01_opensearch.yaml opensearch-log4j-config 마운트 적용 예시\n\t\n\t  \n\t    ```\n\t     volumeMounts:\n\t     - name: log4j2\n               mountPath: /usr/share/opensearch/config/log4j2.properties\n               subPath: log4j2.properties\n\t       \n\t     ...\n\t     \n\t     volumes:\n\t     - name: log4j2\n               configMap:\n               name: opensearch-log4j2-config\n\n\t     ```\n* Opensearch-Dashboards: opensearch와는 다르게 log level을 지정하여 설정하지 않고 config 설정에서 원하는 log 설정에 true/false를 적용한다.\n        \n\tex) opensearch-dashboards-config (opensearch-dashboards.yml) Configmap 예시\n\t\n\t```\n\t    # Set the value of this setting to true to suppress all logging output.\n        #logging.silent: false\n\n        # Set the value of this setting to true to suppress all logging output other than error messages.\n        #logging.quiet: false  ## log_level: warn/error 에 유사한 output\n\n        # Set the value of this setting to true to log all events, including system usage information\n        # and all requests.\n        #logging.verbose: false ## log_level: trace/debug에 유사한 output\n\t```\n\n* Fluentd: logger class는 fatal, error, warn, info, debug, trace 총 6단계로 구성되며 default log level 은 info이다. fluentd cli를 사용하거나 config file 을 통해서 수정 가능\n    * config를 통한 log level 설정에 오류가 있어 fluentd command에 옵션을 추가하여 변경하는 방법을 안내한다.\n    * [03_fluentd_cri-o.yaml](yaml/03_fluentd_cri-o.yaml)의 Daemonset에서 command에 원하는 log level에 맞는 옵션을 추가한다.\n    * log level 별 옵션 참조: https://docs.fluentd.org/deployment/logging#by-command-line-option\n    \n    ex) fluentd Daemonset command 수정 예시, log level error 설정 (-qq 옵션 추가)\n    \n             ```\n\t     containers:\n             - name: fluentd\n               image: docker.io/tmaxcloudck/hypercloud:{FLUENTD_VERSION}        \n               command: [\"/bin/bash\", \"-c\", \"fluentd -qq -c /fluentd/etc/fluent.conf -p /fluentd/plugins\"]\n\n\t     ```\n\n\n* Index management policy 설정\n    * watch-history-ilm-policy는 생성된 지 7일이 지난 인덱스는 자동으로 삭제한다.\n    * policy를 수정하고 싶다면, Opensearch-dashboards에서 아래와 같이 Index Management \u003e Index Policies 메뉴를 들어가서 watch-history-ilm-policy를 클릭한다.\n    * 해당 페이지에서 Edit 버튼을 클릭하여 policy를 커스터마이징 후, Update를 클릭한다.\n    ![image](figure/policy.png)\n    * 변경된 policy가 기존 index에 적용되지 않은 경우\n        * Index Management \u003e Managed Indices \u003e Change Policy를 클릭\n        * 변경된 policy를 적용하려는 indices를 설정\n        * New Policy에 watch-history-ilm-policy 적용 후 Change 클릭\n\n* OpenSearch에 HTTP 콜 하는 방법\n    * Opensearch-dashboards Management 메뉴에서 Dev Tools를 클릭한다.\n    * HTTP 콜 작성 후 ▶ 버튼 클릭\n    ![image](figure/dev-tools.png)\n\n* 에러 해결법\n    * Limit of total fields [1000] in index 에러\n        * 원인 : 저장하려는 field 갯수가 index의 field limit보다 큰 경우\n        * 해결 : index.mapping.total_fields.limit 증가 HTTP 콜 실행\n        ```\n        PUT {index 이름}/_settings\n        {\n            \"index.mapping.total_fields.limit\": 2000\n        }\n        ```\n    * index read-only 에러\n        * 원인 : 디스크 사용량이 flood-stage watermark 수치를 넘어서면 OS가 자동적으로 저장을 막음 (default 값은 95%)\n        * 해결 (택1)\n            * 필요없는 인덱스를 삭제해서 용량 확보\n            \t* dev-tools에서 HTTP 콜을 통해 인덱스 삭제\n            \t* ex) DELETE logstash-2022.01.01\n\n            * HTTP콜을 통해 read-only 해제하기\n            ![image](figure/read-only.png)\n            ```\n            PUT /{index 이름}/_settings\n            {\n                \"index.blocks.read_only_allow_delete\": null\n            }\n            ```\n\n## Hyperauth selfsigned CA 설정\n* 목적: hyperauth의 nip.io가 아닌 도메인에 대한 selfsigned_CA를 볼륨 마운트를 통해 opensearch와 hyperauth 연동을 하기 위함.\n   * 단, 공인인증서 사용시에는 별도의 마운트를 적용하지 않아도 된다.\n* 순서: \n1. [hyperauth-ca.yaml](yaml/hyperauth-ca.yaml)의 내용을 api-gateway-system 네임스페이스의 selfsigned-crt-secret 시크릿의 ca.crt로 수정한다.\n   * 비고: hypercloud console ui로 조회한 시크릿의 ca.crt를 참조할 것.\n2. hyperauth-ca.yaml을 실행\n``` bash\n$ kubectl apply -f hyperauth-ca.yaml\n```\n3. opensearch Statefulset의 볼륨 마운트 설정 및 ConfigMap인 opensearch-securityconfig를 수정한다.\n\n* ex) opensearch statefulset 볼륨 \u0026 마운트 추가\n```\nvolumeMounts:\n- name: hyperauth-ca\n  mountPath: /usr/share/opensearch/config/certificates/hyperauth\n  readOnly: true\nvolumes:\n- name: hyperauth-ca\n  secret:\n    secretName: hyperauth-ca\n```\nopensearch-securityconfig 설정 추가\n```\nopenid_connect_url: https://{HYPERAUTH_URL}/auth/realms/tmax/.well-known/openid-configuration\nopenid_connect_idp:         # 해당 내용 추가 필요\n  enable_ssl: true          # 해당 내용 추가 필요\n  verify_hostnames: false   # 해당 내용 추가 필요\n  pemtrustedcas_filepath: /usr/share/opensearch/config/certificates/hyperauth/ca.crt # 해당 내용 추가 필요\n\n```\n\n4. 이후 install 가이드와 동일한 순서로 설치를 진행\n\n* 비고: selfsigned 설정/또는 공인인증서 교체 이후 대시보드 접속했을 때 hyperauth와의 redirect에러(error 302) 발생 시,\n     * 'kubectl exec -it os-cluster-0 -n kube-logging /bin/bash' 로 opensearch pod 접속 \n     * 아래의 명령어 실행을 통해 securityconfig를 재설정한다.\n     ```bash\n     ./plugins/opensearch-security/tools/securityadmin.sh -cd ./plugins/opensearch-security/securityconfig/ -icl -nhnv -cacert ./config/certificates/admin/ca.crt -cert ./config/certificates/admin/tls.crt -key ./config/certificates/admin/tls.key\n\n     ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmax-cloud%2Finstall-opensearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftmax-cloud%2Finstall-opensearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftmax-cloud%2Finstall-opensearch/lists"}