Versions: 2.17.0/2.17.0/Fedora (latest as of 9/28/2024), n/a
I have these goals, from one docker-compose.yml
- 2 OpenSearch “demo” instance/cluster configurations (I’m lazy - using the standard 2-node configuration from the demo docker-compose.yml for each cluster)
- One instance runs on standard ports 9200, dashboard port 5601
- The other runs on say 9210, dashboard port 5611
- The dashboards are isolated to the cluster
- The volumes for the data are also isolated by cluster.
The goal is to differentiate each instance by port - only. Specifically:
- by API port number, 9200 or 9210 (or whatever ports I should use based on ranges) - ‘curl -XGET :9200/_search…’ or ‘curl -XGET :9210/_search…’
- By dashboard port number, 5601 or 5611.
In other words: Figuring what OpenSearch address it needs to go to is based strictly off of the port routing, not ip. And yes, I think I know that’s not how standard networking works without ‘extra work’ - some sort of routing to determine where the request goes by something other than ip address. And the real difference between these instances is the populated data.
Is there a way of keeping this process within the Docker networking mechanism (I bet I need extra configuration, and not certain what that is - hopefully it’s minimal)?
As other similar posts have suggested, it’s easy to get the first instance up and working.
I have all 4 nodes, 2 nodes for each cluster up - ‘docker inspect opensearch_opensearch-net’ tells me so:
docker network inspect opensearch_opensearch-net
[
{
"Name": "opensearch_opensearch-net",
"Id": "2bd03c657109ed68b53b0a2d3f4a2b30bd865730cef261f8eeaf3f0c0f6f4cce",
"Created": "2024-09-29T21:19:40.039063114Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"281a5685a8514c690b4911bf7e7cf28c80696592082a3ad2683404c8fbe02710": {
"Name": "opensearch-dashboards",
"EndpointID": "68eed65974fb11f7d791235f71eb4d1ed7bee919ba970e4e7b37ac6671c38a9e",
"MacAddress": "02:42:ac:14:00:02",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
},
"3b99243947250fb4029ddc99cd639c0487b2175e17b28d2dfd6921a7b7eb89d5": {
"Name": "opensearch-node1",
"EndpointID": "9b7c30fba3e3f6043f1f4f784c9b13aaf6329b9155ba5df61cb477258d589df7",
"MacAddress": "02:42:ac:14:00:05",
"IPv4Address": "172.20.0.5/16",
"IPv6Address": ""
},
"51a593e873e5e3149e8be1bd5a020f32fd51a765d7f943aef65ce1fe7d38bd3f": {
"Name": "opensearch-node2",
"EndpointID": "6f8ceb3bcb8cd5090e2436a586a7c88c19797cc442a04cd2fe83ba21456847ae",
"MacAddress": "02:42:ac:14:00:03",
"IPv4Address": "172.20.0.3/16",
"IPv6Address": ""
},
"5f303b8437d53d67ae06dbe2c2834295e24a79df98a7a98ccb01708ed6803e42": {
"Name": "opensearch-node1_2",
"EndpointID": "d98a1e03dfc529d273694b136084ed6024f225eb09e7c33c2015e222e812a689",
"MacAddress": "02:42:ac:14:00:06",
"IPv4Address": "172.20.0.6/16",
"IPv6Address": ""
},
"cfea4895d454026d05883ceedd8b64fc93dc9ac5ab2fc2e398f83d53edcb5127": {
"Name": "opensearch-dashboards_2",
"EndpointID": "0fdc498c40a1bc1ddf29cf9c95f089d934fc60389836aba89efa9154a7010f42",
"MacAddress": "02:42:ac:14:00:07",
"IPv4Address": "172.20.0.7/16",
"IPv6Address": ""
},
"e759e8a232c0d784e6226257b024d8852322eb8b0ebc24209c16666fc187ffba": {
"Name": "opensearch-node2_2",
"EndpointID": "eef573c2c95807aced842b4f45e3d0be604ac1eb53540b1bb584f62ef7854ddb",
"MacAddress": "02:42:ac:14:00:04",
"IPv4Address": "172.20.0.4/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "opensearch-net",
"com.docker.compose.project": "opensearch",
"com.docker.compose.version": "2.29.2"
}
}
]
I went into ‘opensearch-dashboards_2’, 172.20.0.7, and could ping all the other containers via ip address (including the ones I don’t care about in the other cluster).
I think the problem is here in these snippets from ‘docker ps -a’:
... 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp opensearch-dashboards
... 5611/tcp, 0.0.0.0:5611->5601/tcp, [::]:5611->5601/tcp opensearch-dashboards_2
I’m suspecting the 2nd snippet should read:
5611/tcp, 0.0.0.0:5611->5601/tcp, [::]:5611->5601/tcp
But I haven’t a clue how to get it to do that.
Am I on the right track? Any clues?
Thanks!