티스토리 뷰

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

잘 설치 되었는지 확인하기

http://localhost:5601

이렇게 뜨면 잘 설치 된거임

 

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

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함