[SERVER-1381] shell should be smart with shard clusters and replica sets Created: 08/Jul/10  Updated: 03/Feb/17  Resolved: 03/Feb/17

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Minor - P4
Reporter: Dwight Merriman Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

(1) the mongo shell prompt should tell one more about contect when connected. for example if connected to a mongod and it is a member of a replica set, the prompt should tell you the server's state. something like

primary>

or

secondary>

or

arbiter>

If connecting from the shell to an entire set, it will be important that the user know which node to which it is currently active. So this could be something like

myset:sf1:primary>

where myset is the set name, sf1 host name to which we are connected, and primary the state of sf1 currently.

likewise with sharding similar things. if connected to a mongos, we should somehow indicate that. maybe

s>

if connected to a mongo in a particular shard, indicate that

shard3:sf1>

if connected to a config server, indicate that

cfg:sf1>

not for 1.6 but useful later.

also we can make this configurable – we can have a prompt() js function that returns a string, with the above being a default.



 Comments   
Comment by Chris McNabb [ 13/May/11 ]

Additionally, you should be able to add a configurable environment identifier ie. PROD/DEV/QA/STAGING. Bash style color prompts would be helpful as well to avoid modifying a database on the wrong server.

Comment by Eliot Horowitz (Inactive) [ 08/Sep/10 ]

From skot:

Have the default shell prompt show the server and db names.

So when you are connected it would look like this:

localhost/test>

If the port is non-standard it should included (server:port).

Optionally you could also include other notations for master (m), slave (s), replicaset (rs), mongos (p – for proxy), ...

We could even go as far as this "localhost(p)-server1(m-rs)/test>" to indicate that you are connected through a mongos (proxy) to a replicaset on the current master node (server1) on database test

Generated at Thu Feb 08 02:56:52 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.