검색엔진 스터디/실습 환경 구축

Elasticsearch 8.1.2 실행

막이86 2023. 11. 22. 11:19
728x90

Elasticsearch 설치

  • Docker
$ docker pull elasticsearch:8.10.2
$ docker run -p 9200:9200 -p 9300:9300 -v /Users/chihwan/Documents/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml --name elasticsearch-study elasticsearch:8.10.2
  • ssl 설정으로 config/elasticsearch.yml 파일 수정
    • cluster.initial_master_nodes ⇒ docker id
    cluster.name: "docker-cluster"
    network.host: 0.0.0.0
    
    #----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
    #
    # The following settings, TLS certificates, and keys have been automatically      
    # generated to configure Elasticsearch security features on 21-10-2023 03:19:32
    #
    # --------------------------------------------------------------------------------
    
    # Enable security features
    xpack.security.enabled: false
    
    xpack.security.enrollment.enabled: false
    
    # Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
    xpack.security.http.ssl:
      enabled: false
    
    # Enable encryption and mutual authentication between cluster nodes
    xpack.security.transport.ssl:
      enabled: false
    
    cluster.initial_master_nodes: ["9d9ae4a8858c"]
    #----------------------- END SECURITY AUTO CONFIGURATION -------------------------
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
    http.cors.allow-headers: "X-Requested-With,X-Auth-Token,Content-Type, Content-Length, Authorization"
    
  • Nori 형태소 분석기 설치
$ ./bin/elasticsearch-plugin install analysis-nori
  • 도커 재시작
  • 검색 오류 발생 시 매핑 수정
PUT http://localhost:8080/movie/_mapping
{
	"properties": {
		"genreAlt": {
			"type": "text",
			"fielddata": true
		}
	}
}
  • Docker 에 파일 복사
    • 787f47ac6253 ID라 그때 그때 변경 해야함
    $ docker cp /Users/chihwan/Documents/elasticsearch/userdict_ko.txt 787f47ac6253:/usr/share/elasticsearch/config/userdict_ko.txt
728x90

'검색엔진 스터디 > 실습 환경 구축' 카테고리의 다른 글

Elasticserch 6.4.3 실행  (0) 2023.11.22