Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,29 @@
'instanceid' => '',

/**
* This is a unique identifier for your server.
* It is useful when your Nextcloud instance is using different PHP servers.
* Once it's set it shouldn't be changed.
* This parameter is used to differentiate between different PHP server instances
* that share the same ``config.php``. Its core use is in the "Snowflake" ID generation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that share the same config.php

The important point is they share the same database. For some reasons, it can be different configuration files

* system, which ensures that unique IDs created in distributed environments cannot collide.
*
* Value must be an integer, comprised between 0 and 1023.
* The ``serverid`` is an integer (0–1023) that must be unique for each PHP server.
*
* When config.php is shared between different servers, this value should be overriden with "NC_serverid=<int>" on each server.
* Note that it must be overriden for CLI and for your webserver.
* This parameter is especially important if you deploy Nextcloud across multiple servers
* using a shared ``config.php`` file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* using a shared ``config.php`` file.

For the same reason as above

*
* Example for CLI: NC_serverid=42 occ config:list system
* Once it is set, it should not be changed, to avoid data inconsistencies.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it can be changed, but the important point to never have two identical server IDs in your cluster.

One drawback of changing it: you can't find the server which created an ID from the ID itself (unless you keep history). I don't know if it will help for debugging at some point…

*
* In shared configurations, override ``serverid`` by setting the environment variable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can also be a different config.php file

* ``NC_serverid=<int>`` for each server (applies to both web servers and CLI commands).
*
* Example for CLI::
*
* NC_serverid=42 occ config:list system
*
* For simple, standalone deployments, the default fallback (based on the hostname)
* is generally safe as long as your server's hostname does not change and you do not
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as long as your server's hostname does not change

See above, if hostname change, server ID also change and it's not an issue, except to find server responsible for the ID

* clone or migrate the installation. However, if you plan to clone, migrate,
* or scale your installation at any time, it is recommended to explicitly set ``serverid``
* to a unique, fixed integer between 0 and 1023.
*/
'serverid' => -1,

Expand Down
Loading