# MARS Server

## Overview

The MARS (Mesh network Announcement Relay Storage) server is a unique server possessed by Diarkis and is an essential component for any Diarkis cluster.

The MARS server is characterized by its ability to function without the need for scaling or redundancy, and it does not become a single point of failure. Even if a short downtime occurs, it does not impact the overall Diarkis cluster. In the event of an issue, the integrity of the Diarkis cluster can be maintained by simply restarting the server.

## Setting Up the MARS Server

```go
package main

import (
	"github.com/Diarkis/diarkis"
	"github.com/Diarkis/diarkis/mars"
)

func main() {
	mars.Setup()
	diarkis.Start()
}
```

## Configuring the MARS Server

Configuration is specified in JSON format.

```json
{
  "address": "127.0.0.1",
  "port": "6779",
  "fullSyncRoles": ["HTTP"],
  "enableMetricsLogging": false
}
```

<table><thead><tr><th width="230">Key</th><th width="119">Default</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>"127.0.0.1"</td><td>The address to which the UDP server binds</td></tr><tr><td>port</td><td>"6779"</td><td>The port for binding the MARS server. The UDP server will automatically search for an available port starting from the specified port.</td></tr><tr><td>fullSyncRoles</td><td>["HTTP"]</td><td>An array of server roles that synchronize all mesh data</td></tr><tr><td>enableMetricsLogging</td><td>false</td><td>If set to <code>true</code>, the MARS server will output JSON data for metrics to standard output every second.</td></tr></tbody></table>

### When Launching Different Versions of Diarkis

The MARS server segregates and manages data based on the Diarkis server version. This prevents user data from being mixed across applications with different versions.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.diarkis.io/en/diarkis-server/mars.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
