Home Help Center

Manual server activation with IceGrid

tctimmehtctimmeh Member Tim CourtOrganization: Enbridge PipelinesProject: Historical Data Retriever
How can I get my deployed servers that have been started at the cmd line to be marked as "active" in the IceGrid registry?

More detail:
I've got IceGrid and a node configured with my application deployed so that I can start/stop it from IceGridAdmin and that works. I'd also like to be able to start the servers manually (i.e. at the command line) using the config file that is pushed to the node by IceGrid.

This appears to mostly work but not quite as expected. The trouble I'm experiencing is that the ServerID isn't marked as 'Active' when the server starts, even though it's object adapter is. When I start the server the master registry's trace log shows
Locator: registered server `longnor.med.read' process proxy: `EF2547F9-AB07-41F5-AF6B-8B0928E29E64 -t:tcp -h 10.68.192.8 -p 39490' ]

and the node's trace shows
Adapter: server `longnor.med.read' adapter `longnor.med.read' activated: dummy -t:tcp -h 10.68.192.8 -p 39490 ]

The server's object adapter is marked as active, but the server is not. I notice that when I start the server from IceGridAdmin the node also shows
Activator: activating server `longnor.med.read'
  path = ...
  pwd = ...
  uid/gid = 3536/21
  args = ... ]
Server: changed server `longnor.med.read' state to `Active' ]

