Hello all,
I am pretty new to elasticsearch & docker. I am trying to deploy my application using docker-compose. It seemed to be working fine on Windows. Suddenly, I am facing following issue on Mac Os.
My search-labels application is not able to connect to elasticsearch. It works for a while if I clear ./var/ & start application with sudo. But after sometime it again throws same error. I have tried searching on web & followed posts related to this. But not able to figure out. Please suggest a solution.
Caused by: java.net.UnknownHostException: elasticsearch: Name or service not known
search-labels_1 | at java.base/java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
search-labels_1 | at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
search-labels_1 | at java.base/java.net.InetAddress.getAddressesFromNameService(Unknown Source)
search-labels_1 | at java.base/java.net.InetAddress$NameServiceAddresses.get(Unknown Source)
search-labels_1 | at java.base/java.net.InetAddress.getAllByName0(Unknown Source)
search-labels_1 | at java.base/java.net.InetAddress.getAllByName(Unknown Source)
search-labels_1 | at java.base/java.net.InetAddress.getAllByName(Unknown Source)
search-labels_1 | at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsRe
Docker-compose file for reference
version: "3"
services:
postgres:
image: postgres:10-alpine
environment:
POSTGRES_DB: search
POSTGRES_USER: search
POSTGRES_PASSWORD: search
ports:
- 5432:5432
# - 5436:5432
volumes:
- ./var/postgresql:/var/lib/postgresql/data
activemq:
image: webcenter/activemq
environment:
ACTIVEMQ_CONFIG_DEFAULTACCOUNT: "false"
ACTIVEMQ_USERS_myproducer: producerpassword
ports:
- 5677:5672
- 8166:8161
volumes:
- ./var/activemq:/data
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.8
ports:
- 9200:9200
- 9300:9300
environment:
discovery.type: single-node
volumes:
- ./var/elasticsearch:/usr/share/elasticsearch/data
mockserver:
image: mockserver/mockserver
ports:
- 1080:1080
redis:
image: redis:5-alpine
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- 6379:6379
search-labels:
build: .
# You can use the latest image by uncommenting below
# image: registry.asmgmt.hilti.com/am/saerch-labels:latest
ports:
- 8084:8080
- 5009:5009
environment:
APPLICATION_MAX_THREADS: 10
POSTGRES_HOST: postgres
POSTGRES_DB: search
POSTGRES_USER: search
POSTGRES_PASSWORD: search
POSTGRES_PORT: 5432
MQ_HOST: activemq
MQ_HOST_FAILOVER: activemq
MQ_USER: myproducer
MQ_PASSWORD: producerpassword
MQ_SCHEME: amqp
MQ_PORT: 5672
REDIS_HOST_NAME: redis
REDIS_PORT: 6379
ASSET_CHARGING_SVC: mockserver:1080
USER_MGMT_SVC: mockserver:1080
ORG_MGMT_SVC: mockserver:1080
ASSET_MGMT_SVC: mockserver:1080
HILTI_INTEGRATION_SVC: mockserver:1080
ALERT_NOTIFICATION_SVC: mockserver:1080
ALERT_NOTIFICATION_MGMT_SVC: mockserver:1080
elastic.host: elasticsearch
elastic.port: 9200
elastic.protocol: http
ROOT_LOG_LEVEL: INFO
APPLICATION_LOG_LEVEL: INFO
OPEN_TRACING_JAEGER_ENABLE: "false"
links:
- activemq
- elasticsearch
- postgres
- mockserver
- redis
depends_on:
- activemq
- elasticsearch
- postgres
- mockserver
- redis