On Monday, February 6, 2017 at 9:29:07 PM UTC+1, Arun Kumar Raga wrote: > > Hi All, > > 1) How can i share the global variables in node cluster environment, > Currently i am using *NEDB > <https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiT5f7DvfvRAhUCx7wKHfshCGUQFggbMAA&url=https%3A%2F%2Fgithub.com%2Flouischatriot%2Fnedb&usg=AFQjCNEAlvALtsH4mOVzcwNKCi3DSO90yQ&sig2=p3q6TblXpe-OGEP7NF2z6Q>* > for > global data and running in another server and communicating both MAIN > server and NEDB > <https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiT5f7DvfvRAhUCx7wKHfshCGUQFggbMAA&url=https%3A%2F%2Fgithub.com%2Flouischatriot%2Fnedb&usg=AFQjCNEAlvALtsH4mOVzcwNKCi3DSO90yQ&sig2=p3q6TblXpe-OGEP7NF2z6Q> > > Server(global data) using http request(facing this issue > <https://github.com/request/request/issues/2047>). > > Is their any better approach is their to communicate two nodejs server > *or* Any better approach to keep global variable data(last state > persistence). > >
If I read that correctly, you're using node-cluster or similar clsutering technique and want some global state. You already provided an answer, you need an external persistence store. That can be something like what you're using (but with persistence enabled), Redis, an external database, like MongoDB or similar, even filesystem. Just make sure that your chosen solution doesn't allow for stale records (or decide you can tolerate some) and see what's the best option for you. -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/50826d2e-8db2-4a45-9824-3eab6da1a1a9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
