Build Cloud-Native apps with Apache Cassandra

GOT QUESTIONS from the Workshop? You're in the right place! Post a question here and we'll get you answers.

Click here for Week 8 Materials and Homework.

Follow us on Eventbrite to get notified when new workshops are scheduled!


question

chandrasekar.b03_190734 avatar image
chandrasekar.b03_190734 asked ·

Getting "Unable to listen on port 9090: Listeners failed to create with the following errors" in week 6 exercise

I have followed the new update on github using the cloud instance by refering the link given in this lquestion, https://community.datastax.com/questions/7478/port-5000-blocked-on-cloud-instance-cannot-run-exe.html

I successfully edited the BASE_ADDRESS for my cloud instance instead of localhost.

BASE_ADDRESS: 'http://<my_cloudinstancelink:9090/api>'

But finally when i tested my docker container, i get this.

docker run -e USE_ASTRA='true' -p 9090:9090 astra-backend:my-image

docker: Error response from daemon: driver failed programming external connect
ivity on endpoint youthful_herschel (bb0a03b02dd1ccf9fb59db628dfb90a31401ba759
1b7bbac281e99f8302e8c41): Bind for 0.0.0.0:9090 failed: port is already alloca
ted.                                                                 

docker run -e USE_ASTRA='true' -e BASE_ADDRESS='http://localhost:9090/api' -p 3000:3000 astra-ui:my-image

docker: Error response from daemon: driver failed programming external connectivity on endpoint eloquent_brattain (0a618fb18fc330258ec763084a507dff47ed3e36a5ea0549a3a2fa75788ee8d5): Bind for 0.0.0.0:3000 failed: port is already allocated.

i thought that it may be solved at final stage. but when i forwarded the port in the last step, i get this,

kubectl -n my-app port-forward pods/astra-backend 9090:9090 &

&Unable to listen on port 9090: Listeners failed to create with the following errors: [unable to create listener: Error listen tcp4 127.0.0.1:9090: bind: address already in use unable to create listener: Error listen tcp6 [::1]:9090: bind: address already in use]                                                                             error: unable to listen on any of the requested ports: [{9090 9090}]          
[2] 1048258                                                                   
[1]   Exit 1   

kubectl -n my-app  port-forward pods/astra-ui 3000:3000 &

Unable
 to listen on port 3000: Listeners failed to create with the following errors:
 [unable to create listener: Error listen tcp4 127.0.0.1:3000: bind: address a
lready in use unable to create listener: Error listen tcp6 [::1]:3000: bind: a
ddress already in use]                                                        
error: unable to listen on any of the requested ports: [{3000 3000}]          

[2]+  Exit 1                  

Also i'm nnot able to access the site for port 9090. It says "SIte cannot be reached". i have included a screen shot of it.



For your kind information, i have extended another 24 hours for instance. so let me execute it successfully with your help. Help me solving this error.

Kindly acknowledge ASAP.

Any hep would be very much appreciable. :)

workshop
port-forwarding.jpg (622.1 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Cedrick Lunven avatar image
Cedrick Lunven answered ·

So looking at this instance you docker images are still running and use ports you target.

docker ps
2a62ee83ca54  astra-backend:my-image   "python getting_star…"   3 hours ago         Up 3 hours          5000/tcp, 0.0.0.0:9090->9090/tcp   lucid_torvalds                                                                                 40d93bda49bd  astra-ui:my-image        "docker-entrypoint.s…"   22 hours ago        Up 22 hours         0.0.0.0:3000->3000/tcp             angry_stonebraker                                                                              bb231666b96e  astra-backend:my-image   "python getting_star…"   22 hours ago        Up 22 hours         0.0.0.0:5000->5000/tcp             gallant_lehmann                                                                                                     

Enter

docker stop 2a62ee83ca54
docker stop 40d93bda49bd
docker stop bb231666b96e

and should be good to execute the port forward commands !

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi @Cedrick Lunven

yeah ! now i'm good to forward the port but still the "Site can't be reached". As you have told, i checked my cloud instance URL (on my screenshot, one of the browser tab is the example cloud instance from the github but actual page is not loaded at that moment but it also produces the same error).

Now how can i correct this issue?

0 Likes 0 · ·

As clarified in private messages, these follow-on errors were due to the fact that the cloud instance did not have the latest code, so the pod wasn't serving on port 9090.

0 Likes 0 · ·
bettina.swynnerton avatar image
bettina.swynnerton answered ·

Hi @chandrasekar.b03_190734,

can you please stop any running astra-ui docker containers (they would bind the port), and then we try again.

To get the running ui containers:

docker ps

to stop the running containers, take the container id and then do

docker stop <container_id>

then run the UI container again. However, note that you need to specify the right base_address as per readme:

If you're using a DataStax cloud instance, remember to use the EC2 instance name in place of localhost, for example: http://wksv136191.cws-week6.datastaxtraining.com:9090/

Let us know how it goes.

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi @bettina.swynnerton

As you have told, i stopped the containers and checked for proper functioning.

The port forwarding was successful but "The site can't be reached" still persist even after reloading the page. (Have completed all the steps from the beginning after cleaning up). Waiting for your help !!!

0 Likes 0 · ·

Hi @chandrasekar.b03_190734,

as Cedrick pointed out earlier, from the screenshots it seems you are using two different cloud instances. Check that you reload the page for the correct instance.

Thanks!

0 Likes 0 · ·