I want to host my multi-container docker application and elasticsearch is one of the service in the container. I use docker-compose.yml file to host it in digital ocean cloud server 2GB Memory.
I am just trying to host a single node to production, and I am not sure if it is possible or not.
I encounter into problem for binding error, not able to bind network.bind_host
on digital ocean IP address to the elasticsearch.yml
Here is my elasticsearch.yml file
# path:
# data: /var/data/elasticsearch
# logs: /var/log/elasticsearch
# plugins: /data/plugins
# work: /data/work
# Cluster information
cluster.name: production
node.name: mooc-search-docker-single-node
# xpack.security.enabled: false
# xpack.license.self_generated.type: basic
# xpack.security.transport.ssl.enabled: true
# xpack.security.transport.ssl.verification_mode: certificate
# xpack.security.transport.ssl.key: /home/es/config/x-pack/node01.key
# xpack.security.transport.ssl.certificate: /home/es/config/x-pack/node01.crt
# xpack.security.transport.ssl.certificate_authorities: [ "/home/es/config/x-pack/ca.crt" ]
# Security settings
# script.disable_dynamic: true
# script.inline: on
# script.indexed: on
# Index settings
# action.auto_create_index: false
# network settings
network.host: _local_
network.bind_host: 167.99.56.190 ** this causes error if I put this IP address but if I put 0 then it works but I'm not able to access from my local machine**
# network.tcp.reuse_address: true
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
# Turn off swap to get a big speed increase. This will prevent the ES server
# from swapping memory on the node.
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-
configuration.html#setup-configuration-memory
bootstrap.memory_lock: true
# In order to communicate and to form a cluster with nodes on other servers,
# your node will need to bind to a non-loopback address. While there are many
# network settings, usually all you need to configure is network.host:
# network.host: 192.168.1.10
# Disable deleting all indices from the api.
action.disable_delete_all_indices: true
# shield.transport.filter.enabled: false
# shield.http.filter.enabled: true
# shield.transport.filter.allow: [ "192.168.0.1", "192.168.0.2", "192.168.0.3", "192.168.0.4",
"167.99.56.190" ]
# shield.transport.filter.deny: _all
# When the moment comes to form a cluster with nodes on other servers, you have
# to provide a seed list of other nodes in the cluster that are likely to be live
# and contactable
discovery.zen.ping.unicast.hosts:
- 192.168.1.10:9300
- 192.168.1.11
# prevent data loss
discovery.zen.minimum_master_nodes: 1 #
# indices.cluster.send_refresh_mapping: false />
This is my Dockerfile for elasticsearch:
FROM docker.elastic.co/elasticsearch/elasticsearch:6.2.2
COPY --chown=elasticsearch:elasticsearch elasticsearch.yml /usr/share/elasticsearch/config/
Lastly, this is the error log:
Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]];
nested: ChannelException[Failed to bind to: /167.99.56.190:9400]; nested:
BindException[Cannot assign requested address];
Likely root cause: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at
org.jboss.netty.channel.socket.nio.NioServerBoss$RegisterTask.run(NioServerBoss.java:193)
at
org.jboss.netty.channel.socket.nio.AbstractNioSelector.processTaskQueue(AbstractNioSelector.java:391)
at
org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:315)
at org.jboss.netty.channel.socket.nio.NioServerBoss.run(NioServerBoss.java:42)
at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
All I want is to be able to let elasticsearch service to be access by other container, such as the search-services.
Thank you so much!