[wildfly-dev] HC and server addresses
Brian Stansberry
brian.stansberry at redhat.com
Mon Jan 20 14:31:32 EST 2014
For a server, you can find out a resolved address for a interface
resource as follows:
[domain at localhost:9990 /]
/host=master/server=server-one/interface=public:read-attribute(name=resolved-address)
{
"outcome" => "success",
"result" => "127.0.0.1"
}
The value will be "undefined" if the resource is not actually in use
(i.e. the server didn't have to start the MSC service backing the resource)
[domain at localhost:9990 /]
/host=master/server=server-one/interface=other:read-attribute(name=resolved-address)
{
"outcome" => "success",
"result" => undefined
}
There's no equivalent option for the host controller processes though.
For example /host=master/interface=management has no resolved-address
property. I'll need to think about how to deal with that.
The reason there's no attribute is because the meaning of such an
attribute is unclear when it's applied to a resource that is scoped to
more than one process. That is /interface=x or host=master/interface=y
are config resources that can eventually drive the config on multiple
host processes and server processes, with each process resolving the
config differently. A "resolved-address" attribute can only tell you the
value it was resolved to on the process that provides the response.
Perhaps for the higher level resources we could just call the attribute
"locally-resolved-address" or something and document the meaning in the
attribute description text.
Probably even better would be to expose bound-address and bound-port
attributes on the
host=master/core-service=management/management-interface=* resources
like we have on the socket-binding resources. That's probably a better
match for what you are looking for.
More inline.
On 1/17/14, 8:48 PM, Claudio Miranda wrote:
> Hi, I was looking for a way to get the HC and server instance ip
> address, using the management api.
>
> The server is started as
>
> ./domain.sh -b pavlov-0 -bmanagement pavlov-0
> -Djboss.domain.base.dir=../lab1-dc
> -Djboss.domain.master.address=pavlov-0
>
> I found out the following command
>
> /host=master/core-service=host-environment:read-resource(include-runtime=true,recursive=true,include-defaults=true,include-aliases=true)
>
> The output
>
> {
> "outcome" => "success",
> "result" => {
> "backup-domain-files" => false,
> "default-jvm" => "/opt/javavm/bin/java",
> "domain-base-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc",
> "domain-config-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/configuration",
> "domain-config-file" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/lab1-dc/configuration/domain.xml",
> "domain-content-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/data/content",
> "domain-data-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/data",
> "domain-log-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/log",
> "domain-servers-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/servers",
> "domain-temp-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/bin/../lab1-dc/tmp",
> "home-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT",
> "host-config-file" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/lab1-dc/configuration/host.xml",
> "host-controller-address" => "/127.0.0.1",
> "host-controller-port" => 0,
> "host-name" => "pavlov",
> "initial-running-mode" => "NORMAL",
> "is-restart" => false,
> "modules-dir" =>
> "/home/claudio/alphaworks/projects/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT/modules",
> "process-controller-address" => "/127.0.0.1",
> "process-controller-port" => 51798,
> "qualified-host-name" => "pavlov",
> "use-cached-dc" => false
> }
> }
>
> Looking at the java properties,
>
> jboss.bind.address = pavlov-0
> jboss.domain.master.address = pavlov-0
> jboss.bind.address.management = pavlov-0
>
> Does the "host-controller-address" property should be pavlov-0 and
> "host-controller-port" equal to 9999 ?
No. Those values are unrelated to communication by end users. Those are
the HC-side values for the internal communication between the HC process
and the ProcessController process that spawned it.
I noticed that some docs re: this are incorrect:
https://issues.jboss.org/browse/WFLY-2781
> Also the "qualified-host-name" and "host-name" equals to pavlov-0 ?
>
Those values are unrelated to bind address settings. They can be set via
-Djboss.host.name and -Djboss.qualified.host.name. If
jboss.qualified.host.name is not set, the HC will look for the
environment variable "HOSTNAME" (on Windows, "COMPUTERNAME"). If not
set, it will fall back to InetAddress.getLocalHost().getHostName() and
if that doesn't work to "unknown-host.unknown-domain". If
-Djboss.host.name isn't set, the qualified host name value will be used,
with everything up to and including the first '.' removed.
> Regards
>
--
Brian Stansberry
Senior Principal Software Engineer
JBoss by Red Hat
More information about the wildfly-dev
mailing list