docker run -d -p 9200:9200 -p 9300:9300 -it -h elasticsearch elasticsearch
git clone https://github.com/justmeandopensource/elk
cd elk
cd docker
docker-compose up -d
잘 설치 되었는지 확인하기
이렇게 뜨면 잘 설치 된거임
ubuntu등에서 78번 에러가 나면서 elastic search가 안뜰 때
아래 명령어를 추가로 실행하면 뜬다.
sudo sysctl -w vm.max_map_count=524288
index 확인하기
/classes가 index_name임
curl -X GET http://localhost:9200/classes
{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"classes","index_uuid":"_na_","index":"classes"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"classes","index_uuid":"_na_","index":"classes"},"status":404}
이쁘게 보기
curl -X GET http://localhost:9200/classes\?pretty
인덱스 생성
curl -XPUT localhost:9200/basketball
basketball이라는 인덱스 생성
curl -XPUT http://localhost:9200/classes
classes라는 이름의 인덱스 생성
결과
{"acknowledged":true,"shards_acknowledged":true,"index":"basketball"}%
매핑(mapping) 추가하기
curl -XPUT 'http://localhost:9200/classes/class/_mapping' -d @classesRating_mapping.json -H 'Content-Type: application/json'
결과
{"acknowledged":true}%
주소를 /classes/class 이렇게 한 단계 더 만들어 주어야 한다. 그리고 6.x부터는 -H 'Content-Type: application/json' 이걸 안붙여주면 에러난다.
bulk로 데이터 넣기
curl -XPOST http://localhost:9200/_bulk\?pretty --data-binary @classes.json -H 'Content-Type: application/json'
넣은 데이터 조회하기
curl -XGET http://localhost:9200/classes/class/1/\?pretty
모든 인덱스 보기
curl -XGET http://localhost:9200/_cat/indices?v
logstah설치(mac)
brew cask install homebrew/cask-versions/adoptopenjdk8
brew install logstash
'개발 > Infra' 카테고리의 다른 글
Docker로 nginx, ElasticSearch띄우기 (0) | 2021.07.16 |
---|---|
도커로 엘라스틱서치, 키바나 띄우기, 명령어 (0) | 2019.09.20 |
pid로 내렸다 올리는 스크립트 (0) | 2019.04.15 |
shell script에 파라메터 넘기기 (0) | 2019.04.03 |
curl 쓰는 법 (0) | 2019.03.26 |
aws ami에 nginx, docker설치하고 띄우기 (0) | 2019.02.28 |