How can I get the node and/or registry to recognize that the server process is active without using the Ice deployment functions to start it?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Tim,

    The IceGrid node can't figure out the state of manually started server. It could probably somehow figure out the PID of the manually started server but detecting when the server is gone would be more difficult and not very reliable since it would have to poll a regular time intervals the system to figure out if the process is gone or not. Why not use the icegridadmin start/stop command to start and stop servers managed by IceGrid?

    Cheers,
    Benoit.
  • tctimmehtctimmeh Member Tim CourtOrganization: Enbridge PipelinesProject: Historical Data Retriever
    Our server is going to be running as part of a much larger software environment. The Ice server needs to start with this environment (in a way that we can carefully control). I was hoping that it could just start up and add itself to the registry/node automatically so that we can still take advantage of replica groups and monitoring.

    Can you suggest some alternatives to accomplish this goal? Perhaps I could build a script that instructs IceGrid to start the server and use that as part of our environment startup?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    You can either use a script to call icegridadmin or call icegridadmin directly. To start on the command line the server from the demo/IceGrid/simple demo with icegridadmin you can execute the following for example:
    $ icegridadmin --Ice.Default.Locator="DemoIceGrid/Locator:tcp -h localhost -p 4061" --IceGridAdmin.Username=foo --IceGridAdmin.Password=bar -e "server start SimpleServer"
    

    You could also use a configuration file to store the properties.

    Let us know if you need more information.

    Benoit.
  • andreynechandreynech Member Andrey NechypurenkoOrganization: Veterobot.comProject: Robotics vehicle for researchers and makers ✭✭
    benoit wrote: »
    Hi Tim,

    The IceGrid node can't figure out the state of manually started server. It could probably somehow figure out the PID of the manually started server but detecting when the server is gone would be more difficult and not very reliable since it would have to poll a regular time intervals the system to figure out if the process is gone or not. Why not use the icegridadmin start/stop command to start and stop servers managed by IceGrid?

    Cheers,
    Benoit.

    Could not this case be considered as the motivation for more sophisticated server discovery infrastructure mentioned here?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Andrey,

    Hmm, locating the server isn't really the issue here, IceGrid knows where to locate the manually started server since it sends its object adapter endpoints to IceGrid. The issue is that the IceGrid node has no reliable ways to figure out the server process state when it's started manually.

    Cheers,
    Benoit.
  • andreynechandreynech Member Andrey NechypurenkoOrganization: Veterobot.comProject: Robotics vehicle for researchers and makers ✭✭
    Hi Benoit,
    IceGrid knows where to locate the manually started server since it sends its object adapter endpoints to IceGrid
    Yes, you are right. But I was mainly thinking about the way to find IceGrid itself without explicitly specifying it's location. Sorry for not being precise enough.
    detecting when the server is gone would be more difficult and not very reliable
    This is where things like for example ZeroConf might also help.

    Thank you,
    Andrey.
  • JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
    benoit wrote: »
    Hi Tim,

    Why not use the icegridadmin start/stop command to start and stop servers managed by IceGrid?

    Cheers,
    Benoit.

    So now I know why it's hard to integrate with other container(such spring or OSGi).
    I want to use java API to perform "start/stop servers", but I can't find any API for such operation, I also want to dynamic add a node to ice grid using API, but I can't find anything.
  • JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
    using java API, what I need is following:

    (1) add/update/remove servant object to adapter.
    (2) add/update/remove adapter to gridnode or gridregistry, and active it.
    (3) add/update/remove node to gridnode or gridregistry, and auto active it.
    (4) everything is POJO.
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    There's definitely Java APIs to do this. Servants are registered/unregistered with the object adapter using the object adapter interface. To register adapters, servers with IceGrid, you have several solutions:
    • Dynamically
    • Using XML configuration files and the icegridadmin tool.
    • Using the Java IceGridGUI
    • Programatically using the IceGrid::Admin interfaces (defined in slice/IceGrid/Admin.ice). These interfaces can be used from a Java application. You can start/stop servers using the admin interface.

    I recommend to checkout the Ice manual (specifically, see here for Object Adapters documentation and here for documentation on how to obtain a proxy on the IceGrid::Admin interface). You can also check out the source code of the IceGrid Java GUI for an example on how to use the IceGrid::Admin interface in Java.

    Cheers,
    Benoit.
  • JiangyubaoJiangyubao Member Yubao JiangOrganization: www.gliet.edu.cnProject: integrate OSGi & Ice to provice service for PHP ✭✭
    benoit wrote: »
    Hi,

    There's definitely Java APIs to do this. Servants are registered/unregistered with the object adapter using the object adapter interface. To register adapters, servers with IceGrid, you have several solutions:
    • Dynamically
    • Using XML configuration files and the icegridadmin tool.
    • Using the Java IceGridGUI
    • Programatically using the IceGrid::Admin interfaces (defined in slice/IceGrid/Admin.ice). These interfaces can be used from a Java application. You can start/stop servers using the admin interface.

    I recommend to checkout the Ice manual (specifically, see here for Object Adapters documentation and here for documentation on how to obtain a proxy on the IceGrid::Admin interface). You can also check out the source code of the IceGrid Java GUI for an example on how to use the IceGrid::Admin interface in Java.

    Cheers,
    Benoit.

    I think ICE is overdesign. What we need is simple:
    (1) cross-language communication interface.
    (2) grid computing.


    for cross-language communication, I define the grammar(described by ANTLR grammar) shown as following:
    grammar ice;
    namespaceDecl	:	
    		'module' ID '{' namespaceDecl* | interfaceDecl* | structDecl* '}' ';'
    		;
    interfaceDecl	:	
    		'interface' '{' methodDecl+ '}' ';'
    		;
    methodDecl	: type ID '(' fieldDecl* ')' ';' 
    		;
    structDecl	:
    		'struct' '{' fieldDecl ';' (fieldDecl ';')* '}' ';'
    		;
    fieldDecl	: type ID
    		;
    type	:
    		structType | sequenceType | dictionaryType | 'string' | 'int' | 'long' | 'date' /*and so on*/
    		;
    		;
    sequenceType	:
    		'sequence' '<' type '>'
    		;
    dictionaryType	:
    		'dictionary' '<'type  ',' type '>'
    		; 
    structType	:
    		ID
    		;
    
    ID	:	('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')*
    
    

    And I think this grammay is enough, do we need key word 'class' and 'extend'? I don't think is nesseary.
Sign In or Register to comment.