|
| 1 | +--- |
| 2 | +title: Use a multi-server setup |
| 3 | +seotitle: Use a multi-server InfluxDB 3 Enterprise setup |
| 4 | +menu: |
| 5 | + influxdb3_enterprise: |
| 6 | + - name: Multi-server |
| 7 | + - parent: Get started |
| 8 | +weight: 4 |
| 9 | +influxdb3/enterprise/tags: [cluster, multi-node, multi-server] |
| 10 | +--- |
| 11 | + |
| 12 | +### Multi-server setup |
| 13 | + |
| 14 | +{{% product-name %}} is built to support multi-node setups for high availability, read replicas, and flexible implementations depending on use case. |
| 15 | + |
| 16 | +### High availability |
| 17 | + |
| 18 | +Enterprise is architecturally flexible, giving you options on how to configure multiple servers that work together for high availability (HA) and high performance. |
| 19 | +Built on top of the diskless engine and leveraging the Object store, an HA setup ensures that if a node fails, you can still continue reading from, and writing to, a secondary node. |
| 20 | + |
| 21 | +A two-node setup is the minimum for basic high availability, with both nodes having read-write permissions. |
| 22 | + |
| 23 | +{{< img-hd src="/img/influxdb/influxdb-3-enterprise-high-availability.png" alt="Basic high availability setup" />}} |
| 24 | + |
| 25 | +In a basic HA setup: |
| 26 | + |
| 27 | +- Two nodes both write data to the same Object store and both handle queries |
| 28 | +- Node 1 and Node 2 are _read replicas_ that read from each other’s Object store directories |
| 29 | +- One of the nodes is designated as the Compactor node |
| 30 | + |
| 31 | +> [!Note] |
| 32 | +> Only one node can be designated as the Compactor. |
| 33 | +> Compacted data is meant for a single writer, and many readers. |
| 34 | +
|
| 35 | +The following examples show how to configure and start two nodes |
| 36 | +for a basic HA setup. |
| 37 | + |
| 38 | +- _Node 1_ is for compaction (passes `compact` in `--mode`) |
| 39 | +- _Node 2_ is for ingest and query |
| 40 | + |
| 41 | +```bash |
| 42 | +## NODE 1 |
| 43 | + |
| 44 | +# Example variables |
| 45 | +# node-id: 'host01' |
| 46 | +# cluster-id: 'cluster01' |
| 47 | +# bucket: 'influxdb-3-enterprise-storage' |
| 48 | + |
| 49 | +influxdb3 serve \ |
| 50 | + --node-id host01 \ |
| 51 | + --cluster-id cluster01 \ |
| 52 | + --mode ingest,query,compact \ |
| 53 | + --object-store s3 \ |
| 54 | + --bucket influxdb-3-enterprise-storage \ |
| 55 | + --http-bind {{< influxdb/host >}} \ |
| 56 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 57 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 58 | +``` |
| 59 | + |
| 60 | +```bash |
| 61 | +## NODE 2 |
| 62 | + |
| 63 | +# Example variables |
| 64 | +# node-id: 'host02' |
| 65 | +# cluster-id: 'cluster01' |
| 66 | +# bucket: 'influxdb-3-enterprise-storage' |
| 67 | + |
| 68 | +influxdb3 serve \ |
| 69 | + --node-id host02 \ |
| 70 | + --cluster-id cluster01 \ |
| 71 | + --mode ingest,query \ |
| 72 | + --object-store s3 \ |
| 73 | + --bucket influxdb-3-enterprise-storage \ |
| 74 | + --http-bind localhost:8282 \ |
| 75 | + --aws-access-key-id AWS_ACCESS_KEY_ID \ |
| 76 | + --aws-secret-access-key AWS_SECRET_ACCESS_KEY |
| 77 | +``` |
| 78 | + |
| 79 | +After the nodes have started, querying either node returns data for both nodes, and _NODE 1_ runs compaction. |
| 80 | +To add nodes to this setup, start more read replicas with the same cluster ID. |
| 81 | + |
| 82 | +### High availability with a dedicated Compactor |
| 83 | + |
| 84 | +Data compaction in InfluxDB 3 is one of the more computationally expensive operations. |
| 85 | +To ensure that your read-write nodes don't slow down due to compaction work, set up a compactor-only node for consistent and high performance across all nodes. |
| 86 | + |
| 87 | +{{< img-hd src="/img/influxdb/influxdb-3-enterprise-dedicated-compactor.png" alt="Dedicated Compactor setup" />}} |
| 88 | + |
| 89 | +The following examples show how to set up high availability with a dedicated Compactor node: |
| 90 | + |
| 91 | +1. Start two read-write nodes as read replicas, similar to the previous example. |
| 92 | + |
| 93 | + ```bash |
| 94 | + ## NODE 1 — Writer/Reader Node #1 |
| 95 | + |
| 96 | + # Example variables |
| 97 | + # node-id: 'host01' |
| 98 | + # cluster-id: 'cluster01' |
| 99 | + # bucket: 'influxdb-3-enterprise-storage' |
| 100 | + |
| 101 | + influxdb3 serve \ |
| 102 | + --node-id host01 \ |
| 103 | + --cluster-id cluster01 \ |
| 104 | + --mode ingest,query \ |
| 105 | + --object-store s3 \ |
| 106 | + --bucket influxdb-3-enterprise-storage \ |
| 107 | + --http-bind {{< influxdb/host >}} \ |
| 108 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 109 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 110 | + ``` |
| 111 | + |
| 112 | + ```bash |
| 113 | + ## NODE 2 — Writer/Reader Node #2 |
| 114 | + |
| 115 | + # Example variables |
| 116 | + # node-id: 'host02' |
| 117 | + # cluster-id: 'cluster01' |
| 118 | + # bucket: 'influxdb-3-enterprise-storage' |
| 119 | + |
| 120 | + influxdb3 serve \ |
| 121 | + --node-id host02 \ |
| 122 | + --cluster-id cluster01 \ |
| 123 | + --mode ingest,query \ |
| 124 | + --object-store s3 \ |
| 125 | + --bucket influxdb-3-enterprise-storage \ |
| 126 | + --http-bind localhost:8282 \ |
| 127 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 128 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 129 | + ``` |
| 130 | + |
| 131 | +2. Start the dedicated compactor node with the `--mode=compact` option to ensure the node **only** runs compaction. |
| 132 | + |
| 133 | + ```bash |
| 134 | + ## NODE 3 — Compactor Node |
| 135 | + |
| 136 | + # Example variables |
| 137 | + # node-id: 'host03' |
| 138 | + # cluster-id: 'cluster01' |
| 139 | + # bucket: 'influxdb-3-enterprise-storage' |
| 140 | + |
| 141 | + influxdb3 serve \ |
| 142 | + --node-id host03 \ |
| 143 | + --cluster-id cluster01 \ |
| 144 | + --mode compact \ |
| 145 | + --object-store s3 \ |
| 146 | + --bucket influxdb-3-enterprise-storage \ |
| 147 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 148 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 149 | + ``` |
| 150 | + |
| 151 | +### High availability with read replicas and a dedicated Compactor |
| 152 | + |
| 153 | +For a robust and effective setup for managing time-series data, you can run ingest nodes alongside read-only nodes and a dedicated Compactor node. |
| 154 | + |
| 155 | +{{< img-hd src="/img/influxdb/influxdb-3-enterprise-workload-isolation.png" alt="Workload Isolation Setup" />}} |
| 156 | + |
| 157 | +1. Start ingest nodes by assigning them the **`ingest`** mode. |
| 158 | + To achieve the benefits of workload isolation, you'll send _only write requests_ to these ingest nodes. Later, you'll configure the _read-only_ nodes. |
| 159 | + |
| 160 | + ```bash |
| 161 | + ## NODE 1 — Writer Node #1 |
| 162 | + |
| 163 | + # Example variables |
| 164 | + # node-id: 'host01' |
| 165 | + # cluster-id: 'cluster01' |
| 166 | + # bucket: 'influxdb-3-enterprise-storage' |
| 167 | + |
| 168 | + influxdb3 serve \ |
| 169 | + --node-id host01 \ |
| 170 | + --cluster-id cluster01 \ |
| 171 | + --mode ingest \ |
| 172 | + --object-store s3 \ |
| 173 | + --bucket influxdb-3-enterprise-storage \ |
| 174 | + --http-bind {{< influxdb/host >}} \ |
| 175 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 176 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 177 | + ``` |
| 178 | + |
| 179 | +<!-- The following examples use different ports for different nodes. Don't use the influxdb/host shortcode below. --> |
| 180 | + |
| 181 | + ```bash |
| 182 | + ## NODE 2 — Writer Node #2 |
| 183 | + |
| 184 | + # Example variables |
| 185 | + # node-id: 'host02' |
| 186 | + # cluster-id: 'cluster01' |
| 187 | + # bucket: 'influxdb-3-enterprise-storage' |
| 188 | + |
| 189 | + influxdb3 serve \ |
| 190 | + --node-id host02 \ |
| 191 | + --cluster-id cluster01 \ |
| 192 | + --mode ingest \ |
| 193 | + --object-store s3 \ |
| 194 | + --bucket influxdb-3-enterprise-storage \ |
| 195 | + --http-bind localhost:8282 \ |
| 196 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 197 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 198 | + ``` |
| 199 | + |
| 200 | +2. Start the dedicated Compactor node with ` compact`. |
| 201 | + |
| 202 | + ```bash |
| 203 | + ## NODE 3 — Compactor Node |
| 204 | + |
| 205 | + # Example variables |
| 206 | + # node-id: 'host03' |
| 207 | + # cluster-id: 'cluster01' |
| 208 | + # bucket: 'influxdb-3-enterprise-storage' |
| 209 | + |
| 210 | + influxdb3 serve \ |
| 211 | + --node-id host03 \ |
| 212 | + --cluster-id cluster01 \ |
| 213 | + --mode compact \ |
| 214 | + --object-store s3 \ |
| 215 | + --bucket influxdb-3-enterprise-storage \ |
| 216 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 217 | + <AWS_SECRET_ACCESS_KEY> |
| 218 | + ``` |
| 219 | + |
| 220 | +3. Finally, start the query nodes as _read-only_ with `--mode query`. |
| 221 | + |
| 222 | + ```bash |
| 223 | + ## NODE 4 — Read Node #1 |
| 224 | + |
| 225 | + # Example variables |
| 226 | + # node-id: 'host04' |
| 227 | + # cluster-id: 'cluster01' |
| 228 | + # bucket: 'influxdb-3-enterprise-storage' |
| 229 | + |
| 230 | + influxdb3 serve \ |
| 231 | + --node-id host04 \ |
| 232 | + --cluster-id cluster01 \ |
| 233 | + --mode query \ |
| 234 | + --object-store s3 \ |
| 235 | + --bucket influxdb-3-enterprise-storage \ |
| 236 | + --http-bind localhost:8383 \ |
| 237 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 238 | + --aws-secret-access-key <AWS_SECRET_ACCESS_KEY> |
| 239 | + ``` |
| 240 | + |
| 241 | + ```bash |
| 242 | + ## NODE 5 — Read Node #2 |
| 243 | + |
| 244 | + # Example variables |
| 245 | + # node-id: 'host05' |
| 246 | + # cluster-id: 'cluster01' |
| 247 | + # bucket: 'influxdb-3-enterprise-storage' |
| 248 | + |
| 249 | + influxdb3 serve \ |
| 250 | + --node-id host05 \ |
| 251 | + --cluster-id cluster01 \ |
| 252 | + --mode query \ |
| 253 | + --object-store s3 \ |
| 254 | + --bucket influxdb-3-enterprise-storage \ |
| 255 | + --http-bind localhost:8484 \ |
| 256 | + --aws-access-key-id <AWS_ACCESS_KEY_ID> \ |
| 257 | + <AWS_SECRET_ACCESS_KEY> |
| 258 | + ``` |
| 259 | + |
| 260 | +Congratulations, you have a robust setup for workload isolation using {{% product-name %}}. |
| 261 | + |
| 262 | +### Writing and querying for multi-node setups |
| 263 | + |
| 264 | +You can use the default port `8181` for any write or query, without changing any of the commands. |
| 265 | + |
| 266 | +> [!Note] |
| 267 | +> #### Specify hosts for writes and queries |
| 268 | +> |
| 269 | +> To benefit from this multi-node, isolated architecture, specify hosts: |
| 270 | +> |
| 271 | +> - In write requests, specify a host that you have designated as _write-only_. |
| 272 | +> - In query requests, specify a host that you have designated as _read-only_. |
| 273 | +> |
| 274 | +> When running multiple local instances for testing or separate nodes in production, specifying the host ensures writes and queries are routed to the correct instance. |
| 275 | +
|
| 276 | +{{% code-placeholders "(http://localhost:8585)|AUTH_TOKEN|DATABASE_NAME|QUERY" %}} |
| 277 | +```bash |
| 278 | +# Example querying a specific host |
| 279 | +# HTTP-bound Port: 8585 |
| 280 | +influxdb3 query \ |
| 281 | + --host http://localhost:8585 |
| 282 | + --token AUTH_TOKEN \ |
| 283 | + --database DATABASE_NAME "QUERY" |
| 284 | +``` |
| 285 | +{{% /code-placeholders %}} |
| 286 | + |
| 287 | +Replace the following placeholders with your values: |
| 288 | + |
| 289 | +- {{% code-placeholder-key %}}`http://localhost:8585`{{% /code-placeholder-key %}}: the host and port of the node to query |
| 290 | +- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}: your {{% token-link "database" %}}{{% show-in "enterprise" %}} with permission to query the specified database{{% /show-in %}} |
| 291 | +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: the name of the database to query |
| 292 | +- {{% code-placeholder-key %}}`QUERY`{{% /code-placeholder-key %}}: the SQL or InfluxQL query to run against the database |
0 commit comments