Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
521 views
in Technique[技术] by (71.8m points)

docker compose - STAN.Client.StanConnectRequestTimeoutException: No response from a streaming server with a cluster ID of 'stan-eas' at STAN.Client.Connection..ctor

I'm trying to containerize my .net core 3.1 service into linux Docker container. So I have a docker-compose as follows:

version: "3.5"

services:
    back:
        build: 
            context: ../../
            dockerfile: local_deploy/back/docker
        container_name: api
        restart: always
        environment:
          - ASPNETCORE_ENVIRONMENT=Development
        depends_on:
          - db-server
        links:
          - nats
        ports:
          - "7000:80"
        networks:
          - localdev

    db-server:
        image: microsoft/mssql-server-linux:2017-latest
        container_name: db-server
        environment:
          - ACCEPT_EULA=Y
          - MSSQL_SA_PASSWORD=1234
          - MSSQL_TCP_PORT=1433
        ports:
          - "1400:1433"
        networks:
          - localdev

    nats:
        image: 'nats:0.8.0'
        entrypoint: "/gnatsd -DV"
        expose:
          - "4222"
        ports:
          - "8222:8222"
          - "6222:6222"
          - "4222:4222"
        networks:
          - localdev

networks:
  localdev:
    name: localdev

But the service also uses NATS Streaming. So, when I run containers I get an error:

STAN.Client.StanConnectRequestTimeoutException: No response from a streaming server with a cluster ID of 'stan-eas' at STAN.Client.Connection..ctor(String stanClusterID, String clientID, StanOptions options)

I tried to add nats-streaming to my docker-compose and indicated cluster id via -cid flag like this:

version: "3.5"

services:
    // another services omitted for brevity
    nats-0:
        container_name: nats-0
        hostname: nats-0
        image: nats-streaming:0.11.2-linux
        depends_on:
          - nats
        networks:
        - localdev
        command: -p 4224 -m 8224 -cid stan-eas -store file -dir /datastore -user some_user -pass some_password -ft_group "ft" -cluster nats://nats-0:6222 -routes nats://nats-1:6223
        volumes:
        - ~/volumes/cherry/data/nats/nats-0:/datastore
        ports:
        - 4224:4224
        - 8224:8224

    nats-1:
        container_name: nats-1
        hostname: nats-1
        image: nats-streaming:0.11.2-linux
        depends_on:
          - nats
        networks:
        - localdev
        command: -p 4223 -m 8223 -cid stan-eas -store file -dir /datastore -user some_user -pass some_password -ft_group "ft" -cluster nats://nats-1:6223 -routes nats://nats-0:6222
        volumes:
        - ~/volumes/cherry/data/nats/nats-0:/datastore
        ports:
        - 4223:4223
        - 8223:8223

networks:
  localdev:
    name: localdev

but the same error still occurs.

Any help would be highly appreciated.

question from:https://stackoverflow.com/questions/65869717/stan-client-stanconnectrequesttimeoutexception-no-response-from-a-streaming-ser

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...