JSON Studio Architecture

JSON Studio is a Java application that runs within Apache Tomcat as a webapp. You can install JSON Studio on any machine that has Java 1.6 or up. It can be installed as a private application on your local machine or as a shared application used by multiples users on a shared machine. Since access to JSON Studio is always via a browser and since the Studio merely needs to be able to access the databases you want to work with, it does not matter where the Studio is installed so long as there is TCP/IP connectivity between your browser and the Studio and between the Studio and the database. Nevertheless, the link between the Studio and the database should be low-latency so that response time is optimial. The same is true if you install the Studio on the cloud, if the database is in the cloud, or both. The following diagram illustrates the various options:

_images/architecture.jpg

JSON Studio listens on port 8443 and you can only connect to it using SSL. If you connect to the non-SSL port (by default 8080) it will redirect to 8443 and continue the session over SSL.

When you login to the Studio you provide the location of the database - a host and a port (you can omit the port if it is listening to the default port of 27017). Therefore, if you will be crossing firewalls, make sure that these ports are open.

You determine which database the Studio connects to when you login to the Studio. It does not matter whether this is a standalone database, a mongos, part of a replica set etc. You connect the same way that you would connect to a database using the mongo shell and according to the privilege requirements described below.

Privileges Requirements

When you login to JSON Studio you are really providing a username/password to connect to MongoDB and the Studio connects to MongoDB on your behalf. Because JSON Studio saves metadata to the database (e.g. for saved queries, graphs, preferences and more) you need to have write privileges in the Studio database to have a successful connection. Note that when you login to the Studio you have two database names - the main database that holds your data and the Studio DB. If you omit the Studio DB then the main database will also be used for the Studio’s metadata, hence the need for write privileges. If you do not want this metadata saved in the main database, remember to include a Studio database - in this case you only need read privileges to the main database.

JSON Studio first attempts to authenticate to the database you provided and if this fails it attempts to authenticate with the admin database. Therefore, you can define the user in the database you want to connect to or in the admin database. If you define the user in the admin database remember that the user definition needs to have privileges to read to the database you want to connect to (e.g. using a readAnyDatabase privilege) and a write privilege to the Studio DB (e.g. using a readWriteAnyDatabase privilege).

For example, if you want the qa1 user to be able to connect to the test database for querying and you want the metadata to be saved into the lmrm database, and you want the qa1 user defined in the admin database, then you need to provide the following privileges:

> db.createUser({user:"qa1", pwd:"qa1", roles: [{role: "read", db: "test"}, {role: "readWrite", db: "lmrm"}]})
Successfully added user: {
   "user" : "qa1",
   "roles" : [
      {
         "role" : "read",
         "db" : "test"
      },
      {
         "role" : "readWrite",
         "db" : "lmrm"
      }
   ]
}

If you want a user qa2 that can connect to any database for querying and write metadata to lmrm, provide the following privileges:

> db.createUser({user:"qa2", pwd:"qa2", roles: ["readAnyDatabase", {role: "readWrite", db: "lmrm"}]})
Successfully added user: {
   "user" : "qa2",
   "roles" : [
      "readAnyDatabase",
      {
         "role" : "readWrite",
         "db" : "lmrm"
      }
   ]
}

Note that the Studio database does not have to be in the same instance as the database you are querying. To use a Studio database on another instance provide a standard mongo connection URL in the Studio DB field:

mongodb://[<username>:<password>@]<host>:<port>/<studio db name>

In this release you cannot connect to a studio database using a connection to all members of a replica set.

Table Of Contents

Previous topic

Introduction to JSON Studio

Next topic

Installing JSON Studio

Copyright © 2013-2016 jSonar, Inc
MongoDB is a registered trademark of MongoDB Inc. Excel is a trademark of Microsoft Inc. JSON Studio is a registered trademark of jSonar Inc. All trademarks and service marks are the property of their respective owners.