|
| 1 | +--- |
| 2 | +title: Cluster Settings |
| 3 | +summary: Learn about cluster settings that apply to all nodes of a CockroachDB cluster. |
| 4 | +toc: false |
| 5 | +--- |
| 6 | + |
| 7 | +This page shows you how to view and change CockroachDB's **cluster-wide settings**. These settings apply to all nodes of a CockroachDB cluster and control, for example, whether or not to share diagnostic details with Cockroach Labs as well as advanced options for debugging and cluster tuning. They are defined via `SET CLUSTER SETTING` SQL statements and can be updated anytime after a cluster has been started, but only by the `root` user. |
| 8 | + |
| 9 | +{{site.data.alerts.callout_info}}In contrast to cluster-wide settings, node-level settings apply to a single node. They are defined by flags passed to the <code>cockroach start</code> command when starting a node and cannot be changed without stopping and restarting the node. For more details, see <a href="start-a-node.html">Start a Node</a>.{{site.data.alerts.end}} |
| 10 | + |
| 11 | +<div id="toc"></div> |
| 12 | + |
| 13 | +<!-- Add this section back in once `system.settings` has been fleshed out. |
| 14 | +
|
| 15 | +## Settings |
| 16 | +
|
| 17 | +types: |
| 18 | +
|
| 19 | +settings-registry.go |
| 20 | +
|
| 21 | +s = string |
| 22 | +b = boolean |
| 23 | +i = int |
| 24 | +f = float |
| 25 | +d = duration |
| 26 | +z = byte-size (can set them with set cluster setting = 32 MiB) |
| 27 | +
|
| 28 | +--> |
| 29 | + |
| 30 | +## View Current Cluster Settings |
| 31 | + |
| 32 | +To view the current settings for a running cluster: |
| 33 | + |
| 34 | +1. Connect [the built-in SQL client](use-the-built-in-sql-client.html) to any node of the cluster. |
| 35 | + |
| 36 | +2. Execute the `SHOW ALL CLUSTER SETTINGS` statement: |
| 37 | + |
| 38 | + ~~~ sql |
| 39 | + > SHOW ALL CLUSTER SETTINGS; |
| 40 | + ~~~ |
| 41 | + |
| 42 | +## Change a Cluster Setting |
| 43 | + |
| 44 | +Before changing a cluster setting, please note the following: |
| 45 | + |
| 46 | +- {{site.data.alerts.callout_danger}}Many cluster settings are intended for tuning CockroachDB internals. Before changing these settings, we strongly encourage you to discuss your goals with CockroachDB; otherwise, you use them at your own risk.{{site.data.alerts.end}} |
| 47 | + |
| 48 | +- Only the `root` user has privileges to change cluster settings with `SET CLUSTER SETTING`. |
| 49 | + |
| 50 | +- Changing a cluster setting is not instantaneous, as the change must be propagated to other nodes in the cluster. |
| 51 | + |
| 52 | +- It's not recommended to change cluster settings while upgrading to a new version of CockroachDB (docs on online cluster upgrades coming soon); wait until all nodes have been upgraded and then make the change. |
| 53 | + |
| 54 | +To change a setting for a running cluster: |
| 55 | + |
| 56 | +1. Connect the [built-in SQL client](use-the-built-in-sql-client.html) to any node of the cluster. |
| 57 | + |
| 58 | +2. Execute the `SET CLUSTER SETTING` statement with the relevant setting name and value: |
| 59 | + |
| 60 | + ~~~ sql |
| 61 | + > SET CLUSTER SETTING <setting name> = <setting value>; |
| 62 | + ~~~ |
| 63 | + |
| 64 | +## See Also |
| 65 | + |
| 66 | +- [Diagnostics Reporting](diagnostics-reporting.html) |
| 67 | +- [Start a Node](start-a-node.html) |
| 68 | +- [Use the Built-in SQL Client](use-the-built-in-sql-client.html) |
0 commit comments