Thank you for reading this post, don't forget to subscribe!
если запускать elasticsearch с включённым xpack и 1 инстансом эластика то наличие сертификата не обязательно
ставим docker:
yum remove docker docker-engine docker.io
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce -y
systemctl start docker
systemctl enable docker
ставим docker-compose
https://github.com/docker/compose/releases
на текущий момент самая последняя версия:
2,6,1
https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64
выкачиваем её:
curl -L "https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
всё готово.
cat docker-compose.yml
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 31 32 33 |
version: "2" services: elasticsearch: image: "docker.elastic.co/elasticsearch/elasticsearch:7.5.0" container_name: elasticsearch environment: - discovery.type=single-node - cluster.routing.allocation.disk.threshold_enabled=true - cluster.routing.allocation.disk.watermark.low=65% - cluster.routing.allocation.disk.watermark.high=70% - xpack.security.enabled=true - xpack.security.audit.enabled=true - ELASTIC_PASSWORD=somethingsecret ports: - "9200:9200" networks: - eknetwork kibana: depends_on: - elasticsearch image: "docker.elastic.co/kibana/kibana:7.5.0" ports: - "5601:5601" environment: - ELASTICSEARCH_URL=http://elasticsearch:9200 - ELASTICSEARCH_USERNAME=elastic - ELASTICSEARCH_PASSWORD=somethingsecret networks: - eknetwork networks: eknetwork: |
ELASTICSEARCH_USERNAME
ELASTICSEARCH_PASSWORD
соответственно логопассы.
проверяем работу:
curl http://192.168.1.170:9200
1 2 |
[root@centos7 ~]# curl http://192.168.1.170:9200 {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401} |
а теперь задаём логин и пароль:
curl -k -u elastic:somethingsecret http://192.168.1.170:9200
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
[root@centos7 ~]# curl -k -u elastic:somethingsecret http://192.168.1.170:9200 { "name" : "35ad85208cdc", "cluster_name" : "docker-cluster", "cluster_uuid" : "3GnFT2WBRFGIbiDkGWxXcg", "version" : { "number" : "7.5.0", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "e9ccaed468e2fac2275a3761849cbee64b39519f", "build_date" : "2019-11-26T01:06:52.518245Z", "build_snapshot" : false, "lucene_version" : "8.3.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } |