This message was deleted.
# general
s
This message was deleted.
l
You can run Pulsar in standalone mode and attach the debugger to the process. Download the binary distribution of a release, extract it to some directory and run this command:
Copy code
OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" ./bin/pulsar standalone -nss -nfw
You can then attach the debugger from IDE on port 5005. Change "suspend=y" if you want that the process waits for the debugger to connect. IDE setup instructions are at https://pulsar.apache.org/contribute/setup-ide/ You can debug the source version of Pulsar in a similar way after compiling.
Copy code
git clone <https://github.com/apache/pulsar>
cd pulsar
mvn -Pcore-modules,-main -T 1C install -DskipTests -Dspotbugs.skip=true
OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" ./bin/pulsar standalone -nss -nfw
To reset the persistent state, you can remove
data/*
before starting.
rm -rf data/*
To learn how it works, you might want to start with the understanding of the architecture and concepts. https://pulsar.apache.org/docs/next/concepts-architecture-overview/ is where you can find this information. There are various blog posts that explain more details, for example this one is useful: https://jack-vanlightly.com/blog/2018/10/2/understanding-how-apache-pulsar-works
u
Thank you, Lari. Best regards.
@Lari Hotari Hello again, I have attached debugger to pulsar but couldn't use debugger yet, can I use debugger through using pulsar-shell, or is there another way?
l
@Umut Bilal Okur Have you tried using IntelliJ's debugger? With the debugger, do you mean a Java code debugger? That's what the options that I provided will allow using. Once you have IntelliJ setup with the Pulsar code base, (please check the "Setting up and IDE" instructions) you can add a new debugger run configuration in IntelliJ to connect to the Pulsar process.
You have to make sure that you have source code checked out for the version that you debugging. If you debug the source version built by yourself, that would match in every case.
u
@Lari Hotari I have same configurations as you provided. And also I ran pulsar standalone with command that you give and I have managed to attach the IntelliJ debugger. So far so good. After that, I've excepted to trigger the breakpoints while I'm using pulsar-shell commands.
Probably, I missed some logic, is it possible to trigger breakpoints with pulsar-shell commands?
l
If you'd like to have breakpoints in pulsar-shell / pulsar client, you should pass the debugger enabling to the pulsar-shell process. the same way will work for
pulsar-shell
if you want to have then enabled both at the same time, you should pick unique ports
something like this should work for `pulsar-shell`:
Copy code
OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" ./bin/pulsar-shell
🙌 1
assuming you are using MacOS or Linux
u
@Lari Hotari Thank you! It is solved now.
are these commands available on documents on the website
Did I missed it?
l
I think it's missing. Please contribute an improvement!
u
I will indeed, thank you again.
👍 1
@Lari Hotari I have opened the required PR for documentation on pulsar-site. Can you take a look when you're available. Thanks again.
l
Thank you @Umut Bilal Okur! Awesome job. I provided a review comment on https://github.com/apache/pulsar-site/pull/749 .
🙌 1
u
Thanks a lot, friend. I appreciate it.