# 🔁 Redis

It is strongly recommended for multi-proxy networks.

***

### What Redis Is Used For

NexusProxy can use Redis to synchronize data between multiple Velocity proxies.

Redis can be used for:

* Global online counts
* Proxy online counts
* Server online counts
* Shared player presence snapshots
* Friends online status
* Staff synchronization
* Synced announcements
* Synced donation broadcasts
* PlaceholderAPI expansion data

{% hint style="info" %}
If your network only uses one Velocity proxy, Redis may not be required unless a specific feature needs shared state.
{% endhint %}

***

### When Should You Use Redis?

Use Redis if your network has:

* Multiple Velocity proxies
* Cross-proxy player tracking
* Global online placeholders
* Friends online status
* Synced staff systems
* Synced manual announcements
* Synced donation broadcasts
* PlaceholderAPI placeholders on backend lobbies

{% hint style="warning" %}
For multi-proxy networks, Redis is highly recommended.

Without Redis, some cross-proxy features may be incomplete or inaccurate.
{% endhint %}

***

### Redis Configuration Location

Redis is configured in:

```
plugins/NexusProxy/nexusproxy.yml
```

Example:

```yaml
storage:
  redis:
    enabled: true
    host: "127.0.0.1"
    port: 6379
    password: ""
    database: 0
    channel_prefix: "nexusproxy"
```

***

### Required Multi-Proxy Rule

Every proxy must use:

* The same Redis host
* The same Redis port
* The same Redis password
* The same Redis database
* The same Redis channel prefix
* A unique `cluster.proxy_id`

Correct example:

```yaml
# Proxy 1
cluster:
  proxy_id: "Proxy-1"

storage:
  redis:
    enabled: true
    host: "127.0.0.1"
    port: 6379
    password: ""
    database: 0
    channel_prefix: "nexusproxy"
```

```yaml
# Proxy 2
cluster:
  proxy_id: "Proxy-2"

storage:
  redis:
    enabled: true
    host: "127.0.0.1"
    port: 6379
    password: ""
    database: 0
    channel_prefix: "nexusproxy"
```

{% hint style="danger" %}
Never use the same `cluster.proxy_id` on multiple proxies.

Duplicated proxy IDs can break presence tracking, online counts, friends status, and synchronization.
{% endhint %}

***

### Modules That Use Redis

| Module                   | Redis Usage                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------- |
| Staff                    | Synchronizes staff chat, admin chat, donor chat, and staff-related data across proxies. |
| Announcer                | Can synchronize manual announcement sends across proxies.                               |
| Donations                | Can replicate donation broadcasts across proxies.                                       |
| Friends                  | Used for online/offline friend status and cross-proxy presence.                         |
| Placeholders             | Used for global, proxy, and server online placeholders.                                 |
| PlaceholderAPI Expansion | Reads online and friends data from shared Redis presence snapshots.                     |

***

### Staff Synchronization

The Staff module can use Redis to synchronize staff communication across multiple proxies.

This is useful for:

* Staff chat across proxies
* Admin chat across proxies
* Donor chat across proxies
* Staff join and quit notices
* Staff presence information

{% hint style="info" %}
If your network has multiple proxies, enable Redis for consistent staff communication.
{% endhint %}

***

### Announcer Synchronization

The Announcer module can use Redis to synchronize manual announcements.

This allows a manual announcement sent from one proxy to be replicated across the network, depending on configuration.

Useful for:

* Network-wide announcements
* Staff broadcasts
* Event messages
* Important alerts

***

### Donations Synchronization

The Donations module can use Redis to replicate donation events across proxies.

This is useful when donation broadcasts should appear to players connected through any proxy.

Useful for:

* Store purchases
* Rank purchases
* Donation celebrations
* GG wave messages
* Network-wide donation announcements

***

### Friends Online Status

The Friends module can use Redis to track whether friends are online across multiple proxies.

Redis helps NexusProxy know:

* If a friend is online
* Which proxy the friend is connected to
* Which backend server the friend is currently on
* Whether friends placeholders should show online data correctly

{% hint style="warning" %}
For cross-proxy friends systems, Redis + database storage is recommended.

Redis handles online presence. The database stores persistent friend data.
{% endhint %}

***

### Placeholder Data

Redis is important for accurate online placeholders in multi-proxy networks.

Redis can support data for:

```
%global_online%
%proxy_online%
%server_<server>_online%
%proxy_<proxy>_online%
```

The PlaceholderAPI expansion can also use Redis for backend placeholders such as:

