gpt4 book ai didi

ruby-on-rails - 无法打开到本地主机的 TCP 连接 :9200 (Cannot assign requested address - connect(2) for "localhost" port 9200)

转载 作者:行者123 更新时间:2023-12-02 18:47:44 28 4
gpt4 key购买 nike

我正在尝试在 docker 上运行 Elasticsearch
我为与 mysql 容器连接的 rails 应用程序构建了一个容器
我想将这个 rails 容器与弹性容器连接起来
但我收到这个错误

无法打开到 localhost:9200 的 TCP 连接(无法分配请求的地址 - “localhost”端口 9200 的 connect(2))

当我运行 docker-compose up
这些网址工作正常
http://localhost:3000/

http://localhost:9200/

但我在这个网址上遇到了那个错误
http://localhost:3000/messages

无法打开到 localhost:9200 的 TCP 连接(无法分配请求的地址 - “localhost”端口 9200 的 connect(2))

我想从这个网址得到回复
http://localhost:3000/messages

我怎样才能打开端口 9200 ??????????????

这是我的 docker-compose.yml 文件

version: '2'
services:

db:
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: chat_system
MYSQL_USER: appuser
MYSQL_PASSWORD: password
ports:
- "3307:3306"

elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.0
environment:
TAKE_FILE_OWNERSHIP: "true"
network.host: "0.0.0.0"
http.port: "9200"
transport.host: localhost
transport.tcp.port: "9300"
xpack.ml.enabled: "false"
# volumes:
# - ./.data/elastic:/usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
ulimits:
nofile:
soft: "65536"
hard: "65536"

app:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
volumes:
- ".:/chat_system"
ports:
- "3000:3000"
depends_on:
- db
- elastic
links:
- db
- elastic
environment:
DB_USER: root
DB_NAME: chat_system
DB_PASSWORD: password
DB_HOST: db
ELASTIC_HOST: "localhost"
ELASTIC_PORT: "9200"

我运行这个命令来获取弹性日志
     sudo docker-compose logs elastic

