on master help sign in
project-m36/docs/server_mode.markdown
21 lines 1.7 kB history raw
1# Project:M36 Server Mode
3## Introduction
5While Project:M36 is easy-to-use as an interactive, in-process database management system, it can also be run as a server-based daemon to serve requests from multiple client applications.
7## Starting the Server
9To start the Project:M36 server to serve the local host with a database named "mydbname", run ```cabal run project-m36-server -- --database mydbname --hostname 127.0.0.1``` in the project-m36 source directory. The double-dash indicates that the arguments should be passed to ```project-m36-server``` instead of ```cabal```. Under normal conditions, this command will print nothing and block indefinitely to serve incoming requests on the default port 6543.
11Note that the above invocation will serve an in-memory, transient "mydbname" database. The database is deleted when the server exits. To serve a database with filesystem persistence, invoke ```cabal run project-m36-server -- --database mydbname --hostname 127.0.0.1 --database-directory /path/to/dbdirectory --fsync```.
13## Connecting an Interactive Client
15To start an interactive session with the server, run ```cabal run tutd -- --database mydbname --host 127.0.0.1```. This will open a TutorialD shell to the remote database and should operate exactly like a local session. Note that the import and export functions import and export from/to the client host's filesystem. There is currently no function to import or export from/to the server host's filesystem.
17## Connecting a Haskell Client
19Connecting to a local or remote database uses the same API found in ```ProjectM36.Client```. See [this annotated example](../examples/SimpleClient.hs) for more information.