GlassFish Clustering with DCOM on Windows
- by ByronNevins
DCOM - Distributed COM, a Microsoft protocol for communicating with Windows machines.
Why use DCOM?
In GlassFish 3.1 SSH is used as the standard way to run commands on remote nodes for clustering. It is very difficult for users to get SSH configured properly on Windows. SSH does not come with Windows so we have to depend on third party tools. And then the user is forced to install and configure these tools -- which can be tricky.
DCOM is available on all supported platforms. It is built-in to Windows.
The idea is to use DCOM to communicate with remote Windows nodes. This has the huge advantage that the user has to do minimal, if any, configuration on the Windows nodes.
Implementation HighlightsTwo open Source Libraries have been added to GlassFish:
Jcifs – a SAMBA implementation in Java
J-interop – A Java implementation for making DCOM calls to remote Windows computers.
Note that any supported platform can use DCOM to work with Windows nodes -- not just Windows.E.g. you can have a Linux DAS work with Windows remote instances.All existing SSH commands now have a corresponding DCOM command – except for setup-ssh which isn’t needed for DCOM. validate-dcom is an all new command.
New DCOM Commands
create-node-dcom
delete-node-dcom
install-node-dcom
list-nodes-dcom
ping-node-dcom
uninstall-node-dcom
update-node-dcom
validate-dcom
setup-local-dcom (This is only available via Update Center for GlassFish 3.1.2)
These commands are in-place in the trunk (4.0). And in the branch (3.1.2)
Windows Configuration Challenges
There are an infinite number of possible configurations of Windows if you look at it as a combination of main release, service-pack, special drivers, software, configuration etc. Later versions of Windows err on the side of tightening security be default. This means that the Windows host may need to have configuration changes made.These configuration changes mostly need to be made by the user. setup-local-dcom will assist you in making required changes to the Windows Registry. See the reference blogs for details.
The validate-dcom Command
validate-dcom is a crucial command. It should be run before any other commands. If it does not run successfully then there is no point in running other commands.The validate-dcom command must be used from a DAS machine to test a different Windows machine. If validate-dcom runs successfully you can be confident that all the DCOM commands will work. Conversely, the opposite is also true: If validate-dcom fails, then no DCOM commands will work.
What validate-dcom does
Verify that the remote host is not the local machine.
Resolves the remote host name
Checks that the remote DCOM port is being listened on (135, 139)
Checks that the remote host’s File Sharing is enabled (port 445)
It copies a file (a script) to the remote host to verify that SAMBA is working and authorization is correct
It runs a script that it copied on-the-fly to the remote host.
Tips and Tricks
The bread and butter commands that use DCOM are existing commands like create-instance, start-instance etc. All of the commands that have dcom in their name are for dealing with the actual nodes.
The way the software works is to call asadmin.bat on the remote machine and run a command. This means that you can track these commands easily on the remote machine with the usual tools. E.g. using AS_LOGFILE, looking at log files, etc. It’s easy to attach a debugger to the remote asadmin process, “just in time”, if necessary. How to debug the remote commands:Edit the asadmin.bat file that is in the glassfish/bin folder. Use glassfish/lib/nadmin.bat in GlassFish 4.0+Add these options to the java call:-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1234 Now if you run, say start-instance on DAS, you can attach your debugger, at your leisure, to the remote machines port 1234. It will be running start-local-instance and patiently waiting for you to attach.