최근 적용 방법

aws의 EC2 스팩이슈로 인해 서버를 두개로 나누고 각각 도커로 띄우게 되었다.

sudo wget -qO- http://get.docker.com/ | sh

sudo curl -L "https://github.com/docker/compose/releases/download/v2.18.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

  1. Elasticsearch
//elasticsearch 이미지 설치
docker pull elasticsearch:원하는 버전

//이미지 확인
docker images

REPOSITORY                                      TAG       IMAGE ID       CREATED        SIZE
redis                                           latest    bdff4838c172   5 weeks ago    138MB
elasticsearch                                   7.17.15   4b7216db00ae   3 months ago   649MB
docker.elastic.co/elasticsearch/elasticsearch   7.17.15   7cfaa53da09f   3 months ago   632MB
postgres                                        latest    0c88fbae765e   8 months ago   379MB

설치한 이미지를 통해 컨테이너 실행

docker run -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name ES-Server 4b7216db00ae

curl을 통해 정상 작동 확인

curl localhost:9200
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   547  100   547    0     0  15401      0 --:--:-- --:--:-- --:--:-- 15628{
  "name" : "c5e089e77e9e",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "oayWGoK4Rsu6y3lcT3dQhQ",
  "version" : {
    "number" : "7.17.15",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "0b8ecfb4378335f4689c4223d1f1115f16bef3ba",
    "build_date" : "2023-11-10T22:03:46.987399016Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

도커로 띄우고 설정을 하기에 어려움을 느껴 도커 컴포즈로 변경…