Reputation: 3
I am going to run ELK with docker-compose
command with the following docker-compose.yml
file:
---
version: '2'
services:
kibana:
image: docker.elastic.co/kibana/kibana
links:
- elasticsearch
ports:
- 5601:5601
kibana:
image: docker.elastic.co/logstash/logstash
links:
- elasticsearch
ports:
- 5044:5044
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch
cap_add:
- IPC_LOCK
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
volumes:
esdata1:
driver: local
But I have few questions:
1) I specified links
parameter to link containers but should I also specify networks
parameter? What is it used for?
2) How can I change default users names and passwords for Elasticsearch, Logstash and Kibana?
3) Elasticsearch configuration parameters are stored in elasticsearch.yml
file but where can I find that file?
Is it possible to define Elasticsearch parameters such as path.data
, path.logs
, cluster.name
, node.name
directly in docker-compose.yml
file?
Upvotes: 0
Views: 4632
Reputation: 221
1) The links parameter allows to access the linked container by its service name or alias. This will be possible for any docker network that both services have joined.
If you do not specify any networks under the service's networks key the services will join the docker default network (bridge I think).
You only have to specify a network name if you want your services to join a (number of) specific docker networks. Those again you can then either define under the top-level networks key (which lets docker-compose create the networks) or prepare outside of docker compose per docker network create
2) The images you are using are built with X-Pack, how to change the passwords is described here X-Pack security Example taken from the documentation:
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/elastic/_password' -H "Content-Type: application/json" -d '{
"password" : "elasticpassword"
}'
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/kibana/_password' -H "Content-Type: application/json" -d '{
"password" : "kibanapassword"
}'
curl -XPUT -u elastic 'localhost:9200/_xpack/security/user/logstash_system/_password' -H "Content-Type: application/json" -d '{
"password" : "logstashpassword"
}'
If you do not want to do that as a manual post setup step, you would have to create your own derived docker images.
3) The configuration parameters you would otherwise configure using the elasticsearch.yml may be set using environment variables as described by the Elastic search docker documentation. Example taken from the documentation:
...
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.3.0
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
...
Upvotes: 1