# MARS サーバー

## 概要

MARS (Mesh network Announcement Relay Storage) サーバーは Diarkis が持つ特有のサーバーで Diarkis クラスタに必ず1つ必要なサーバです。

MARS サーバーはスケールや冗長化を必要とせずに、単一障害点にならないという特徴を持っており、短時間のダウンが発生しても Diarkis クラスタ全体には影響を及ぼさない様になっております。問題発生時も再起動することで Diarkis クラスタの健全性は担保されます。

## MARS サーバのセットアップ

```go
package main

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

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

## MARS サーバの設定

設定は JSON で記述します。

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

<table><thead><tr><th width="230">キー</th><th width="119">デフォルト</th><th></th></tr></thead><tbody><tr><td>address</td><td>"127.0.0.1"</td><td>バインドする UDP サーバーのアドレス</td></tr><tr><td>port</td><td>"6779"</td><td>MARS サーバーがバインドするためのポート。UDP サーバーは、指定されたポートから始まる利用可能なポートを自動的に探します。</td></tr><tr><td>fullSyncRoles</td><td>["HTTP"]</td><td>すべてのメッシュ・データを同期するサーバ・ロールの配列</td></tr><tr><td>enableMetricsLogging</td><td>false</td><td>この値を <code>true</code> に設定すると、MARS サーバーは 1 秒ごとにメトリクスの JSON データを標準出力に書き出します。</td></tr></tbody></table>

### バージョンの異なる Diarkis を起動した場合

MARS サーバーは Diarkis サーバーのバージョンをもとにデータを分離して管理します。これによりバージョンが異なるアプリケーション同士でユーザーが混ざることを防ぎます。


---

# 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/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.
