[elasticsearch]
엘라스틱서치 실행 명령어
# 데몬으로 실행
> elasticsearch -d -p pid
[elasticsearch-create-enrollment-token]
elasticsearch 노드 및 Kibana 인스턴스에 대한 등록 토큰을 생성
> elasticsearch-create-enrollment-token [-f, --force] [-h, --help] [-E <KeyValuePair>] [-s, --scope] [--url]
-E <KeyValuePair>
표준 Elasticsearch 또는 X-Pack 설정을 구성
-f, --force
비정상 클러스터에 대해 명령을 강제로 실행
-h, --help
모든 명령 매개변수를 반환
-s, --scope
생성된 토큰의 범위를 지정하며 지원되는 값은 node 및 kibana.
--url
Elasticsearch에 API 요청을 제출하는 데 사용하는 기본 URL(로컬 노드의 호스트 이름 및 포트)을 지정한다
기본값은 elasticsearch.yml파일의 설정에 따라 결정된다
xpack.security.http.ssl.enabled : true로 설정된 경우 HTTPS URL을 지정해야 한다
# node를 elasticsearch 클러스터에 등록하기 위한 토큰을 생성
> elasticsearch-create-enrollment-token -s node
# elasticsearch 실행 시 등록토큰 전달
> elasticsearch --enrollment-token <enrollment-token>
# 엘라스틱서치는 자동적으로 인증서와 키를 생성(config/certs에 생성
# kibana 인스턴트를 클러스터에 등록하기 위한 등록 토큰 생성
elasticsearch-create-enrollment-token -s kibana --url "https://172.0.0.3:9200"
[elasticsearch-node]
elasticsearch 클러스터 내의 노드에 대한 정보를 관리하고 제어하는 명령어
노드의 상태를 확인하거나, 노드를 시작하거나 중지하고, 클러스터에 새로운 노드를 추가하거나 제거할 수 있다
> elasticsearch-node repurpose|unsafe-bootstrap|detach-cluster|override-version
[-E <KeyValuePair>]
[-h, --help] ([-s, --silent] | [-v, --verbose])
# data node or master-eligible node의 역할을 가진 노드의 데이터를 삭제한다
# 노드의 역할을 변경할 떄
#1. Stop the Node
#2. Update elasticsearch.yml by setting node.roles as desired
#3. Run elasticsearch-node reperpose on the node
#4. Start the node
> elasticsearch-node repurpose
# 클러스터 설정을 방해하는 설정이 포함된 경우 관련 영구 설정들을 제거
#1. Stop the node
#2. Run elasticsearch-node remove-settings name-of-setting-to-remove on the node
#3. Repeat for all other master-eligible nodes
#4. Start the nodes
> elasticsearch-node remove-settings
# 클러스터 상태를 방해하는 메타데이터 제거
#1. Stop the node
#2. Run elasticsearch-node remove-customs name-of-custom-to-remove on the node
#3. Repeat for all other master-eligible nodes
#4. Start the nodes
> elasticsearch-node remove-customs
# 클러스터 메타데이터의 로컬 복사본을 사용하여 노드 중 하나가 자체적으로 새로운 클러스터를 형성
> elasicsearch-node unsafe-bootstrap
# 다른 클러스터로 노드를 이동
> elasticsearch-node detach-cluster
# 데이터 경로의 데이터가 호환되지 않는 버전이여도 노드를 시작하는 명령어
> elasticsearch-node override-version
[elasticsearch-reset-password]
비밀번호 재설정
> elasticsearch-reset-password
[-a, --auto] [-b, --batch] [-E <KeyValuePair]
[-f, --force] [-h, --help] [-i, --interactive]
[-s, --silent] [-u, --username] [--url] [-v, --verbose]
[elasticsearch-setup-passwords]
비밀번호 설정
> elasticsearch-setup-passwords auto|interactive
[-b, --batch] [-h, --help] [-E <KeyValuePair>]
[-s, --silent] [-u, --url "<URL>"] [-v, --verbose]
[elasticsearch-certgen]
이 명령어는 더이상 사용되지 않고 certutil로 교체되었다고함.
[elasticsearch-certutil]
인증서와 관련된 명령어
elasticsearch-certutil
(
(ca [--ca-dn <name>] [--days <n>] [--pem])
| (cert ([--ca <file_path>] | [--ca-cert <file_path> --ca-key <file_path>])
[--ca-dn <name>] [--ca-pass <password>] [--days <n>]
[--dns <domain_name>] [--in <input_file>] [--ip <ip_addresses>]
[--multiple] [--name <file_name>] [--pem] [--self-signed])
| (csr [--dns <domain_name>] [--in <input_file>] [--ip <ip_addresses>]
[--name <file_name>])
[-E <KeyValuePair>] [--keysize <bits>] [--out <file_path>]
[--pass <password>]
)
| http
[-h, --help] ([-s, --silent] | [-v, --verbose])
# CA 인증서와 개인키 생성
> elasticsearch-certutil ca
# CA를 사용하여 X.509 인증서와 개인키 생성
> elasticsearch-certutil cert --ca [ca인증서]
# --pem 옵션은 crt, key인 PEM 형식으로 인증서 및 키 생성
./elasticsearch-certutil ca --pem
# 기존에 존재하는 ca 인증서와 키파일을 이용하여 X.509 인증서 및 키 생성
./elasticsearch-certutil cert --ca-cert ca/ca.crt --ca-key ca/ca.key --pem
Parameters
ca
새로운 로컬 CA를 생성한다.
cert
X.509 인증서와 키를 생성한다.
csr
인증서 서명 요청을 생성한다.
http
Elasticsearch Http 인터페이스에 대한 인증서 및 인증서 요청을 생성한다.
--ca <file_path>
CA Key 파일에 대한 경로를 지정한다.
--ca-cert <file_path>
CA 인증서 파일에 대한 경로를 지정한다.
--ca-dn <name>
CA 인증서에 사용되는 Distinguished Name(DN)을 정의한다.
--ca-key <file_path>
CA 개인키에 대한 경로를 지정한다.
--ca-pass <password>
CA 개인키의 패스워드를 지정한다.
--days <n>
생성된 인증서가 유효한 일수를 나타내는 값을 정한다.
--dns <domain_name>
콤마(,)로 구분된 DNS 이름 목록을 지정한다.
-E <KeyValuePair>
Configures a setting.
-h, --help
Returns all of the command parameters.
--in <input_file>
silent mode에서 사용되는 파일을 지정한다.
--ip <IP_addresses>
콤마(,)로 구분된 IP 주소 목록을 지정한다.
--keysize <bits>
생성된 RSA 키에 사용되는 비트 수를 정의한다.
--multiple
여러 인스턴트에 대한 파일을 지정하도록 한다.
--name <file_name>
생성된 인증서의 이름을 정한다.
--out <file_path>
출력파일의 경로를 지정한다.
--pass <password>
생성된 개인 키의 비밀번호를 저장한다.
--pem
PEM 형식으로 인증서와 키를 생성한다.
--self-signed
자체 서명된 인증서를 생성한다.
'DevOps > ELK' 카테고리의 다른 글
[ELK] Elasticsearch Watcher 설정 (1) | 2024.06.03 |
---|---|
[Elastic Stack] Elasticsearch 기본 개념 (1) | 2024.04.04 |
[Elastic Stack] Elasticsearch.yml 파일 세팅 (0) | 2024.03.18 |
[Elastic Stack] Ingest Pipeline + processor (0) | 2024.03.14 |
[Elastic Stack] Fleet and Elastic Agent (0) | 2024.03.12 |