NuoDB is a multi-tenant product. That’s a cloud buzzword, but essentially it means that with a single install of the software you can run any number of distinct databases serving distinct clients. Each database maintains its own physically separate archives and runs with its own set of security credentials. Neat, huh?
To make this model usable and useful we have a management tier that supports a simple (and scriptable) notion of administration. When you install the software a local management agent is started. As you install on multiple hosts those agents build a peer-to-peer network for managing the hosts. We call this collection of connected hosts a Domain. Here’s how it all works.
Pick some host and install NuoDB on it. No databases are running yet, but the management agent is. On the first host it’s running as a Connection Broker, a mode where the agent tracks what’s happening across the Domain. What you’ve just done is provision that host for use. You’ve made it available to run one or more databases, and visible from the management interfaces.
When I say a management agent is running, what I mean is that there’s a Java VM running nuoagent.jar. On Windows this is managed as a Service and can be seen from the control panel. On Linux you use the service command:
sudo service nuoagent [start | stop | restart]
On Mac it’s setup to use launch control:
launchctl [start | stop] com.nuodb.agent
Once you’ve installed NuoDB you have your first host provisioned and your first Broker running. You can verify this using the NuoDB Manager (there’s also a great web console, but that’s another post). On the command-line go into your local installation directory, and run:
java -jar jar/nuodbmanager.jar --broker localhost --password bird
If your local install was successful you’ll see a prompt. You’re now connected into your domain for monitoring and management. This tool will show you that the local host is available, and if you ran the quickstart wizard you’ll see your active database:
nuodb [domain]> show domain summary Hosts: [broker] localhost/127.0.0.1:48004 Database: test [SM] host1.example.com/10.1.1.19:59916 [ pid = 43506 ] RUNNING [TE] host1.example.com/10.1.1.19:59925 [ pid = 43511 ] RUNNING
Great. Now let’s expand the domain by provisioning a second host. Install NuoDB on the new host, shut down the broker on that new host and under the installation directory edit the default.properties file. This is the configuration for your local management agent. Look for this section:
# An existing peer (agent or broker) already running in the domain that this # agent should connect to on startup to extend the running domain. #peer =
Un-comment the peer variable and assign it the address of your first host. For instance:
peer = host1.example.com
Now re-start your second broker as above. What you’ve just done is peer your second host to the first one. Your domain expanded from a single host to two available hosts. You can see this in your interactive management session:
nuodb [domain]> show domain hosts [broker] host1.example.com/10.1.1.19:48004 [broker] host2.example.com/10.1.1.23:48004
With a second host provisioned in your domain, it’s now available to run databases. Want to scale your database to the new host? Try this:
nuodb [domain]> start process te host host2 database test
When you ask to see the processes for the database, now what you’ll see is:
Database: test [SM] host1.example.com/10.1.1.19:59916 [ pid = 43506 ] RUNNING [TE] host1.example.com/10.1.1.19:59925 [ pid = 43511 ] RUNNING [TE] host2.example.com/10.1.1.23:48765 [ pid = 27567 ] RUNNING
In another post I’ll talk more about Broker and Agents, and how to think about configuring a domain. For now, you’ve got all that you need to start setting up a domain with multiple hosts.
So, what is a domain? It’s really a boundary around a collection of hosts that are provisioned to work together. It’s a security and resource-management definition. It lets a systems administrator think about how resources should be applied to databases without having to think about the internals of any given database (i.e., no use of SQL). Look for future posts that will show you how this simple concept expands into some powerful capabilities.