카이도스의 Tech Blog
ES-Cluster 구성 - 1(공통) 본문
728x90
반응형
2024.03.02 - [Elasticsearch] - ES-Cluster 구성 - 2(MasterNode, Kibana)
2024.03.02 - [Elasticsearch] - ES-Cluster 구성 - 3(DataNode)
2024.03.02 - [Elasticsearch] - ES-Cluster 구성 - 4(Fleet Server 설치)
2024.03.02 - [Elasticsearch] - ES-Cluster 구성 - 5(ElasticSearch_Exporter 구성 & Prometheus 연동)
- ES, Kibana 버전 : v8.12
- Java Jdk 21
- Ubuntu 22.04
- OS , JDK, ES 버전 호환성 체크 (https://www.elastic.co/kr/support/matrix)
ES Cluter 구성 - 공통
# hostname 설정
sudo hostnamectl set-hostname es-master1
sudo hostnamectl set-hostname es-data1
# hosts 설정
sudo su -
cat <<EOT>> /etc/hosts
# es cluster
10.10.x.181 es-master1
10.10.x.182 es-data1
10.10.x.183 es-data2
10.10.x.184 es-data3
EOT
# kernel 설정
cat <<EOT>>/etc/sysctl.conf
vm.overcommit_memory=2
vm.overcommit_ratio=90
net.core.netdev_max_backlog=30000
net.ipv4.tcp_max_syn_backlog=30000
net.ipv4.tcp_syn_retries=2
net.ipv4.tcp_retries1=2
net.core.rmem_max=268435456
net.core.wmem_max=268435456
net.core.rmem_default=10485760
net.core.wmem_default=10485760
net.ipv4.tcp_rmem=4096 87380 134217728
net.ipv4.tcp_wmem=4096 87380 134217728
net.core.somaxconn=65535
net.ipv4.tcp_fin_timeout=12
vm.max_map_count=262144
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_max_tw_buckets=50000000
EOT
# 적용
sudo sysctl -p
# ulimit(openfile, memlock limit) 설정
cat <<EOT>> /etc/security/limits.conf
* hard nofile 1000000
* soft nofile 1000000
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
EOT
# swap 메모리 해제
sudo swapoff -a
sudo vi /etc/fstab
#/swap.img none swap sw 0 0 # swap 주석 처리
# apt 최신화
sudo apt update && sudo apt upgrade -y
# openjdk 21 설치
sudo apt update && sudo apt install -y openjdk-21-jdk
java --version
openjdk 21.0.1 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 21.0.1+12-Ubuntu-222.04, mixed mode, sharing)
# Java_Home 환경변수 설정(ubuntu 계정에서)
cat <<EOT>> ~/.bashrc
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
export PATH=$PATH:$JAVA_HOME/bin
EOT
# 적용 및 확인
source ~/.bashrc
echo $JAVA_HOME
/usr/lib/jvm/java-21-openjdk-amd64
# ElasticSearch 8 Repository 설정(ubuntu 계정에서)
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
sudo apt install apt-transport-https
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
# Elasticsearch 설치
sudo apt update && sudo apt install -y elasticsearch
# 디렉터리 생성 및 소유권 설정
sudo mkdir -p /data/elasticsearch
sudo chown -R elasticsearch:elasticsearch /data/elasticsearch/
# ES Daemon 설정
sudo vi /lib/systemd/system/elasticsearch.service
LimitNOFILE=1000000
LimitMEMLOCK=infinity
728x90
반응형
'Elasticsearch' 카테고리의 다른 글
ES-Cluster 구성 - 5(ElasticSearch_Exporter 구성 & Prometheus 연동) (0) | 2024.03.02 |
---|---|
ES-Cluster 구성 - 4(Fleet Server 설치) (0) | 2024.03.02 |
ES-Cluster 구성 - 3(DataNode) (0) | 2024.03.02 |
ES-Cluster 구성 - 2(MasterNode, Kibana) (0) | 2024.03.02 |
Comments