[MarkLogic Dev General] How does ML 5.0 determine the "host" for licensing ?
dlee at epocrates.com
Wed Nov 2 09:03:03 PDT 2011
Got it working.
Here's how it seems to work.
On EC2 ML server seems to be using the instance's "public-hostname'
You can get that inside EC2 via various API's including an HTTP request to a known IP.
e.g. I have a simple script "getmeta"
wget -q -O - $metaurl/$1
Returns the public hostname. These hostnames appear to consistently encode currently assigned IP address.
(and totally ignore the unix hostname).
e.g for an ip of 100.101.102.103 the hostname becomes :
This is reliable across restarts of the AMI as long as you assign the same IP.
So by assigning one of my Elastic IP (which is pretty much a 'static IP') then starting MarkLogic and requesting a Express license I obtained a license bound to this new public hostname.
Stopping the instance, restarting it (gets a new dynamic IP and host) then re-assigning the Elastic IP restores the hostname and Voila ! ML works !
One trick ... it takes a while between the request to associate the IP and when EC2 gets around to completing the request, and there is no synchronous way to tell.
But you can poll the API's until the hostname changes. You must do this before starting ML ...
Well I presume so ... I haven't tried changing the IP while ML runs to see if it picks up the new one but not up for that right now.
Putting a sleep of a minute or two might do it as well but my experience with EC2 is there is occasionally *long* delays which only happen once you go on vacation and am not around to fix things up ...
David A. Lee
Senior Principal Software Engineer
dlee at epocrates.com
From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Michael Blakeley
Sent: Tuesday, November 01, 2011 9:11 PM
To: General MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] How does ML 5.0 determine the "host" for licensing ?
With normal single-host licenses you can set the MarkLogic hostname to 'localhost' via host-admin.xqy - handy for laptops that get their hostname from whichever dhcp server they might wake up near. If the license also says 'localhost', then that would be ideal. I can tell you that the community license still works with 'localhost' and 5.0-1, but that type of license probably doesn't look at the hostname anyway.
Now, I haven't yet tried the express license setup, so I'm not sure what it uses for an enforcement mechanism. If it's something like a DNS reverse lookup, then I don't think it will work on EC2 without some heavy lifting. If DNS reverse lookup is the mechanism, then I also wouldn't expect Elastic IP to do the job: I think its reverse lookup would point to an AWS-managed load balancer. But I suppose you could run your own DNS to make it happy.
On 1 Nov 2011, at 20:05 , Lee, David wrote:
> I'm trying out the Express license on a Amazon EC2 instance.
> Everything thing works as expected *until * I stop and restart the instance. In Amazon EC2 this allocates a new hostname beyond my control.
> When ML starts it complains the license is not valid for this Host (reasonable).
> I tried several things to get this to work.
> 1) Use the linux "hostname" command and /etc/services/network settings to set the hostname to a static hostname
> 2) Edited the hostname within the ML admin console
> Still no go. I can get the instance working again by requesting a new license but I think that's not a great solution.
> If I know how ML decides what the "hostname" is I could probably work this out.
> My next attempt will be to assign a static IP (Amazon "Elastic IP") to
> the instance which depending on how ML decides what the hostname is might work ... But I don't want to risk looking like a hacker by requesting lots of licenses trying to reverse engineer a solution.
> Any suggestions ?
> David A. Lee
> Senior Principal Software Engineer
> Epocrates, Inc.
> dlee at epocrates.com
> General mailing list
> General at developer.marklogic.com
General mailing list
General at developer.marklogic.com
More information about the General