```
%nexusproxy_global_online%
%nexusproxy_proxy_online%
%nexusproxy_server_<server>_online%
%nexusproxy_proxy_<proxy>_online%
%nexusproxy_friends_online%
```

***

### PlaceholderAPI Expansion

If you use the NexusProxy PlaceholderAPI expansion on backend lobby servers, the expansion must use the same Redis settings as NexusProxy.

Velocity NexusProxy example:

```yaml
storage:
  redis:
    enabled: true
    host: "127.0.0.1"
    port: 6379
    password: ""
    database: 0
    channel_prefix: "nexusproxy"
```

PlaceholderAPI expansion example:

```yaml
redis:
  enabled: true
  host: "127.0.0.1"
  port: 6379
  password: ""
  database: 0
  channel_prefix: "nexusproxy"
```

{% hint style="warning" %}
If the expansion uses different Redis settings, backend placeholders may return `0` or incorrect values.
{% endhint %}

***

### Redis Channel Prefix

The Redis `channel_prefix` separates NexusProxy data from other Redis systems.

Default:

```yaml
channel_prefix: "nexusproxy"
```

All NexusProxy proxies and the PlaceholderAPI expansion should use the same prefix.

{% hint style="info" %}
Use a different channel prefix only if you intentionally want to separate different NexusProxy networks on the same Redis server.
{% endhint %}

***

### Checking Redis Status

After configuring Redis, restart your proxy or reload NexusProxy.

Then run:

```
/nexusproxy storage
```

Aliases:

```
/nproxy storage
/np storage
```

This command helps confirm whether Redis is connected correctly.

***

### Common Use Cases

#### Multi-proxy global online count

Use Redis when you want all proxies to share online count data.

***

#### Cross-proxy friends online status

Use Redis so friends appear online even when they are connected through a different proxy.

***

#### Synced donation broadcasts

Use Redis so donation broadcasts can appear across all proxies.

***

#### Synced manual announcements

Use Redis so staff can send announcements from one proxy and reach the whole network.

***

#### Backend lobby placeholders

Use Redis with the PlaceholderAPI expansion to show network online data in scoreboards, TAB plugins, menus, or holograms.

***

### Common Issues

#### Global online count returns 0

Check that:

* Redis is enabled in `nexusproxy.yml`.
* Every proxy uses the same Redis settings.
* Every proxy uses the same `channel_prefix`.
* Every proxy has a unique `cluster.proxy_id`.
* `/nexusproxy storage` shows Redis as connected.

***

#### Friends online status is incorrect

Check that:

* Redis is enabled.
* The Friends module is enabled.
* Every proxy uses the same Redis settings.
* Every proxy has a unique `cluster.proxy_id`.
* The target friend is actually online.
* The database is configured correctly for persistent friend data.

***

#### PlaceholderAPI expansion returns 0

Check that:

* Redis is enabled in NexusProxy.
* Redis is enabled in the PlaceholderAPI expansion.
* Both use the same host, port, password, database, and channel prefix.
* The expansion is installed on the backend server.
* `/papi reload` was executed or the backend server was restarted.

***

#### Staff chat does not sync across proxies

Check that:

* Redis is enabled.
* Staff module Redis sync is enabled, if configurable.
* Every proxy uses the same Redis settings.
* Every proxy has a unique `cluster.proxy_id`.
* Redis is connected on every proxy.

***

#### Announcements or donations do not sync

Check that:

* Redis is enabled.
* The related module has Redis sync enabled, if configurable.
* All proxies use the same Redis settings.
* All proxies use the same `channel_prefix`.
* Every proxy has a unique `cluster.proxy_id`.

***

### Security Tips

* Do not expose Redis publicly without protection.
* Use a password if Redis is reachable outside localhost.
* Never share your Redis password publicly.
* Remove credentials before posting configs in support channels.
* Use firewall rules when possible.
* Use separate Redis databases or channel prefixes for separate networks.

***

### Setup Tips

* Use Redis for any multi-proxy production network.
* Keep Redis settings identical across all proxies.
* Keep `cluster.proxy_id` unique on every proxy.
* Use the same Redis settings in the PlaceholderAPI expansion.
* Use `/nexusproxy storage` after every Redis configuration change.
* Restart the proxy after major Redis changes.
* Do not mix different Redis channel prefixes unless you know exactly why.

***

### Summary

Redis allows NexusProxy to synchronize data across multiple Velocity proxies.

It is recommended for global online counts, cross-proxy presence, friends online status, staff synchronization, synced announcements, synced donation broadcasts, and PlaceholderAPI expansion data.


---

# 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://nexusproxy.nemesismc.net/integrations/redis.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.