我明白了
Attaching to docker_chat_elastic_1
elastic_1 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
elastic_1 | [2019-09-24T17:58:29,261][INFO ][o.e.n.Node ] [] initializing ...
elastic_1 | [2019-09-24T17:58:29,722][INFO ][o.e.e.NodeEnvironment ] [WwjX-hI] using [1] data paths, mounts [[/ (overlay)]], net usable_space [735.2gb], net total_space [895.5gb], types [overlay]
elastic_1 | [2019-09-24T17:58:29,723][INFO ][o.e.e.NodeEnvironment ] [WwjX-hI] heap size [989.8mb], compressed ordinary object pointers [true]
elastic_1 | [2019-09-24T17:58:29,729][INFO ][o.e.n.Node ] [WwjX-hI] node name derived from node ID [WwjX-hIPSZ-7L9XS1bYQFA]; set [node.name] to override
elastic_1 | [2019-09-24T17:58:29,730][INFO ][o.e.n.Node ] [WwjX-hI] version[6.4.0], pid[1], build[default/tar/595516e/2018-08-17T23:18:47.308994Z], OS[Linux/4.4.0-142-generic/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
elastic_1 | [2019-09-24T17:58:29,731][INFO ][o.e.n.Node ] [WwjX-hI] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.arEsgr84, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
elastic_1 | [2019-09-24T17:58:31,488][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [aggs-matrix-stats]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [analysis-common]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [ingest-common]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-expression]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-mustache]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-painless]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [mapper-extras]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [parent-join]
elastic_1 | [2019-09-24T17:58:31,489][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [percolator]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [rank-eval]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [reindex]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [repository-url]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [transport-netty4]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [tribe]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-core]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-deprecation]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-graph]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-logstash]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-ml]
elastic_1 | [2019-09-24T17:58:31,490][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-monitoring]
elastic_1 | [2019-09-24T17:58:31,491][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-rollup]
elastic_1 | [2019-09-24T17:58:31,491][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-security]
elastic_1 | [2019-09-24T17:58:31,491][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-sql]
elastic_1 | [2019-09-24T17:58:31,491][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-upgrade]
elastic_1 | [2019-09-24T17:58:31,491][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-watcher]
elastic_1 | [2019-09-24T17:58:31,492][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded plugin [ingest-geoip]
elastic_1 | [2019-09-24T17:58:31,492][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded plugin [ingest-user-agent]
elastic_1 | [2019-09-24T17:58:33,514][WARN ][o.e.d.s.ScriptModule ] Script: returning default values for missing document values is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions.
elastic_1 | [2019-09-24T17:58:35,286][INFO ][o.e.x.s.a.s.FileRolesStore] [WwjX-hI] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
elastic_1 | [2019-09-24T17:58:36,476][INFO ][o.e.d.DiscoveryModule ] [WwjX-hI] using discovery type [zen]
elastic_1 | [2019-09-24T17:58:37,104][INFO ][o.e.n.Node ] [WwjX-hI] initialized
elastic_1 | [2019-09-24T17:58:37,105][INFO ][o.e.n.Node ] [WwjX-hI] starting ...
elastic_1 | [2019-09-24T17:58:37,256][INFO ][o.e.t.TransportService ] [WwjX-hI] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
elastic_1 | [2019-09-24T17:58:40,338][INFO ][o.e.c.s.MasterService ] [WwjX-hI] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{iaR_00fyTMuqfMiCpiq1UQ}{localhost}{127.0.0.1:9300}{xpack.installed=true}
elastic_1 | [2019-09-24T17:58:40,343][INFO ][o.e.c.s.ClusterApplierService] [WwjX-hI] new_master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{iaR_00fyTMuqfMiCpiq1UQ}{localhost}{127.0.0.1:9300}{xpack.installed=true}, reason: apply cluster state (from master [master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{iaR_00fyTMuqfMiCpiq1UQ}{localhost}{127.0.0.1:9300}{xpack.installed=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
elastic_1 | [2019-09-24T17:58:40,359][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [WwjX-hI] publish_address {172.18.0.2:9200}, bound_addresses {0.0.0.0:9200}
elastic_1 | [2019-09-24T17:58:40,359][INFO ][o.e.n.Node ] [WwjX-hI] started
elastic_1 | [2019-09-24T17:58:40,672][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [WwjX-hI] Failed to clear cache for realms [[]]
elastic_1 | [2019-09-24T17:58:40,751][INFO ][o.e.g.GatewayService ] [WwjX-hI] recovered [0] indices into cluster_state
elastic_1 | [2019-09-24T17:58:42,283][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
elastic_1 | [2019-09-24T17:58:42,437][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.watches] for index patterns [.watches*]
elastic_1 | [2019-09-24T17:58:42,665][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.triggered_watches] for index patterns [.triggered_watches*]
elastic_1 | [2019-09-24T17:58:42,859][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*]
elastic_1 | [2019-09-24T17:58:43,045][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*]
elastic_1 | [2019-09-24T17:58:43,305][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6]
elastic_1 | [2019-09-24T17:58:44,163][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*]
elastic_1 | [2019-09-24T17:58:44,422][INFO ][o.e.c.m.MetaDataIndexTemplateService] [WwjX-hI] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*]
elastic_1 | [2019-09-24T17:58:45,050][INFO ][o.e.l.LicenseService ] [WwjX-hI] license [9f6ac6c0-620a-4b71-b3e7-da5bb37b8337] mode [basic] - valid
elastic_1 | [2019-09-24T18:00:15,514][INFO ][o.e.n.Node ] [WwjX-hI] stopping ...
elastic_1 | [2019-09-24T18:00:15,525][INFO ][o.e.x.w.WatcherService ] [WwjX-hI] stopping watch service, reason [shutdown initiated]
elastic_1 | [2019-09-24T18:00:15,764][INFO ][o.e.n.Node ] [WwjX-hI] stopped
elastic_1 | [2019-09-24T18:00:15,764][INFO ][o.e.n.Node ] [WwjX-hI] closing ...
elastic_1 | [2019-09-24T18:00:15,770][INFO ][o.e.n.Node ] [WwjX-hI] closed
elastic_1 | OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
elastic_1 | [2019-09-24T18:00:28,430][INFO ][o.e.n.Node ] [] initializing ...
elastic_1 | [2019-09-24T18:00:28,776][INFO ][o.e.e.NodeEnvironment ] [WwjX-hI] using [1] data paths, mounts [[/ (overlay)]], net usable_space [735.1gb], net total_space [895.5gb], types [overlay]
elastic_1 | [2019-09-24T18:00:28,777][INFO ][o.e.e.NodeEnvironment ] [WwjX-hI] heap size [989.8mb], compressed ordinary object pointers [true]
elastic_1 | [2019-09-24T18:00:28,782][INFO ][o.e.n.Node ] [WwjX-hI] node name derived from node ID [WwjX-hIPSZ-7L9XS1bYQFA]; set [node.name] to override
elastic_1 | [2019-09-24T18:00:28,783][INFO ][o.e.n.Node ] [WwjX-hI] version[6.4.0], pid[1], build[default/tar/595516e/2018-08-17T23:18:47.308994Z], OS[Linux/4.4.0-142-generic/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
elastic_1 | [2019-09-24T18:00:28,783][INFO ][o.e.n.Node ] [WwjX-hI] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.wSQUCcFj, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
elastic_1 | [2019-09-24T18:00:30,057][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [aggs-matrix-stats]
elastic_1 | [2019-09-24T18:00:30,057][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [analysis-common]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [ingest-common]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-expression]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-mustache]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [lang-painless]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [mapper-extras]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [parent-join]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [percolator]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [rank-eval]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [reindex]
elastic_1 | [2019-09-24T18:00:30,058][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [repository-url]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [transport-netty4]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [tribe]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-core]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-deprecation]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-graph]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-logstash]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-ml]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-monitoring]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-rollup]
elastic_1 | [2019-09-24T18:00:30,059][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-security]
elastic_1 | [2019-09-24T18:00:30,060][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-sql]
elastic_1 | [2019-09-24T18:00:30,060][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-upgrade]
elastic_1 | [2019-09-24T18:00:30,060][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded module [x-pack-watcher]
elastic_1 | [2019-09-24T18:00:30,060][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded plugin [ingest-geoip]
elastic_1 | [2019-09-24T18:00:30,060][INFO ][o.e.p.PluginsService ] [WwjX-hI] loaded plugin [ingest-user-agent]
elastic_1 | [2019-09-24T18:00:31,792][WARN ][o.e.d.s.ScriptModule ] Script: returning default values for missing document values is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions.
elastic_1 | [2019-09-24T18:00:33,335][INFO ][o.e.x.s.a.s.FileRolesStore] [WwjX-hI] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
elastic_1 | [2019-09-24T18:00:34,159][INFO ][o.e.d.DiscoveryModule ] [WwjX-hI] using discovery type [zen]
elastic_1 | [2019-09-24T18:00:34,790][INFO ][o.e.n.Node ] [WwjX-hI] initialized
elastic_1 | [2019-09-24T18:00:34,790][INFO ][o.e.n.Node ] [WwjX-hI] starting ...
elastic_1 | [2019-09-24T18:00:34,927][INFO ][o.e.t.TransportService ] [WwjX-hI] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
elastic_1 | [2019-09-24T18:00:38,001][INFO ][o.e.c.s.MasterService ] [WwjX-hI] zen-disco-elected-as-master ([0] nodes joined)[, ], reason: new_master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{CzEAmK5jRsOh6lrRagMi_Q}{localhost}{127.0.0.1:9300}{xpack.installed=true}
elastic_1 | [2019-09-24T18:00:38,005][INFO ][o.e.c.s.ClusterApplierService] [WwjX-hI] new_master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{CzEAmK5jRsOh6lrRagMi_Q}{localhost}{127.0.0.1:9300}{xpack.installed=true}, reason: apply cluster state (from master [master {WwjX-hI}{WwjX-hIPSZ-7L9XS1bYQFA}{CzEAmK5jRsOh6lrRagMi_Q}{localhost}{127.0.0.1:9300}{xpack.installed=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)[, ]]])
elastic_1 | [2019-09-24T18:00:38,023][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [WwjX-hI] publish_address {172.18.0.3:9200}, bound_addresses {0.0.0.0:9200}
elastic_1 | [2019-09-24T18:00:38,023][INFO ][o.e.n.Node ] [WwjX-hI] started
elastic_1 | [2019-09-24T18:00:38,721][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [WwjX-hI] Failed to clear cache for realms [[]]
elastic_1 | [2019-09-24T18:00:38,762][INFO ][o.e.l.LicenseService ] [WwjX-hI] license [9f6ac6c0-620a-4b71-b3e7-da5bb37b8337] mode [basic] - valid
elastic_1 | [2019-09-24T18:00:38,772][INFO ][o.e.g.GatewayService ] [WwjX-hI] recovered [0] indices into cluster_state

最佳答案

docker-compose 公开服务“弹性”。此服务可在您的 docker 网络中解析,因此您的 Rails 应用程序应该像这样连接:

ELASTIC_HOST: "elastic"

桥接模式容器中的 localhost 是容器本地的。

关于ruby-on-rails - 无法打开到本地主机的 TCP 连接 :9200 (Cannot assign requested address - connect(2) for "localhost" port 9200),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58084493/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com