Archived
How to add/start/stop/remove a node by AdminSession?
Hi,
I run ICE in a simple mode: Regitry + Grid node, no IceBox, no Replica.
Few days ago I asked a question about service management in node, now I can add a new service to an existing node by AdminSession. After that I try to register a new node by AdminSession like this, the 'emptyApp' has no service:
`session = registry.createAdminSession("foo", "bar");
AdminPrx admin = session.getAdmin(); //init myApp ApplicationDescriptor myApp = new ApplicationDescriptor(); myApp.name = "emptyApp"; //init myNode NodeDescriptor myNode = new com.zeroc.IceGrid.NodeDescriptor(); com.zeroc.IceGrid.PropertySetDescriptor propertySet = new com.zeroc.IceGrid.PropertySetDescriptor(); propertySet.properties = new ArrayList<>(); propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("Ice.Default.Locator", "EchoIceGrid/Locator:tcp -p 4061")); propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Endpoints", "tcp")); propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Name", "myTestNode")); propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Data", "deploy/lmdb/myTestNode")); propertySet.properties.add(new com.zeroc.IceGrid.PropertyDescriptor("IceGrid.Node.Output", "deploy/lmdb/myTestNode/log")); myNode.propertySets = new HashMap<String, com.zeroc.IceGrid.PropertySetDescriptor>(); myNode.propertySets.put(nodeName, propertySet); //add myNode to myApp myApp.nodes = new HashMap<String, com.zeroc.IceGrid.NodeDescriptor>(); myApp.nodes.put(nodeName, myNode); //add myApp to admin admin.addApplication(myApp);`
It seems to work fine, the IceGridGUI can show this new node, but this node is not running. I notice the admin has a func 'getNodeAdmin()', it looks like it can do something about node, but unfortunately it can't.
So I have another quesiton: how to add (start, stop, remove) a new node by AdminSession?
Thanks.
Comments
-
Hi Joey
nodeName
is the name of the node where you want to deploy the application, but the registry doesn't start the nodes.The property set you add to the node, aren't properties for the node it self but a named property set that can be referenced by id see https://doc.zeroc.com/ice/3.7/ice-services/icegrid/icegrid-xml-reference/properties-descriptor-element
The node will start the assigned servers depending of the configured activation mode https://doc.zeroc.com/ice/3.7/ice-services/icegrid/icegrid-server-activation#id-.IceGridServerActivationv3.7-ServerActivationModes
So I have another quesiton: how to add (start, stop, remove) a new node by AdminSession?
You cannot, you have to configure the nodes yourself to connect to the registry.
0 -
sorry, the nodeName should be replaced with "myTestNode".
0 -
In my situation, I want to add / start new Grid nodes dynamically.
0 -
You can use a tool like "Terraform" or "Ansible" to accomplish that, you can use Terraform to deploy your nodes and then manage the application deployments with the Admin interface.
0