[MAC] ELK - Elasticsearch, Logstash, Kibana brew 설치하기
elasticsearch, logstash, kibana를 기존에는 윈도우 환경 혹은 linux 서버 환경에서만 설치하여 운영을 했었다.
처음으로 맥북으로 작업을 하게 되면서 local 환경 세팅을 위해 설치하는 과정을 겪었다.
처음 맥북으로 설치를 하다보니 시행착오를 겪었지만 바로 적용할 수 있었다.
먼저, ELK을 설치하기 전에 brew를 설치해야 한다.
Homebrew ?
- HomeBrew는 Apple(또는 Linux 시스템)에서 제공하지 않는 유용한 패키지 관리자를 설치
- 전용 디렉토리에 패키지를 설치하고, /usr/local 위치로 심볼릭 링크를 연결
- yum, apt-get과 같은 패키지 관리자
Homebrew
The Missing Package Manager for macOS (or Linux).
brew.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
위의 명령어를 입력하면 homebrew가 설치된다. 홈페이지에 잘 나와있어서 홈페이지에서도 설치해도 괜찮다.
brew --version
역시 패키지 설치 여부 확인은 version 명령어가 최고다.
--version option을 통해 위와 같이 버전 정보가 나오면 설치가 완료된다.
brew의 다양한 option에 대해서는 별도 포스팅을 하려고 한다. (최대한 빨리 해봐야지)
1. ElasticSearch 설치하기
ElasticSearch 설치하기 전에 brew에서 지원하는 라이브러리는 어떤게 있는지 검색해본다.
brew search elastic
신기하게도 aws-elasticbeanstalk, elasticsearch@6 (version 6) 과 같은 라이브러리도 같이 제공해주고 있다.
만약 6버전이 아닌 다른 버전을 설치하고 싶다면 이 링크를 참고해보면 좋을 것 같다.
https://gist.github.com/evgeniy-trebin/02fafdf03c18df4e03a4eaee1b939f11
How to install specific version of elasticsearch via brew
How to install specific version of elasticsearch via brew - brew_elasticsearch.sh
gist.github.com
brew install elasticsearch@7.12
Error가 뜨는 걸 확인할 수 있다. 처음에는 이유를 몰랐지만 아래 스텝을 따라가다보니 왜 이렇게 되는지 알게되었다. 그 이유는 바로 tap을 먼저 안해줬기 때문이다. 그래서 아래와 같이 진행하면 올바르게 설치를 할 수 있다.
⦿ Install Step
brew tap elastic/tap
brew install elastic/tap/elasticsearch-full
brew services start elasticsearch-full
Successfully started!!!!!!!!
잘 시작한 걸 확인해볼 수 있다.
이리저리 많이 헤맸지만 결국에는 몇개의 brew 명령어만으로 elasticsearch 설치가 완료되었다.
여기서부터는 elasticsearch 정보에 대한 확인 관련 명령어와 내용들이다.
curl -X GET localhost:9200
개인정보가 있기때문에, 오른쪽 내용을 보여줄 순 없지만 이런 필드로 elasticsearch의 상태를 보여주고 있다.
2. Kibana 설치하기
brew tap elastic/tap
brew install elastic/tap/kibana-full
ElasticSearch 설치하는 방법과 동일하다.
tap을 하고 난 다음에 kibana-full 패키지를 설치해주면 된다.
brew services start kibana-full
실행시킨 다음 localhost:5601 로 들어가면 키바나가 켜진 모습을 볼 수 있다.
참고로 키바나가 켜질때는 시간이 조금 소요되니 충분히 기다려주면 된다. 나는 한 1분정도? 소요되었지만 pc 사양과 start될 때 메모리 사용률을 고려하여 켜지기 때문이다.
역시 알록달록한 키바나ㅎㅎ
3. logstash 설치하기
brew tap elastic/tap
brew install elastic/tap/logstash-full
logstash도 단 두번의 명령어 입력에 설치가 끝난다.
중요한 것은 tap 을 해줘야 한다는 것!!
4. 경로 path 확인하기
내가 조금 헤맸던 건, 그래서 elastic, kibana, logstash 즉 ELK stack 설치를 완료했는데
그래서 각각 config 파일과 log 파일들은 어디서보지? 라는 것이었다.
열심히 이 디렉토리 저 디렉토리 다 구경하고 모두 여행하고 한 결과 찾았다!
설치된 곳은
/opt/homebrew/etc
라는 곳에 elasticsearch, kibana, logstash가 설치되었다.
여기서 pipeline, config 파일 등 수정이 가능하다!!!
<참고 URL>
https://www.elastic.co/guide/en/elasticsearch/reference/7.17/brew.html
Install Elasticsearch on macOS with Homebrew | Elasticsearch Guide [7.17] | Elastic
Install Elasticsearch on macOS with Homebrewedit Elastic publishes Homebrew formulae so you can install Elasticsearch with the Homebrew package manager. To install with Homebrew, you first need to tap the Elastic Homebrew repository: Once you’ve tapped t
www.elastic.co
https://www.elastic.co/guide/en/kibana/7.17/brew.html
Install Kibana on macOS with Homebrew | Kibana Guide [7.17] | Elastic
Install Kibana on macOS with Homebrewedit Elastic publishes Homebrew formulae so you can install Kibana with the Homebrew package manager. To install with Homebrew, you first need to tap the Elastic Homebrew repository: Once you’ve tapped the Elastic Hom
www.elastic.co
https://www.elastic.co/guide/en/logstash/7.17/installing-logstash.html
Installing Logstash | Logstash Reference [7.17] | Elastic
Use the echo method described above to add the Logstash repository. Do not use add-apt-repository as it will add a deb-src entry as well, but we do not provide a source package. If you have added the deb-src entry, you will see an error like the following:
www.elastic.co