Hello, dear habrachiteli.
Today, I would like to share with you my experience in working with the
GlobalsDB NoSQL database, as well as to bring to your attention the recently developed administration tool for it -
GlobalsDB Admin . Further you will find, basically, different technical details, and if you are interested in this topic, welcome.
')
I have developed a software product that allows using a graphical interface to manipulate data inside GlobalsDB, as well as in the Caché DBMS. About GlobalsDB several useful and educational articles have already been written, which you can read in the section
"read also" . By itself, GlobalsDB is fairly simple in its structure, and has a small but sufficient set of functions for implementing server applications of almost any complexity. Its distinctive features are simplicity, free distribution and the use of a sustainable, tried and tested data storage mechanism in the so-called globals.
GlobalsDB Admin
The Globals database does not have any tools for managing it in the installation package, but only a package of examples and several utilities, for example, for
recovering a WIJ file . But it seems like nothing more is needed - install, create an application and work with the database yourself. But in the early stages of familiarizing with GlobalsDB, it may not be entirely clear what is inside and how it is located. In addition, there is often a problem to address the issue of data visualization in the database. For effective development of the principles of working with GlobalsDB, as well as for convenient data manipulation via a graphical interface, this product was developed.
The database in GlobalsDB consists of a set of globals, each of which is a sparse array. A sparse array is easy to imagine as a tree. Thus, the interface of the program represents the visualization of the global tree, on which various manipulations can be performed. This approach is explained by the desire to make the control interface universal for both touch devices and computers with their own mice and keyboards. On the other hand, I wanted to replace the usual typical interface for all such tools with something more visual, without a loss in the comfort of handling it.
About opportunities
GlobalsDB Admin has the minimum necessary set of tools for data manipulation: deleting, adding and changing globals. The focus was on visualization: you can visually see any branch of the repository, no matter how huge it is and how many nodes it would contain. And globals, which are a multidimensional associative array of data, are served in the form of a tree, with which it is quite convenient to perform various operations. Each node of the tree contains information that is stored at a certain level of the global. The location of this information, or the dimension in which it is located, is indicated on the connections between the nodes.
By itself, the administration tool is a server program and a client located in a browser or on a mobile device. The principle of operation is as follows: on the server side, a program written on NodeJS is launched, which on the one hand interacts with GlobalsDB, and on the other hand it waits for clients to connect to a specific port. Also, if the corresponding option has been enabled in the configuration, a simple http-server will be launched, which gives statics - the application client. After the client connects to the server and after the authorization and login processes, you can get to work by manipulating all of this, both the keyboard and the mouse pointer or gestures on the touch screen.
Installation, configuration and management
A detailed installation process can be found on
the project page , and here it will be described a little easier.
Installation process- Install NodeJS if it has not been previously installed;
- Unpack the latest version of GlobalsDB Admin;
- We change in the
config.js
file the absolute path to the mgr
directory of your database and other settings that interest you; - Make sure the
node_modules/globalsDB/cache.node
is suitable for your system / database. If the archive with GlobalsDB Admin was unpacked not in Windows OS, you will need to find the cache***.node
module in the directory with the installed database, rename it to cache.node and specify the path to it in the config.js
file (or move the module to the node_modules/globalsDB
). It is also possible to download the * .node module from the official site ; - Make sure that GlobalsDB (or the Caché instance, whose database path was registered in
config.js
) is running, and NodeJS can execute commands (at least node --version
should give something reasonable); - We execute the
node run
in the project directory, and if error messages do not appear, then by default the web client will be available on the familiar 127.0.0.1
.
If you need to run the server application in the background, install
forever by running
npm install -g forever
and then running the application:
forever start run.js
As for management, it is optimized for both desktop PCs and touch devices. After successful authorization, you can use the following basic combinations:
Keyboard
Node selection: up / down arrows, action selection (transition, editing, copying, deleting) - left / right arrows, Enter key - performing actions on a node, Backspace key - return, - / + keys - decreasing or increasing the scale.
Pointer and touch screen
Selecting an action on a node: clicking on the connection between the nodes, clicking on the node itself - performing the selected action, scrolling up / down or two-finger gesture - changing the scale. Scrolling a node with a large number of child nodes is done by pressing and moving the pointer.
Also, all the details on how to install and handle this tool you can see in
this screencast .
GlobalsDB tips and tricks
Working with a database, like with any other product, often there are some difficulties or new horizons are opening up. I will try to describe, in my opinion, the most curious thing that I had to face.
When you first install the database, it looks like a black box. Skimming through the NodeJS interface documentation, you could stumble upon the first required
global_directory
function to find out if there was anything in the default database. Having connected and received the result, it will appear that there is empty, which was quite expected. But in fact it is not so. At the root are a number of system globals, and they are hidden. For example, it will turn out to get global named "
%
", or "
%IS
". To display this global in GlobalsDB Admin, just click on + (add) at the root node and enter its name, for example, "
%IS
" without setting the value. By clicking "add", you can view the contents of this global:
Understandably, various service information is hidden there, and it is better to refrain from changing it. But you can also successfully add your globals, calling them with the prefix "
%
". They also do not return as a result of the
global_directory
function.
Another interesting point is that GlobalsDB itself doesn’t care what username, password and namespace will be passed to the
db.open
function. On the one hand, in GlobalsDB there is no such thing as a user, but on the other, the documentation for the
open
function says to write this way. This is because the application can be very easily reconfigured to work with, for example, the Caché database itself — just specify the appropriate path to the mgr folder, and you're done - now the work is going on in the specified namespace as the user who is logged on. Thus, GlobalsDB Admin can interact not only directly with the Globals database, but also with other InterSystems products.
Conclusion
The project has its own
homepage where you can get acquainted with it in detail, download it and even
try it
out . As for the article, I think it will appeal not only to those who know it, but also to those who are just starting to work with Globals.
Read also
Meet GlobalsDB
A bit about GlobalsDB Node.JS API
A good description of the benefits of GlobalsDB + NodeJS