Ah I’m glad you got that working. Thanks for reporting back! — Martijn
> On 14 Jan 2020, at 22:48, Arnold Bronley <arnoldbron...@gmail.com> wrote: > > Thanks. > > The issue turned out to be little different that expected. My IntelliJ was > on a Windows (my main operating system). Solr was running inside a docker > container inside Debian VM hosted on my Windows operating system. > Debug server that runs inside the docker container will accept connections > only from locahost (container itself). In order for the debug server to > accept the connections made from Intellij (which is on a different host, it > is neither running inside docker container nor inside Debian VM, it is > running on Windows host machine), in the command line arguments for JVM, > > instead of > -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 > > we need to pass > -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 > > Notice the wildcard usage for address parameter. It tells the debug server > to accept connections from any host. > > Thanks for all the help. > > > > On Mon, Jan 13, 2020 at 2:56 PM Edward Ribeiro <edward.ribe...@gmail.com> > wrote: > >> Hi, >> >> I was able to connect my IDE to Solr running on a container by using the >> following command: >> >> command: > >> bash -c "solr start -c -f -a >> -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005;" >> >> It starts SolrCloud ( -c ) and listens on foreground ( -f ) so you don't >> need to resort to tail -f. >> >> OTOH, I understand that you want to run the commands below after the >> container is up and Solr is accepting connections: >> >> wait-for-solr.sh; >> solr create -c data_core -d /var/lib/solr/data_core; >> >> IMHO, you could put those commands in a bash script (setup.sh in my >> example) and start them first in background. Therefore, while the setup.sh >> script is attempting to connect to Solr the server is starting in >> foreground: >> >> command: > >> bash -c "./myscript.sh& exec solr start -c -f -a >> -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005; " >> >> See that there's an 'exec' keyword between the script and the solr >> launching command. >> >> Best, >> Edward >> >> On Mon, Jan 13, 2020 at 3:09 PM Arnold Bronley <arnoldbron...@gmail.com> >> wrote: >>> >>> Thanks for your helpful replies, guys. >>> >>> @Edward: you were correct. I forgot to export 5005 port in YAML. After >>> exporting this port, I am at least able to see the process with following >>> command (I was not able to see it before): >>> >>> gnandre@gnandre-deb9-64:/sandbox/gnandre/mw-ruby-development-server$ >> sudo >>> lsof -i tcp:5005 >>> COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME >>> docker-pr 181928 root 4u IPv6 91702195 0t0 TCP *:5005 (LISTEN) >>> >>> However, even after this, it is not working. i.e. I am not able to >> connect >>> to the debug session from IntelliJ. It still throws connection refused >>> error as it did previously. >>> >>> Here is the full Solr setting now: >>> >>> solr: >>> build: >>> context: ${DEV_ENV_ROOT}/solr/docker >>> dockerfile: Dockerfile.development >>> args: >>> DEV_ENV_USER_ID: ${DEV_ENV_USER_ID} >>> networks: >>> - default >>> ports: >>> - "8983:8983" >>> - "9983:9983" >>> - "5005:5005" >>> environment: >>> - SOLR_HEAP=2048m >>> command: > >>> bash -c "solr start -a >>> "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" >> -cloud >>> -s /var/lib/solr -t /var/data/solr; set -x; export; wait-for-solr.sh; >>> >>> solr create -c data_core -d /var/lib/solr/data_core; >>> tail -f /var/log/solr/solr.log" >>> >>> @Martijn: As you can see in the setting above, the tail command does not >>> let container exit. I had to start Solr in background otherwise I cannot >>> run command to create collection after it if Solr is started in >> foreground. >>> >>> I tried both the settings that you have given above. I see the ' >> Listening >>> for transport dt_socket at address: 5005' statement in the startup logs. >> I >>> can also see that there is a process running on this port. >>> gnandre@gnandre-deb9-64:/sandbox/gnandre/mw-ruby-development-server$ >> sudo >>> lsof -i tcp:5005 >>> COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME >>> docker-pr 181928 root 4u IPv6 91702195 0t0 TCP *:5005 (LISTEN) >>> >>> but if I try to connect it with telnet command directly from the Debian >>> machine then it fails >>> gnandre@gnandre-deb9-64:/sandbox/gnandre/mw-ruby-development-server$ >> telnet >>> localhost 5005 >>> Trying 127.0.0.1... >>> Connected to localhost. >>> Escape character is '^]'. >>> Connection closed by foreign host. >>> >>> if I use the Debian machine name on which this docker instance is >> running, >>> it still fails but with different error: >>> gnandre@gnandre-deb9-64:/sandbox/gnandre/mw-ruby-development-server$ >> sudo >>> lsof -i tcp:5005 >>> (failed reverse-i-search)`telent ': ^Clnet localhost 5005 >>> gnandre@gnandre-deb9-64:/sandbox/gnandre/mw-ruby-development-server$ >> telnet >>> gnandre-deb9-64 5005 >>> Trying 172.28.155.62... >>> telnet: Unable to connect to remote host: Connection refused >>> >>> I used telnet command to test the debug port. I also tried to connect the >>> debugging session from IntelliJ and it fails with the same issue. i.e. >>> Connection refused. This is was the same error that I was getting in the >>> first place. >>> >>> Any more suggestions? >>> >>> >>> >>> On Sat, Jan 11, 2020 at 10:15 AM Martijn Koster < >> mak-luc...@greenhills.co.uk> >>> wrote: >>> >>>> I think you may have a quoting issue there: remove those inner ones. >> Not >>>> that it should matter in this instance. >>>> I’m not sure why you’re using “start”, which will run solr in the >>>> background, or what you expect to happen after the wait-for-solr.sh — >> if it >>>> all worked as you expected that would wait for solr, then exit, >> destroying >>>> the container. >>>> >>>> This seems to work: >>>> >>>> version: '3.3' >>>> services: >>>> solr1: >>>> container_name: solr1 >>>> image: solr:8.4 >>>> ports: >>>> - "8981:8983” >>>> - "5005:5005” >>>> command: bash -c "solr-fg -a >>>> -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005” >>>> >>>> Or even just: >>>> >>>> version: ‘3.3' >>>> services: >>>> solr1: >>>> container_name: solr1 >>>> image: solr:8.4 >>>> ports: >>>> - "8981:8983” >>>> - "5005:5005” >>>> environment: >>>> - >>>> >> >> "SOLR_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005” >>>> >>>> The thing to look for in the logs is: solr1 | Listening for >> transport >>>> dt_socket at address: 5005 >>>> >>>> BTW, when looking at these sort of subtleties, it’s always useful to >> exec >>>> into the container, and run `tr '\000' '\n' </proc/10/cmdline` (where >> 10 is >>>> the pid of java in your container, doublecheck with `ps -eflwww`), to >> make >>>> sure it’s running with the arguments you expect it to. >>>> >>>> — Martijn >>>> >>>>> On 10 Jan 2020, at 23:42, Arnold Bronley <arnoldbron...@gmail.com> >>>> wrote: >>>>> >>>>> bash -c "solr start -a >>>>> "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005" >>>> -cloud >>>>> -s /var/lib/solr -t /var/data/solr; set -x; export; >> wait-for-solr.sh;" >>>> >>>> >>