Where can I keep some meta-information about my nodes?

classic Classic list List threaded Threaded
10 messages Options
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
I want to keep in my nodes some kind of configuration data.

Something like this: when node#n starting it must be able to get some specific data from node#1 and compare with data they have. Like extended version check.

The question is: where can I keep this meta-data? how and when I can get it?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

Alexey V. Ryazanov wrote
I want to keep in my nodes some kind of configuration data.

Something like this: when node#n starting it must be able to get some specific data from node#1 and compare with data they have. Like extended version check.

The question is: where can I keep this meta-data? how and when I can get it?
Hi Alexey,

I think the best way is to keep this meta-data in node attributes [1]. You can acquire the attribute value for any node at any moment via ClusterNode.attribute(..) method. In case you want to do some checks on startup, you can utilize lifecycle beans [2].

Let me know if it works for you.

[1] https://apacheignite.readme.io/docs/cluster#cluster-node-attributes
[2] https://apacheignite.readme.io/docs/ignite-life-cycle#lifecyclebean

-Val
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
I write my meta-info to system property in order to set node attribute - it works.
Next nodes can see this attribute .forOldset() node.
Thanks.

But i still have a question about lifecycle. It seams to me, I can't access cluster info BEFORE_NODE_START (error message says "Grid is im invalid state to perform this operation"). But it's necessary for me to prevent node start if meta-info doesn't match some criteria. How can I do that? How can I be sure node doesn't do anything if doesn't "match" other cluster nodes?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

Alexey V. Ryazanov wrote
I write my meta-info to system property in order to set node attribute - it works.
Next nodes can see this attribute .forOldset() node.
Thanks.

But i still have a question about lifecycle. It seams to me, I can't access cluster info BEFORE_NODE_START (error message says "Grid is im invalid state to perform this operation"). But it's necessary for me to prevent node start if meta-info doesn't match some criteria. How can I do that? How can I be sure node doesn't do anything if doesn't "match" other cluster nodes?
Alexey,

You're right, grid is not functional yet on BEFORE_NODE_START event. The functionality you describe can be implemented with a custom plugin. PluginProvider interface has validateNewNode(ClusterNode node) method that can be used for such checks.

But can you describe your use case in more detail? How do you match the nodes and make a decision whether to allow join or not? Is it possible just to not initiate the join process and simply solve this with the proper discovery configuration?

-Val
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
 can be implemented with a custom plugin

Can I see sample plugin implementation?

Is it possible just to not initiate the join process?

Is it possible to get information about cluster nodes without starting node?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

Alexey,

Alexey V. Ryazanov wrote
 can be implemented with a custom plugin
Can I see sample plugin implementation?
Please refer to this thread for an example and hints: http://apache-ignite-users.70518.x6.nabble.com/Ignite-Plugin-development-td336.html. It looks like there is no documentation for plugin development, we will add it.
Alexey V. Ryazanov wrote
Is it possible just to not initiate the join process?
Is it possible to get information about cluster nodes without starting node?
No. I was actually asking about what exact information you are using to make the decision. I'm just guessing that there can be simpler solution (may be not).

-Val
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
Please refer to this thread

Thanks.

what exact information you are using to make the decision?

Each piece of my application (node) has something can be called data model. This model builds runtime when application start based on .class information gathered by reflection. When node started all data gathered, appliction can create a 'model descriptor' and compare it with other nodes 'model descriptors' in order to decide is data models same or not.
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
In reply to this post by vkulichenko
PluginProvider interface has validateNewNode(ClusterNode node) method that can be used for such checks

I created a simple plugin. It looks alive - i see calls to methods like onIgniteStart(), createComponent(),  provideDiscoveryData(). But I don't see any calls to method validateNewNode() even when I starting a lot of new nodes. Where I made a mistake? My plugin provider is nothing but empty implementation of PluginProvider interaface (with logger calls indise - I want to know what's going on)? Is it enough? Or may be I must do something more in order to catch validateNewNode() method call?
vkulichenko vkulichenko
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

Alexey V. Ryazanov wrote
I created a simple plugin. It looks alive - i see calls to methods like onIgniteStart(), createComponent(),  provideDiscoveryData(). But I don't see any calls to method validateNewNode() even when I starting a lot of new nodes. Where I made a mistake? My plugin provider is nothing but empty implementation of PluginProvider interaface (with logger calls indise - I want to know what's going on)? Is it enough? Or may be I must do something more in order to catch validateNewNode() method call?
Alexey,

I just created my own simple example and it works for me.

Note that this method is called only on the discovery coordinator node (the oldest in topology). I think in your case it should be OK since the data model has to be equal on all nodes. So it's enough to check on one node only.

-Val
Alexey V. Ryazanov Alexey V. Ryazanov
Reply | Threaded
Open this post in threaded view
|

Re: Where can I keep some meta-information about my nodes?

This post has NOT been accepted by the mailing list yet.
this method is called only on the discovery coordinator node

This fact dramatically decreases usefulness of this method.
But finaly I did it! Hooray!

My solution:
Plugin (in oldest) node checks for node attribute in validateNewNode() method and if this check fail throws PluginValidationException in order to prevent node start. Node falls down between BEFORE_NODE_START and AFTER_NODE_START and has no time to do anything. And I can set node attribute runtime via System.getProperties().

Thank you for all your help!