Multiple Agents on Single Host with 5.2.0?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple Agents on Single Host with 5.2.0?

oldgluuser
Hi,

Am finally around to upgrading from 5.0.0 to 5.2.0.   With 5.0.0 I have multiple agents (4) all running on the same host.  How do I setup the meta-model in 5.2.0 to do this?

Part 2: I would like the console to run on a port other than 8080 (as that is so popular, it is probably not going to be available most places this will be installed).  I hand customized 5.0.0 to run on my desired port - is this customizable in 5.2.0?

thanks!

Reply | Threaded
Open this post in threaded view
|

Re: Multiple Agents on Single Host with 5.2.0?

sodul
Unfortunately, while I do use 5.2.0, I have not use the new metamodel or groovy dsl yet.

For the port, this is documented:
http://pongasoft.github.io/glu/docs/latest/html/meta-model.html#consoles
Look for the note that starts with "The console server is a jetty server"

For the json model I recommend looking at the examples:
https://github.com/pongasoft/glu/blob/master/console/org.linkedin.glu.console-server/src/cmdline/resources/glu/repository/systems/
The sample-webapp-system.json.groovy example is pretty good.

Reply | Threaded
Open this post in threaded view
|

Re: Multiple Agents on Single Host with 5.2.0?

frenchyan
Administrator
In reply to this post by oldgluuser
For running multiple agents on the same machine, you simply need to assign them different ports (and give them a name). Note that the agent has 2 ports but only one is required (the other one is +1 the first one), so in general you need to "space" them 2 apart.

Here is an example:

agents << [
  name: 'agent-1',
  host: 'acme.org',
  port: 13906,
  fabric: 'glu-dev-1',
  configTokens: [ : ]
]

agents << [
  name: 'agent-2',
  host: 'acme.org',
  port: 13908,
  fabric: 'glu-dev-1',
  configTokens: [ : ]
]

etc...

In regards to part 2 yes it is configurable. Here is an example (from the test):

consoles << [
  host: 'h1',
  ports: [
    mainPort: 9090,
    externalPort: 19090
  ],
  internalPath: '/ic',
  externalHost: 'h2',
  externalPath: '/ec',
...
]

All the values have defaults so you only need to change them if you don't want new ones. "internal" (host, mainPort, and internalPath) are used by the console itself. "external" (externalPort, externalHost and externalPath) are used if you want to put the console in front of a load balancer or outside a firewall => you can specify a totally different host, port and even path.

If the only thing you want to change is the port (to 10000 for example) then simply do:

consoles << [
  host: 'hhhh',
  port: 10000
...
]

and don't mention the rest. Note that you can always use the "-J" option of the setup script which will show you all values including the defaults one that you do not specify.

Yan
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Agents on Single Host with 5.2.0?

oldgluuser
This post was updated on .
Yan,

Thanks this works great.  From reading the documentation, I thought adding this:

 configTokens: ['mainPort':'12916']

to one of my agent definitions should work.  It showed up properly when I did a -J, but it did not work.  Should it have?

Separately, I think the configTemplates is a hugely powerful extension - yet, I am am not certain exactly what they should be used for!  

thanks,

Joe
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Agents on Single Host with 5.2.0?

frenchyan
Administrator
The port is part of the core of the meta model (https://github.com/pongasoft/glu/blob/master/provisioner/org.linkedin.glu.provisioner-core/src/main/java/org/pongasoft/glu/provisioner/core/metamodel/ServerMetaModel.java), which means those are parameters that the builder cares about to configure and wire all components together (ex: the agent needs to know the host and port of the ZooKeeper cluster)

configTokens are parameters that are only used by the component itself (like size of the VM, etc...) (the agent does not care at all what the size of the ZooKeeper VM is...)

If the documentation mentions mainPort as a configToken then this is a mistake. Please let me know where you saw it and I will fix it. It is either defined this way:

[
  port: 1234
]

or (100% equivalent)

[
  ports: [
    mainPort: 1234
  ]
]

Note that the value is a number, not a string.

I don't understand this question: "Also, now that I have set the "Agent Name" can I have that used as the generated directory name? "

If you use a name for the agent, then the folder and/or zip file generated (when running setup) will have the name of the agent part of it. Isn't it what you want? There is currently no way to configure the name of the artifact generated, but if that becomes a requirement, please submit a feature request. I think that would make sense.

Yes I agree with the fact that configTemplates are very powerful :) The main point of configTemplates is to allow you to customize glu even further without having to build it yourself. Your custom configTemplates leave outside of glu and whenever there is a new release of glu, you simply apply your configTemplates on top of the new release.

Things that you can do with configTemplates
* tweak any file (whether it is a config file or whatever) that comes bundled with glu even if not part of the meta model or config replacement mechanism (ex: css files in the console, replace glu logo, etc...)
* replace jar files entirely with your own (ex: if you want to provide your own set of encrypting keys)
* add files to any component (ex: if you want to bundle more "stuff" served by the console or add your own README)
* etc...

In the end, configTemplate is a built-in way to automate tweaking glu. Without this mechanism (and prior to 5.2.0) what you would do:

tar -zxvf org.linkedin.glu.agent-server-x.x.x.tgz
"tweak" the distribution (ex: cp myread README, edit bin/agentctl.sh, etc...)
tar -zcvf my-custom-agent-x-x-x.tgz org.linkedin.glu.agent-server-x.x.x

With 5.2.0, you automate this by creating the proper configTemplates and you simply run "setup.sh" and pointing to your own configTemplates => you can apply the same changes over and over with each glu release without having to manually tweak the distribution

Hope this makes sense
Yan
Reply | Threaded
Open this post in threaded view
|

Re: Multiple Agents on Single Host with 5.2.0?

oldgluuser
Yan,

Thanks for the explanation - I made a bit more progress, but your explanation helps!

I tried to edit my post to remove the question that didn't make sense to you as I was able to get the directories installed to just what I wanted.  Here is what I did in each of my agent definitions:

    install: [
      path: "${installPath}/my-top-level-directory/agents/this-agent-name",
    ],

it works great anyway!

Next, the documentation at the bottom of this page:

http://pongasoft.github.io/glu/docs/latest/html/meta-model.html#meta-model-configtokens

was confusing (to me at least) with respect to configtokens.  It says:

      ZooKeeper uses 3 different ports (when used in a cluster): the client port (aka mainPort, 
      default to 2181), the leader election port (default to 3888) and the quorum port (default to 2888)
      which are all configurable:

           ports: [
               mainPort: 5555,
               leaderElectionPort: 10000,
               quorumPort: 20000
           ],
     Note
     Check the default templates for zookeeper-server in order to know which configTokens are used
     by the default templates.