Nodeclipse / nodeclipse

Nodeclipse-1 : Eclipse plugin for Node.js, PhantomJS development (Nodeclipse core plugin); Maven and Gradle (with Android) plugins
https://nodeclipse.github.io/
158 stars 78 forks source link

mongo shell integration -- replica set use case #111

Open ghost opened 10 years ago

ghost commented 10 years ago

In MongoDB you can create a multi nodes replicaset - typically one primary server + 2 secondary - to get auto server failover and database recovery handling.

To create such a replica set you need to start several instances of _mongod_ listening on different hostname:port.

I don't see how this could be done with this first implementation of a mongo shell in nodeclipse: the shell is starting one single instance of _mongod_ on localhost:27017.

Running several instances on different servers using custom TCP ports is usual pratice for mongo shell from a Terminal window.

I am not asserting this should be a requirement for its integration in the IDE. But as it doesn't run a javascript file yet, couldn't we expect the flexibility we'll get from a genuine mongo shell in a Terminal from its console view?

paulvi commented 10 years ago

Replica set support is something complicated. There should be 3 consoles running, and just passing these value to Eclipse is making it cumbersome. I don't see yet what benefit will be in Eclipse comparing to mongo itself.

But as it doesn't run a javascript file yet, As a user, we can run any .js or .mjs file by right-click Run as -> Mongo

Please rephrase the last paragraph. I don't follow the idea (or just skip it, as this is definitely not the No 1 issue).

ghost commented 10 years ago

@PaulVI

Replica set support is something complicated. There should be 3 consoles running, and just passing these value to Eclipse is making it cumbersome. I don't see yet what benefit will be in Eclipse comparing to mongo itself.

Actually it's not that complicated - you could handle it with one single mongo shell launching your mongod processes with --fork option (not sure you'll have this in windoz but it works fine for unix like osx or linux)

To me the core issue here is not the replica set itself but the launching of the mongod processes: in current implementation we use only one running on localhost using mongodb default port -- 27017 most probably.

This is where the limitation stands and it's not only about replica set. Connecting to the replica set from IDE could be seen as an extreme user case but making it work for a replica set would make it work for everything MongoDB...

If you were interested to solve this core issue I could provide you a simple 3 nodes replica set user case you could start from a terminal then use from IDE. After the replica set was created, you'll connect to primary or secondary nodes and from IDE perspective it's no different than dealing with one single mongod server at a time.

You'll only need to speficy which one you'll be using in IDE.

In my understanding, the current implementation is doing something like:

mongo --shell myfile.js

What it would require is this:

mongo hostname: port --shell myfile.js

Where _hostname_ and _port_ are variables we'll need to supply from IDE.

If we don't then localhost:27017 is used by default.

But being able to select another host or another port or both would bring this new feature to a different dimension, IMHO...

paulvi commented 10 years ago

BTW @nodeleaf Check Preferences, --shell parameter is there.

ghost commented 10 years ago

@PaulVI Are you implying that I might be able to connect to a different host / port modifying this field in preferences?

That would hardly answer the issue as ALL we'll need to do to connect to a given replica set's node is to change the host / port values - but in Preferences?

About this --shell parameter, it demonstrates this mongo shell integration limits: it only sends a script file to default mongod for shell exec.

You can't just open a connection from a terminal (like the excellent Aptana Terminal does) to interact inline with databases' collections on any host or port.

You asked for feedbacks about this new feature in nodeclipse and this is my reply: interesting idea but not completed yet. Does it worse the case to provide more?

This is an open question I can only answer for myself: I will not use it like it is - the mongo shell in a real terminal suits me much better.

What would be required to make me use it: 1- being able to connect to any host and port 2- being able to query a database from a command line (a no --shell mode)

I hope this will help you...