Archived

This forum has been archived. Please start a new discussion on GitHub.

Cloning machines in a cluster

Hi,

I would like to clone virtual machines to add additional servers to my IceGrid cluster.

It would be great if there was a homogeneous configuration which could be applied across each of the machines in the cluster. Unfortunately, it seems that the IceGrid.Node. Name property must be configured to be unique for each machine, and this requires manual modification of the configuration file on each of the machines. If there are a large number of machines in the cluster than this can be quite a painful process.

Can anybody recommend a way to get around this problem? Is there a way that the IceGrid.Node.Name property can be programmatically set? If so, this could be programmatically set to a hostname and each of the machines in the cluster would have a unique id.

Thanks.

Comments

  • benoit
    benoit Rennes, France
    Hi,

    Would passing this configuration property through the command line be a solution? You could for example derive the node name from some unique ID (such as the hostname) of the cluster machine and pass it through the command line. For example:
    icegridnode --Ice.Config=/etc/icegridnode.conf --IceGrid.Node.Name=`hostname`
    

    Beware however that if you are using the hostname as the node name, relocating the node on another machine will require to update IceGrid applications to move the servers from the old node to the new node (unless the new machine is configured with the same hostname as the old one).

    Cheers,
    Benoit.
  • Hi Benoit,

    Thanks for your response.

    I did this from the command-line (on Windows) using:
    icegridnode --Ice.Config=node.conf --IceGrid.Node.Name=%COMPUTERNAME%
    

    ... and this works well.

    The next thing I would like to do is to be able to run the Windows service and pass in the hostname to the icegridnode command.

    I tried to do the following:
    iceserviceinstall icegridnode node.cfg --DisplayName=TestService --IceGrid.Node.Name=%COMPUTERNAME%
    

    ... but I got the following error.
    Error: IceGrid.Node.Name must be set in node.cfg
    

    I have removed IceGrid.Node.Name from node.cfg because I want this to be dynamically generated from the hostname.

    Any ideas on how to get around this problem?

    Thanks,
    Laurie
  • I could create a batch script to do a string replacement on the node.cfg before running iceserviceinstall, but this means that I would need to logo in to each of the machines in the cluster and run the service installation script, which would create manual work for the user which I was hoping to avoid by using this approach. It would be nice to clone a machine which already has a service already installed on it. Hmm...
  • benoit
    benoit Rennes, France
    Hi,

    As you discovered, starting the IceGrid node or registry as a Windows service requires all the configuration properties to be defined in the configuration file of the service -- you can't use command line properties.

    The script approach sounds the best solution and the most flexible in the long term if you need to also set some other properties specific for the machine (I'm thinking that you might need to set the -h <IP | hostname> option for the node endpoints for example).

    Can't you run automatically a script as part of the cloning to avoid the user to login to run the installation script?

    Cheers,
    Benoit.
  • benoit
    benoit Rennes, France
    Hi,

    There is actually one other solution. Instead of storing the properties into a property file, you can store them in the Window registry. Ice properties stored in the Windows registry can reference environment variable if the registry values are created using the REG_EXPAND_SZ type. So you could for example add a registry value for IceGrid.Node.Name which is set to %COMPUTERNAME%.

    To use properties from the Windows registry, you'll have to specify the Windows registry key under which the properties are stored when you install the service with iceserviceinstall, for example:
      $ iceserviceinstall icegridnode HKLM\SOFTWARE\MyCompany\IceGridNode
    

    For more information on using the Windows registry to store Ice properties, see here.

    Cheers,
    Benoit.
  • Thanks Benoit! That solution works well.