You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/web-ui/federated-reporting.markdown
+38-14Lines changed: 38 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,14 +169,23 @@ the superhub.
169
169
170
170
## Duplicate host management
171
171
172
-
There are situations where feeder hubs may have hosts with duplicate hostkeys:
172
+
When using federated reporting, the superhub can end up importing the same hostkey from more than one feeder.
173
+
This typically happens when a host is re-bootstrapped to a different feeder, when a VM is re-spawned from an image that preserves the existing key material, or when a host is cloned without regenerating its key pair with `cf-key` and refreshing `$(sys.workdir)/ppkeys/localhost.pub`.
174
+
In all of these cases, multiple feeders hold a record under the same hostkey.
173
175
174
-
- hosts are able to "float", re-bootstrap or failover to several different feeder hubs
175
-
- hosts may be cloned and not have their hostkey refreshed by running `cf-key` and refreshing `$(sys.workdir)/ppkeys/localhost.pub`.
176
+
CFEngine provides two mechanisms for resolving these cross-feeder duplicates.
177
+
They address the same underlying problem with different approaches:
176
178
177
-
In the first case you will likely want to remove entries for hosts which are not the latest since the latest data will be most accurate.
179
+
-[Distributed cleanup][Federated reporting#Distributed cleanup] is a cleanup on the feeders.
180
+
A script on the superhub identifies the feeder with the most recent contact for each hostkey and then calls back into the other feeders to delete the stale records at the source, so they are never re-imported.
178
181
179
-
There are two options available for handling these situations depending on your environment: Distributed Cleanup or Handle Duplicate Hostkeys.
182
+
-[Handle duplicate hostkeys][Federated reporting#Handle duplicate hostkeys] is a filter on the superhub.
183
+
During each import cycle on the superhub, duplicate rows for the same hostkey are compared by `__hosts.lastreporttimestamp`, and all but the most recent are moved out of the per-feeder schemas into a separate `dup` schema for later analysis, so only the most recently reporting host remains visible in Mission Portal.
184
+
185
+
Note that neither mechanism deduplicates hosts that share a hostkey but report to the _same_ feeder — a feeder's database is keyed on hostkey alone.
186
+
Hence, the most recent report simply overwrites the previous one there.
187
+
A health diagnostic alert should be visible in Mission Portal in this case.
188
+
Regardless of whether you are using federedated reporting or not, the recommended fix is to regenerate the conflicting key pairs.
180
189
181
190
### Distributed cleanup
182
191
@@ -221,21 +230,36 @@ This will distribute the needed certificates from feeders to superhub so that th
221
230
When run manually for the first time the utility will create a limited privileges user to view and delete hosts on the feeders.
222
231
You will need to enter the following information at the prompts when running the utility manually:
223
232
224
-
- admin password for the superhub
225
-
- email address for the fr_distributed_cleanup limited privileges user
226
-
- admin password for each feeder
233
+
- admin username and password for the superhub (the username defaults to `admin` if left blank)
234
+
- a 2FA code for the superhub, if 2FA is enabled for the admin account
235
+
- email address for the `fr_distributed_cleanup` limited privileges user
236
+
- admin username and password for each feeder (the username defaults to `admin` if left blank)
237
+
- a 2FA code for each feeder, if 2FA is enabled for the admin account
227
238
228
239
After confirming all feeder certs and public keys are present on the superhub, run the distributed cleanup script manually.
229
240
230
-
```bash
231
-
# ls /opt/cfengine/federation/cftransport/distributed_cleanup/
241
+
```command
242
+
ls /opt/cfengine/federation/cftransport/distributed_cleanup/
0 commit comments