Docker swarm connect ECONNREFUSED - docker

I am using seneca.js as microservices framework. Evrything works fine in local but when I deply services to swarm I have problem with messages ping service is somhow blocked, here is error from my api gateway when run route:
{"statusCode":502,"error":"Bad Gateway","message":"connect
ECONNREFUSED 10.100.0.5:55010"}
Here is my setup:
docker network create -d overlay --subnet 10.100.0.0/16 test-net
docker service create --network test-net -p 8400:8400 -p 8500:8500 -p 8600:53/udp --name node1 progrium/consul -server -bootstrap -ui-dir /ui
docker service create --network test-net --name bases -e HOST=bases -e REGISTRY=node1 vforv/bases:v2
docker service create --network test-net -p 5000:5000 --name api -e BASES=bases -e HOST=api -e REGISTRY=node1 vforv/api-gateway:v2
docker service create --network test-net --name ping -e HOST=ping -e REGISTRY=node1 vforv/ping-service:v3
here is code:
https://github.com/vforv/hapi-seneca-ts
Anyone know what is problem?

Related

When I open the rabbitmq container with the following command, the log inside the container is empty

When I use this command:
docker run -d --hostname rabbit1 --net=host --name myrabbit1 -p 4369:4369 -p 15672:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -e RABBITMQ_ERLANG_COOKIE='rabbitcookie' rabbitmq:3.6.9-management
The container is started but there is no log file. If I want to see the rabbit logs inside the container, how should I modify the above command?

Remote access to cassandra 4.0.1 using docker via cqlsh

My Environment:
Windows 10 Home
WSL2
Cassandra 4.0.1: Official Docker Image
Docker command:
docker run --name cassandra-node-0 -p 7000:7000 -p 7001:7001 -p 7199:7199 -p 9042:9042 -p 9160:9160 -e CASSANDRA_CLUSTER_NAME=MyCluster -e CASSANDRA_ENDPOINT_SNITCH=GossipingPropertyFileSnitch -e CASSANDRA_DC=datacenter1 -e CASSANDRA_BROADCAST_ADDRESS=192.168.1.101 -d cassandra
CQLSH Command:
docker run -it -e CQLSH_HOST=$(docker inspect --format='{{ .NetworkSettings.IPAddress}}' cassandra-node-0) --name cassandra-client --entrypoint=cqlsh cassandra
I try to connect cassandra node using cqlsh where ubuntu in WSL2 in same pc.
I did not change all *.yaml file and only use Docker Env.
When I insert node's docker network ip to CQLSH_HOST, cqlsh is successfully connected node.
But, When I insert my private ip, public ip or 127.0.0.1, cqlsh is refused connection to node.
This shows the same issue when nodes from different networks connect.
I think I'm missing a setting of something Docker Env.
What settings am I missing?
[Update] I add some port fowarding rules in firewall but same issue.
[Update 2] docker ps -a result:
0.0.0.0:7000-7001->7000-7001/tcp, :::7000-7001->7000-7001/tcp, 0.0.0.0:7199->7199/tcp, :::7199->7199/tcp, 0.0.0.0:9042->9042/tcp, :::9042->9042/tcp, 0.0.0.0:9160->9160/tcp, :::9160->9160/tcp
Try adding --hostname and --network when you run Cassandra. For example:
$ docker run --rm -d
--name cassandra-node-0
--hostname cassandra-node-0
--network cassandra-node-0
You'll find that it's easier to connect via cqlsh by adding:
--network cassandra-node-0
-e CQLSH_HOST=cassandra-node-0
to your docker run command. Cheers!

How to create multiple Debezium connectores for mysql database

I am tring to connect multiple Debezium connectores for a mysql database and my configurations are as follows.
sudo docker run -it --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper:1.5 &
sudo docker run -it --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka:1.5 &
sudo docker run -it --name connect -p 8083:8083 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my_connect_configs -e OFFSET_STORAGE_TOPIC=my_connect_offsets -e STATUS_STORAGE_TOPIC=my_connect_statuses --link zookeeper:zookeeper --link kafka:kafka debezium/connect:1.5 &
sudo docker run -it --name connect1 -p 8084:8084 -e GROUP_ID=1 -e CONFIG_STORAGE_TOPIC=my_connect_configs -e OFFSET_STORAGE_TOPIC=my_connect_offsets -e STATUS_STORAGE_TOPIC=my_connect_statuses --link zookeeper:zookeeper --link kafka:kafka debezium/connect:1.5 &
but when i tring to run second connector...following error occurred.
ERRO[0000] error waiting for container: context canceled
Can anyone help me with this please.
You're not running any connectors, only containers for workers.
One Kafka Connect worker can be used to submit more than one connector task via the HTTP server on port 8083
Regarding the commands shown, you do not need multiple containers unless you are trying to create a Connect worker cluster
In order to do so, they need the same topics and the same group id.
You'd also want -p 8084:8083 since you've not changed the server port. Also, rather than using &, you can do docker run -d, but using Docker Compose would make more sense here

Docker containers in read-only mode

still pretty new to docker and i could use some help. I am trying to setup some docker containers precisely the redash appplication. Here is my working code:
sudo docker network create redash_default
sudo docker container run --name redis --network redash_default -d redis:4.0-alpine
sudo docker container run --name postgres --network redash_default --env-file /opt/redash/env -v /opt/redash/postgres-data -d postgres:9.5.21-alpine
sudo docker container run --rm -p 5000:5000 -e REDASH_WEB_WORKERS=4 --name server --network redash_default --env-file env redash/redash:7.0.0.b18042 create_db
sudo docker container run -d --restart always -p 5000:5000 -e REDASH_WEB_WORKERS=4 --name server --network redash_default --env-file env redash/redash:7.0.0.b18042
sudo docker container run -d --restart always -e QUEUES=celery -e WORKERS_COUNT=1 --name scheduler --network redash_default --env-file env redash/redash:7.0.0.b18042
sudo docker container run -d --restart always -e QUEUES=scheduled_queries,schemas -e WORKERS_COUNT=1 --name scheduled_worker --network redash_default --env-file env redash/redash:7.0.0.b18042
sudo docker container run -d --restart always -e QUEUES=queries -e WORKERS_COUNT=2 --name adhoc_worker --network redash_default --env-file env redash/redash:7.0.0.b18042
sudo docker container run -d --restart always -p 80:80 --link server:redash --name nginx --network redash_default redash/nginx:latest
however i am only allowed to run the containers in read-only mode which is breaking the application. Only redis seemed to like the read-only mode so i thought about mounting an external persistent disk on the instance /dockervol/ where the apps can be given RW access but i cant seem to get that work either. here is something i have tried for example with nginx
docker container run -p 80:80 --mount type=bind,source=/dockervol/nginx,target=/etc/nginx – read-only --link server:redash --name nginx --network redash_default redash/nginx:latest
i get an error
nginx: [emerg] open() “/etc/nginx/nginx.conf” failed (2: No such file or directory)
My question is how do i get all the containers to work in read-only mode with a persistent volume without breaking the application.

NSQ Docker Swarm

I'm trying to use NSQ in Docker Swarm without success
mhlg/rpi-nsq is a Docker image built for the Raspberry Pi ARM7 board and I can confirm is working correctly if run as a normal Docker container
Running NSQ in Docker (OK)
# crete a bridged network
$ docker network create nsq_network
# run lookupd
$ docker run --name nsqlookupd --network nsq_network -p 4160:4160 -p 4161:4161 mhlg/rpi-nsq nsqlookupd
# run nsqd
$ docker run --name nsqd --network nsq_network -p 4150:4150 -p 4151:4151 mhlg/rpi-nsq nsqd --broadcast-address=nsqd --lookupd-tcp-address=nsqlookupd:4160
# run nsqadmin
$ docker run --name nsqadmin --network nsq_network -p 4171:4171 mhlg/rpi-nsq nsqadmin --lookupd-http-address=nsqlookupd:4161
Running NSQ in Docker Swarm mode (FAIL)
this is what I'm doing in the swarm manager
# crete an overlay network
$ docker network create nsq_network
# run nsqlookupd
$ docker service create --replicas 1 --name nsqlookupd --network nsq_network -p 4160:4160 -p 4161:4161 mhlg/rpi-nsq nsqlookupd
# run nsqd
$ docker service create --replicas 1 --name nsqd --network nsq_network -p 4150:4150 -p 4151:4151 mhlg/rpi-nsq nsqd --lookupd-tcp-address=nsqlookupd:4160 --broadcast-address=nsqd
# run nsqadmin
$ docker service create --replicas 1 --name nsqadmin --network nsq_network -p 4171:4171 mhlg/rpi-nsq nsqadmin --lookupd-http-address=nsqlookupd:4161
If I attach to the nsqd service I can see it is not able to connect to nsqlookupd service.
[nsqd] 2016/12/09 16:51:56.851953 LOOKUPD(nsqlookupd:4160): sending heartbeat
[nsqd] 2016/12/09 16:51:56.852049 LOOKUP connecting to nsqlookupd:4160
[nsqd] 2016/12/09 16:51:57.852457 LOOKUPD(nsqlookupd:4160): ERROR PING - dial tcp: i/o timeout
It looks like the overlay network create some issues (multicast?) but I can not figure how I can solve it especially on an ARM device.
I tried to ssh into the Docker Host running the nsqd service and exec some dns commands from inside the nsqd container
# resolve google.com (OK)
root#3206d1c3cd3d:/# nslookup google.com
Server: 127.0.0.11
Address: 127.0.0.11#53
Non-authoritative answer:
Name: google.com
Address: 216.58.214.78
# resolve nsqd service (OK) - can resolve the container I'm executing the command from
root#e1f6430acd1c:/# nslookup nsqd
Server: 127.0.0.11
Address: 127.0.0.11#53
Non-authoritative answer:
Name: nsqd
Address: 10.0.0.2
# resolve nsqlookupd service (FAIL)
root#e1f6430acd1c:/# nslookup nsqlookupd
;; connection timed out; no servers could be reached
Ran into the same exact issue in docker swarm. This is how I resolved it:
docker service create \
--mode global \
--name swarm-master-nsq_nsqlookupd \
--constraint node.role==manager \
--hostname nsqlookupd \
--network name=swarm-master-nsq_nsq,alias=nsqlookupd \
nsqio/nsq:latest /nsqlookupd
docker service create \
--replicas 3 \
--name swarm-master-nsq_nsqd \
--constraint node.role==manager \
--hostname nsqd \
--network name=swarm-master-nsq_nsq,alias=nsqd \
nsqio/nsq:latest sh -c '/nsqd --broadcast-address=$(hostname -i) --lookupd-tcp-address=nsqlookupd:4160'
docker service create \
--replicas 1 \
--publish 4171:4171 \
--name swarm-master-nsq_nsqadmin \
--constraint node.role==manager \
--hostname nsqadmin \
--network name=swarm-master-nsq_nsq,alias=nsqadmin \
nsqio/nsq:latest /nsqadmin --lookupd-http-address=nsqlookupd:4161
As far as I can tell, there are a couple issues in your example:
You are not aliasing nsqlookupd, and other services
the broadcast of nsqd is incorrect (assuming you want to at some point increase the number of nsqd nodes)
You indicate:
# crete an overlay network
$ docker network create nsq_network
However, that does not create an overlay network but rather a bridge network.
Consider running:
docker network create --driver overlay nsq_network

Resources