Glu agent zookeeper configuration refresh

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Glu agent zookeeper configuration refresh

lukestephenon
Hello,

My glu scripts reference zookeeper configuration. Eg
baseInstallDir = shell.env["install.dir"]

I've updated the value of "install.dir" in zookeeper (org/glu/agents/fabrics/<env>/config/config.properties), but the agents do not see the change until I restart them.  Is there a rest api on the agent which I can invoke to force them to update their configuration from zookeeper?

Any recommendations for handling the need to update fabric common configuration supplied to the glu scripts?

Thanks

Luke
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Glu agent zookeeper configuration refresh

frenchyan
Administrator
The agent does offer a REST api to change the config: a PUT at /config. And here is the code that gets executed when this happens: 


It is being used right now only on an agent that has not been started with a fabric or ZooKeeper and the UI will provide it (using this api) (so the agent is started "enough" to listen to this but not really booted yet).

But as you can see from the TODO in the code, although it can be used to change the properties of an agent and they will be properly saved, if the agent is up and running then it won't be rebooted automatically.

In other words, without changing the code, you cannot invoke the REST api without rebooting the agent.

I think what you could to provide fabric common configuration is to store them in ZooKeeper (in a different path which contains the name of the fabric in the path) and use the "agentZooKeeper" (http://pongasoft.github.io/glu/docs/latest/html/glu-script.html#capabilities) property to access ZooKeeper:

ex:

/org/acme/<fabric>/config.properties

and in the glu script

agentZooKeeper.getStringData("/org/acme/${shell.env['org.glu.agent.fabric']}/config.properties")

Yan

Loading...