Table of Content
ELK 6.x 스택 구성하기 on Ubuntu
메모리를 4G 이상으로 합니다.
JDK 설치
JAVA 8 이상의 버전을 설치합니다. 설치되어 있지 않으면 여기 를 참조해서 설치합니다.
gpg key 추가
# gpg key 추가
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
# ElasticSearch 6.x 추가
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
# ElasticSearch 7.x 추가
# echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
ElasticSearch 설치
sudo apt update
sudo apt install elasticsearch=6.4.3
데몬 실행하기
sudo systemctl start elasticsearch
curl -X GET "localhost:9200"
{
"name" : "lipOMEO",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "AGu8uUGdTQSL9JTRHzfvfg",
"version" : {
"number" : "6.4.3",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "fe40335",
"build_date" : "2018-10-30T23:17:19.084789Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
서비스에 등록합니다.
sudo systemctl enable elasticsearch
Kibana 설치하기
sudo apt install kibana=6.4.3
sudo vi /etc/kibana/kibana.yml
......
xpack.security.enabled: false
xpack.graph.enabled: false
xpack.reporting.enabled: false
server.port: 5601
server.host: "localhost"
elasticsearch.hosts: ["http://localhost:9200"]
......
원격접속을 허용하기 위해서는, 아래와 같이 localhost
이외의 값으로 호스트를 설정합니다. 원격접속을 허용하면 위험성도 높아지므로 별도의 보안수단을 갖추는 것이 안전합니다.
sudo vi /etc/kibana/kibana.yml
......
server.host: "0.0.0.0"
......
sudo systemctl start kibana
sudo systemctl enable kibana
Kibana 는 디폴트 로그 정책이 시스템로그에 로그가 기록되도록 하고 있습니다. Kibana 가 정상 작동하지 않는 경우, 아래 명령으로 로그를 확인할 수 있습니다.
tail -n 100 /var/log/syslog
Jun 26 14:38:18 ip-172-31-0-6 systemd[1]: Started Kibana.
Jun 26 14:38:23 ip-172-31-0-6 kibana[13516]: {"type":"log","@timestamp":"2020-06-26T14:38:23Z","tags":["info","optimize"],"pid":13516,"message":"Optimizing and caching bundles for ml, stateSessionStorageRedirect, status_page, timelion, monitoring, dashboardViewer, apm and kibana. This may take a few minutes"}
정말로 5분 이상이 걸립니다. 기다리는 수밖에…
Logstash 설치하기
sudo apt install logstash
# sudo systemctl start logstash
# sudo systemctl enable logstash