Page MenuHomePhabricator

labmon: syncronize whisper files between labmon1001 and labmon1002
Closed, ResolvedPublic

Description

Establish a method for syncing whisper files from labmon1001 to labmon1002.
This could probably be done by simply using rsync.

While at it, fix the probably missing bits not persisted into puppet, like this cronspam:

Subject: Cron <_graphite@labmon1002> find /srv/carbon/whisper/archived_metrics -mtime +366 -type f -delete

find: `/srv/carbon/whisper/archived_metrics': No such file or directory

Event Timeline

• aborrero triaged this task as Medium priority.

Change 421587 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] graphite: labs: create /srv/carbon/whisper/archived_metrics/

https://gerrit.wikimedia.org/r/421587

Change 421587 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] graphite: labs: create /srv/carbon/whisper/archived_metrics/

https://gerrit.wikimedia.org/r/421587

That last patch caused a change in labmon1001 catalog:

aborrero@labmon1001:~$ sudo puppet agent -t -v
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for labmon1001.eqiad.wmnet
Notice: /Stage[main]/Base::Environment/Tidy[/var/tmp/core]: Tidying 0 files
Info: Applying configuration version '1521827079'
Notice: /Stage[main]/Graphite::Labs::Archiver/File[/srv/carbon/whisper/archived_metrics]/group: group changed 'carbon-c-relay' to '_graphite'
Notice: Applied catalog in 17.89 seconds

Not sure yet how relevant this is.

Change 422389 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: rsync whisper files between mon servers

https://gerrit.wikimedia.org/r/422389

@fgiunchedi suggests we better switch to use carbon relays rather than rsync.

The setup could be something like: client machines send metrics to a carbon relay in the master node, this master node relays data to both local carbon cache and slave carbon cache.

However, in case of failover (automatic or manual) when the slave takes over, the dead master will never see the lost data again. We would still need rsync or a mechanism for reading data from both server's whisper files.

@fgiunchedi suggests we better switch to use carbon relays rather than rsync.

The setup could be something like: client machines send metrics to a carbon relay in the master node, this master node relays data to both local carbon cache and slave carbon cache.

However, in case of failover (automatic or manual) when the slave takes over, the dead master will never see the lost data again. We would still need rsync or a mechanism for reading data from both server's whisper files.

Indeed that's one of the tradeoffs of that solution, I'll list more below which have worked for the production graphite use case but of course vary depending on requirements.

  • Pros
    • Small data loss when failover
    • Application layer solution, i.e. dealing with line-oriented carbon protocol itself
    • Not very resource intensive during normal operation
  • Cons

The cons in practice haven't been a problem, the first in the case of metric data is IMHO a "nice to have". The second hasn't been a problem because failover/resync are rare, the failure mode is usually that a node is down completely and thus we're starting with a blank filesystem where to rsync files to. Hope that helps!

I'm sure the relay path is the way to go, but perhaps a bit over complicated for what we are looking for right now. Let's stick to rsync for whisper files and we can follow-up eventually with a proper clusterization of this deployment, including perhaps a shared service URL for clients.

Change 422389 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: rsync whisper files between mon servers

https://gerrit.wikimedia.org/r/422389

Change 423665 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: fix usage of puppet variable inside ferm @resolve

https://gerrit.wikimedia.org/r/423665

Change 423665 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: fix usage of puppet variable inside ferm @resolve

https://gerrit.wikimedia.org/r/423665

Change 423666 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: fix ssh userkey name

https://gerrit.wikimedia.org/r/423666

Change 423666 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: fix ssh userkey name

https://gerrit.wikimedia.org/r/423666

Change 423671 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: fix rsync mechanisms

https://gerrit.wikimedia.org/r/423671

Change 423671 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: fix rsync mechanisms

https://gerrit.wikimedia.org/r/423671

Change 423672 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wcms: monitoring: add more rssh configuration for _graphite user

https://gerrit.wikimedia.org/r/423672

Change 423672 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wcms: monitoring: add more rssh configuration for _graphite user

https://gerrit.wikimedia.org/r/423672

Change 423674 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wcms: monitoring: use double quotes for puppet to understand \n in file content

https://gerrit.wikimedia.org/r/423674

Change 423674 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wcms: monitoring: use double quotes for puppet to understand \n in file content

https://gerrit.wikimedia.org/r/423674

This should be ready to go. I tested manually the rsync, and it works. Let's wait a couple of hours in case cron reports any misbehavior.

I added ssh forced-command to the SSH key per @fgiunchedi suggestion.

Change 423726 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wcms: monitoring: delay cron running time window

https://gerrit.wikimedia.org/r/423726

Change 423726 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: delay cron running time window

https://gerrit.wikimedia.org/r/423726

The rsync has run several times already, but something weird is happening, since it reports complete, but both servers don't have the same data?

aborrero@labmon1001:/srv/carbon/whisper$ ls | md5sum
28875c203ab79f4f3fd3164b614d3537  -

vs

aborrero@labmon1002:/srv/carbon/whisper$ ls | md5sum
28875c203ab79f4f3fd3164b614d3537  -

Disk usage is very different:

aborrero@labmon1001:$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
udev                              10M     0   10M   0% /dev
tmpfs                             13G  1.4G   12G  11% /run
/dev/md0                          92G  5.1G   82G   6% /
tmpfs                             32G     0   32G   0% /dev/shm
tmpfs                            5.0M     0  5.0M   0% /run/lock
tmpfs                             32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/labmon1001--vg-data  2.1T  1.7T  299G  86% /srv

vs

aborrero@labmon1002:~$ df -h
Filesystem                       Size  Used Avail Use% Mounted on
udev                              10M     0   10M   0% /dev
tmpfs                             13G  330M   13G   3% /run
/dev/md0                          92G  3.0G   84G   4% /
tmpfs                             32G     0   32G   0% /dev/shm
tmpfs                            5.0M     0  5.0M   0% /run/lock
tmpfs                             32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/labmon1002--vg-data  2.8T  317G  2.4T  12% /srv

And subdirs are not the same!

aborrero@labmon1001:/srv/carbon/whisper$ ls -R | md5sum
f0e5ea3013313e6dd549165c604118b6  -

vs

aborrero@labmon1002:/srv/carbon/whisper$ ls -R | md5sum
8e0001280439fb3b1a00abf94af40faf  -

It seems like rsync is not being recursive enough?

Change 424270 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: rsync recursive

https://gerrit.wikimedia.org/r/424270

Change 424270 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: rsync recursive

https://gerrit.wikimedia.org/r/424270

Change 424287 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: rsync directories as well

https://gerrit.wikimedia.org/r/424287

Change 424287 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: rsync directories as well

https://gerrit.wikimedia.org/r/424287

The /srv/carbon/whisper/archived_metrics directory is 1452250952 Bin size, 1.4 TB. Perhaps some purging mechanism should exists.

The /srv/carbon/whisper/archived_metrics directory is 1452250952 Bin size, 1.4 TB. Perhaps some purging mechanism should exists.

It seems we had a similar problem in the past: T168344 There is a cronjob to delete one year old metrics. Perhaps too much time?

Change 424597 had a related patch set uploaded (by Arturo Borrero Gonzalez; owner: Arturo Borrero Gonzalez):
[operations/puppet@production] wmcs: monitoring: purge archived metrics every 90 days

https://gerrit.wikimedia.org/r/424597

Change 424597 merged by Arturo Borrero Gonzalez:
[operations/puppet@production] wmcs: monitoring: purge archived metrics every 90 days

https://gerrit.wikimedia.org/r/424597