1{{#if (not (has-feature "DR Replication"))}} 2 {{upgrade-page title="Replication"}} 3{{else if (or cluster.allReplicationDisabled cluster.replicationAttrs.replicationDisabled)}} 4 <PageHeader as |p|> 5 <p.levelLeft> 6 <h1 class="title is-3"> 7 {{#if initialReplicationMode}} 8 {{#if (eq initialReplicationMode 'dr')}} 9 Enable Disaster Recovery Replication 10 {{else if (eq initialReplicationMode 'performance')}} 11 Enable Performance Replication 12 {{/if}} 13 {{else}} 14 Enable Replication 15 {{/if}} 16 </h1> 17 </p.levelLeft> 18 </PageHeader> 19 20 <form 21 onsubmit={{ 22 action 23 "onSubmit" 24 "enable" 25 (or mode 'primary') 26 (hash 27 token=token 28 primary_cluster_addr=primary_cluster_addr 29 primary_api_addr=primary_api_addr 30 ca_file=ca_file 31 ca_path=ca_path 32 replicationMode=replicationMode 33 ) 34 }} 35 > 36 <div class="box is-sideless is-fullwidth is-marginless"> 37 {{message-error errors=errors}} 38 {{#if initialReplicationMode}} 39 {{#if (eq initialReplicationMode 'dr')}} 40 <h3 class="title is-flex-center is-5 is-marginless"> 41 <Icon 42 @size="xl" 43 aria-hidden="true" 44 @glyph="replication" 45 /> 46 Disaster Recovery (DR) Replication 47 </h3> 48 <p class="help has-text-grey-dark"> 49 DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). 50 </p> 51 {{else if (eq initialReplicationMode 'performance')}} 52 <h3 class="title is-flex-center is-5 is-marginless"> 53 <Icon 54 @size="xl" 55 aria-hidden="true" 56 @glyph="perf-replication" 57 /> 58 Performance Replication 59 </h3> 60 {{#if (not (has-feature "Performance Replication"))}} 61 <p class="help has-text-grey-dark"> 62 Performance Replication is a feature of Vault Enterprise Premium 63 </p> 64 {{else}} 65 <p class="help has-text-grey-dark"> 66 Performance replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. 67 </p> 68 {{/if}} 69 {{/if}} 70 {{else}} 71 <p class="has-text-grey-dark box is-shadowless is-fullwidth has-slim-padding"> 72 <label for="replication-mode" class="is-label is-block"> 73 Type of replication 74 </label> 75 In both Performance and Disaster Recovery (DR) Replication, secondaries share the underlying configuration, policies, and supporting secrets as their primary cluster. 76 </p> 77 <div class="columns"> 78 <div class="column is-flex"> 79 <label for="dr" class="box-label is-column {{if (eq replicationMode 'dr') 'is-selected'}}"> 80 <div> 81 <h3 class="box-label-header title is-6"> 82 <Icon 83 @size="xl" 84 aria-hidden="true" 85 @glyph="replication" 86 /> 87 Disaster Recovery (DR) 88 </h3> 89 <p class="help has-text-grey-dark"> 90 DR is designed to protect against catastrophic failure of entire clusters. Secondaries do not forward service requests (until they are elected and become a new primary). 91 </p> 92 </div> 93 <div> 94 {{radio-button 95 value="dr" 96 groupValue=replicationMode 97 name="replication-mode" 98 radioId="dr" 99 }} 100 <label for="dr" data-test-replication-type-select="dr"></label> 101 </div> 102 </label> 103 </div> 104 <div class="column is-flex"> 105 <label for="performance" class="box-label is-column {{if (eq replicationMode 'performance') 'is-selected'}}"> 106 <div> 107 <h3 class="box-label-header title is-6"> 108 <Icon 109 @size="xl" 110 aria-hidden="true" 111 @glyph="perf-replication" 112 /> 113 Performance 114 </h3> 115 {{#if (not (has-feature "Performance Replication"))}} 116 <p class="help has-text-grey-dark"> 117 Performance Replication is a feature of Vault Enterprise Premium 118 </p> 119 {{else}} 120 <p class="help has-text-grey-dark"> 121 Performance Replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled. 122 </p> 123 {{/if}} 124 </div> 125 <div> 126 {{#if (has-feature "Performance Replication")}} 127 {{radio-button 128 value="performance" 129 groupValue=replicationMode 130 name="replication-mode" 131 classNames="box columns is-centered" 132 radioId="performance" 133 }} 134 <label for="performance" data-test-replication-type-select="performance"></label> 135 {{/if}} 136 </div> 137 </label> 138 </div> 139 </div> 140 {{/if}} 141 </div> 142 <div class="box is-sideless is-fullwidth is-marginless"> 143 <label for="replication-mode" class="is-label"> 144 Cluster mode 145 </label> 146 <div class="field is-expanded"> 147 <div class="control select is-fullwidth"> 148 <select onchange={{action (mut mode) value="target.value"}} id="replication-mode" name="replication-mode" data-test-replication-cluster-mode-select=true> 149 {{#each (array 'primary' 'secondary') as |modeOption|}} 150 <option 151 selected={{if mode (eq mode modeOption) (eq modeOption 'primary')}} 152 value={{modeOption}} 153 > 154 {{modeOption}} 155 </option> 156 {{/each}} 157 </select> 158 </div> 159 {{#if (eq mode 'secondary')}} 160 <AlertInline 161 @class="has-top" 162 @type="warning" 163 @message="This will immediately clear all data in this cluster!" 164 /> 165 {{/if}} 166 </div> 167 {{#if (eq mode 'primary')}} 168 {{#if cluster.canEnablePrimary}} 169 <div class="field"> 170 <label for="primary_cluster_addr" class="is-label"> 171 Primary cluster address <em class="is-optional">(optional)</em> 172 </label> 173 <div class="control"> 174 {{input class="input" id="primary_cluster_addr" name="primary_cluster_addr" value=primary_cluster_addr}} 175 </div> 176 <p class="help has-text-grey"> 177 Overrides the cluster address that the primary gives to secondary nodes. 178 </p> 179 </div> 180 {{else}} 181 <p> 182 The token you are using is not authorized to enable primary replication. 183 </p> 184 {{/if}} 185 {{else}} 186 {{#if cluster.canEnableSecondary}} 187 {{#if (and 188 (eq replicationMode 'dr') 189 (not cluster.performance.replicationDisabled) 190 (has-feature "Performance Replication") 191 ) 192 }} 193 <div class="has-text-danger"> 194 {{toggle-button 195 toggleTarget=this 196 toggleAttr='showExplanation' 197 openLabel="Disable Performance Replication in order to enable this cluster as a DR secondary." 198 closedLabel="Disable Performance Replication in order to enable this cluster as a DR secondary." 199 class="has-text-danger" 200 }} 201 {{#if showExplanation}} 202 <p> 203 When running as a DR Secondary Vault is read only. 204 For this reason, we don't allow other Replication modes to operate at the same time. This cluster is also 205 currently operating as a Performance {{capitalize cluster.performance.modeForUrl}}. 206 </p> 207 {{/if}} 208 </div> 209 {{else}} 210 <div class="field"> 211 <label for="secondary-token" class="is-label"> 212 Secondary activation token 213 </label> 214 <div class="control"> 215 {{textarea value=token id="secondary-token" name="secondary-token" class="textarea"}} 216 </div> 217 </div> 218 <div class="field"> 219 <label for="primary_api_addr" class="is-label"> 220 Primary API address {{#unless (and token (not tokenIncludesAPIAddr))}}<em class="is-optional">(optional)</em>{{/unless}} 221 </label> 222 <div class="control"> 223 {{input value=primary_api_addr id="primary_api_addr" name="primary_api_addr" class="input"}} 224 </div> 225 <p class="help {{if (and token (not tokenIncludesAPIAddr)) 'is-danger' 'has-text-grey'}}"> 226 {{#if (and token (not tokenIncludesAPIAddr))}} 227 The supplied token does not contain an embedded address for the primary cluster. Please enter the primary cluster's API address (normal Vault address). 228 {{else}} 229 Set this to the API address (normal Vault address) to override the 230 value embedded in the token. 231 {{/if}} 232 </p> 233 </div> 234 <div class="field"> 235 <label for="ca_file" class="is-label"> 236 CA file <em class="is-optional">(optional)</em> 237 </label> 238 <div class="control"> 239 {{input value=ca_file id="ca_file" name="ca_file" class="input"}} 240 </div> 241 <p class="help has-text-grey"> 242 Specifies the path to a CA root file (PEM format) that the secondary can use when unwrapping the token from the primary. 243 </p> 244 </div> 245 <div class="field"> 246 <label for="ca_path" class="is-label"> 247 CA path <em class="is-optional">(optional)</em> 248 </label> 249 <div class="control"> 250 {{input value=ca_path id="ca_path" name="ca_file" class="input"}} 251 </div> 252 <p class="help has-text-grey"> 253 Specifies the path to a CA root directory containing PEM-format files that the secondary can use when unwrapping the token from the primary. 254 </p> 255 </div> 256 <p> 257 Note: If both <code>CA file</code> and <code>CA path</code> are not given, they default to system CA roots. 258 </p> 259 {{/if}} 260 {{else}} 261 <p>The token you are using is not authorized to enable secondary replication.</p> 262 {{/if}} 263 {{/if}} 264 </div> 265 {{#if (or (and (eq mode 'primary') cluster.canEnablePrimary) (and (eq mode 'secondary') cluster.canEnableSecondary))}} 266 <div class="field is-grouped box is-fullwidth is-bottomless"> 267 <div class="control"> 268 <button type="submit" class="button is-primary" disabled={{disallowEnable}} data-test-replication-enable=true> 269 Enable Replication 270 </button> 271 </div> 272 </div> 273 {{/if}} 274 </form> 275{{else if showModeSummary}} 276 <PageHeader as |p|> 277 <p.levelLeft> 278 <h1 class="title is-3"> 279 Replication 280 </h1> 281 </p.levelLeft> 282 </PageHeader> 283 <div class="box is-sideless is-fullwidth is-marginless"> 284 <h3 class="title is-flex-center is-5 is-marginless"> 285 <Icon 286 @size="xl" 287 aria-hidden="true" 288 @glyph="replication" 289 /> 290 Disaster Recovery (DR) 291 </h3> 292 {{#if cluster.dr.replicationEnabled}} 293 {{#link-to 294 "mode.index" 295 "dr" 296 class="link-plain" 297 }} 298 {{replication-mode-summary 299 mode="dr" 300 cluster=cluster 301 tagName="span" 302 }} 303 {{/link-to}} 304 {{else}} 305 {{replication-mode-summary 306 mode="dr" 307 cluster=cluster 308 tagName="div" 309 }} 310 {{/if}} 311 </div> 312 <div class="box is-bottomless is-fullwidth is-marginless"> 313 <h3 class="title is-flex-center is-5 is-marginless"> 314 <Icon 315 @size="xl" 316 aria-hidden="true" 317 @glyph="perf-replication" 318 /> 319 Performance 320 </h3> 321 {{#if cluster.dr.replicationEnabled}} 322 {{#link-to 323 "mode.index" 324 "performance" 325 class="link-plain" 326 }} 327 {{replication-mode-summary 328 mode="performance" 329 cluster=cluster 330 tagName="span" 331 }} 332 {{/link-to}} 333 {{else}} 334 {{replication-mode-summary 335 mode="performance" 336 cluster=cluster 337 tagName="div" 338 }} 339 {{/if}} 340 </div> 341{{else}} 342 {{#if (eq replicationAttrs.mode 'initializing')}} 343 The cluster is initializing replication. This may take some time. 344 {{else}} 345 {{info-table-row label="Mode" value=replicationAttrs.mode}} 346 {{info-table-row label="Replication set" value=replicationAttrs.clusterId}} 347 {{info-table-row label="Secondary ID" value=replicationAttrs.secondaryId}} 348 {{info-table-row label="State" value=replicationAttrs.state}} 349 {{info-table-row label="Primary cluster address" value=replicationAttrs.primaryClusterAddr}} 350 {{info-table-row label="Replication state" value=replicationAttrs.replicationState}} 351 {{info-table-row label="Last WAL entry" value=replicationAttrs.lastWAL}} 352 {{info-table-row label="Last Remote WAL entry" value=replicationAttrs.lastRemoteWAL}} 353 {{info-table-row label="Merkle root index" value=replicationAttrs.merkleRoot}} 354 {{#if replicationAttrs.syncProgress}} 355 {{info-table-row label="Sync progress" value=(concat replicationAttrs.syncProgress.progress '/' replicationAttrs.syncProgress.total)}} 356 {{/if}} 357 {{/if}} 358{{/if}} 359