Cluster ManagementCluster Management mk Thu, 03/18/2010 - 17:55
Topic How to set up a cluster of three MonetDB servers belonging to the same group.
Building a distributed system using the MonetDB infrastructure requires a number of machines that run monetdbd (see its man-page for details). Assume we have three worker machines, called cruquius, lijnden and
worker% monetdbd create /fullpath/to/mydbfarm
worker% monetdbd set passphrase=mypassphrase /fullpath/to/mydbfarm
worker% monetdbd start /fullpath/to/mydbfarm
This creates the location for the database on each worker and sets the private control passphrase for the MonetDB daemon to "mypassphrase". The final step is to activate the daemon itself. This is basically all you need to initialise a cluster of MonetDB instances.
Assume you have likewise initialized MonetDB on your desktop, named willem, from which you will control the MonetDB instances. On the desktop machine you can use the following command to show which machines guarded with monetdbd can be reached:
willem% monetdb discover
Amongst others it will show you the workers you just initialized. From our machine willem we can further work with the cluster by addition of a database called pump on each node as follows:
willem% monetdb -h cruquius -P mypassphrase create pump
willem% monetdb -h lijnden -P mypassphrase create pump
willem% monetdb -h leeghwater -P mypassphrase create pump
The discover command will not show them yet, as they are still in maintenance mode.
Beware, these three identically named databases are not related to each other in any way, i.e. access control and database content can be different for each individual database pump. They are logical names to be refined using role tags to designate their function. Consider we use two server instances to act as harvey[1,2] and one as fox. How these functionalities behave is beyond the control of the MonetDB daemon. It suffices to setup the shared property tag to designate them all to belong to the same group.
willem% monetdb -h cruquius -P mypassphrase set shared=pump/2/harvey pump
willem% monetdb -h lijnden -P mypassphrase set shared=pump/2/fox pump
willem% monetdb -h leeghwater -P mypassphrase set shared=pump/1/harvey pump
Now that we have set them up, they can be made available for use:
willem% monetdb -h cruquius -P mypassphrase release pump
willem% monetdb -h lijnden -P mypassphrase release pump
willem% monetdb -h leeghwater -P mypassphrase release pump
An mclientconnection can now go to any of the hosts directly, or use a pattern to find the right machine. Given the example above with our tags, for instance the following two mclient calls connect to lijndenand round-robin to cruquius and leeghwater respectively:
willem% mclient -d '*/pump/2'
willem% mclient -d '*/pump/*/harvey'