we should follow the given steps for remote debugging of the ranger:
1. clone the incubator ranger code to your local machine & Import the Apache Ranger project into eclipse.
2. Now lets say you want to debug the Ranger Admin process then go to the machine where Ranger Admin process is running.
edit the /usr/bin/ranger-admin and add the entry as follows:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000"
keep suspend to n , if nothing need to be debug in startup flow.
keep suspend to y, if ranger startup flow need to be debug. in this case process will wait for eclipse to connect to the debug port before it starts
3. check whether debug port 9000 is open for ranger admin process
netstat -tanlp | grep 16776 tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 16776/java
4. go to eclipse and in your project Debug as -> Debug Configurations -> Remote Java Applications and there provide the host and port.
host should be the node ip/hostname where ranger admin is running
port is the debug port we have configured in JAVA_OPTS ( in our case it is 9000)
and click on debug.
now eclipse client will be connected to the running process.
5. Now lets say we want to debug the search user flow in ranger. then we can put debug point at the respective point and perform the user search operation on ranger UI then we can see flow will come to the debug point we had put. please see the screenshot.
ranger user search operation:
then we can further step over/into and debug the flow.
Note: same way we can debug other ranger process such as usersync.
- that is it in Remote debugging Ranger process, please comment your questions if any.