Skip to content

Instantly share code, notes, and snippets.

@mheler
mheler / radosgw-gc-bucket-indexes.sh
Created September 8, 2022 19:21 — forked from ZiggyMaes/radosgw-gc-bucket-indexes.sh
Ceph RADOS Gateway bucket index garbage collection
#!/bin/bash
#
# Find orphaned bucket index objects in the RGW bucket index pool
# and clean them up if they do not belong to a bucket
#
# Author: Wido den Hollander <[email protected]>
#
INDEX_POOL=$1
@mheler
mheler / radosgw-object-shard-checker.sh
Created September 8, 2022 19:20 — forked from ZiggyMaes/radosgw-object-shard-checker.sh
Detect oversized buckets on Ceph
#!/bin/bash
BUCKETS=($(radosgw-admin bucket list | jq -r .[]))
OVERSIZED_BUCKETS=0
for BUCKET in "${BUCKETS[@]}"
do
OBJECT_SIZE=$(radosgw-admin bucket stats --bucket=${BUCKET} | jq -r '.usage["rgw.main"].num_objects')
SHARDS=$(radosgw-admin bucket stats --bucket=${BUCKET} | jq -r .max_marker | awk -F "," '{print $NF}' | sed 's/[^0-9]*//g')
@mheler
mheler / radosgw-exporter.service
Created September 8, 2022 19:18 — forked from mulbc/radosgw-exporter.service
RGW textfile collector
[Unit]
Description=Ceph RGW Prometheus Exporter
After=docker.service
[Service]
EnvironmentFile=-/etc/environment
ExecStart=/usr/local/bin/python3 /usr/bin/rgw_exporter.py
Restart=always
RestartSec=90s
TimeoutStartSec=300
@mheler
mheler / install-n-start-tmate.sh
Created September 6, 2022 17:47 — forked from cloudnull/install-n-start-tmate.sh
Install the latest static tmate and start a session
TMATE_FILE=$($(command -v python3 || command -v python) <<EOC
import requests
r = requests.get(
'https://api.github.com/repos/tmate-io/tmate/releases/latest'
)
releases = r.json()
amd64_releases = [
i for i in releases['assets']
if 'amd64' in i['name'] and not 'dbg' in i['name']
][0]
@mheler
mheler / multicast-openstack.md
Created June 28, 2022 20:28 — forked from djoreilly/multicast-openstack.md
Multicast on OpenStack

Multicast on OpenStack

The following works with Neutron VLAN provider networks, and requires configuration on the physical switches. Multicast works on br-int because the ML2 OVS driver/agent uses OVS in standalone mode (no external controller). The packets on br-int hit the NORMAL flow action, and so get treated by the ovs-vswitchd code that does IGMP snooping (when enabled). All IGMP packets are sent to the slow path (userspace ovs-vswitchd).

The following will not work on Neutron tunnel backed networks (VxLAN, GRE), as the neutron-openvswitch-agent hardcodes flows on br-tun that treats multicast the same as broadcasts and the NORMAL action is not used.

+----------------------------+      +----------------------------+
|      +----+    +----+      |      |      +----+    +----+      |
|      | VM |    | VM |      |      |      | VM |    | VM |      |
|      +-+--+    +--+-+      |      |      +-+--+    +--+-+      |
@mheler
mheler / daemonset-scaledown.md
Created September 30, 2021 02:49 — forked from ragul28/daemonset-scaledown.md
k8s Trick to Scale down daemonset to zero
  • Scaling k8s daemonset down to zero
kubectl -n kube-system patch daemonset myDaemonset -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'
  • Scaling up k8s daemonset
kubectl -n kube-system patch daemonset myDaemonset --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]'
#Check bucket limits:
$ radosgw-admin bucket limit check | jq '.[].buckets[].fill_status' | uniq
$ radosgw-admin bucket limit check | jq '.[].buckets[].objects_per_shard' | sort -n | uniq
#Default WARN Thresholds:
"osd_deep_scrub_large_omap_object_key_threshold": "2000000",
"osd_deep_scrub_large_omap_object_value_sum_threshold": "1073741824" #1G
#Warnings you get in the cluster log:
@mheler
mheler / README.md
Created March 22, 2021 18:44 — forked from ctrahey/README.md
Cleanup Ceph Disks from cluster.yaml

Cleanup Ceph Disks

This script is designed to work with yq to take arguments directly from a CephCluster CRD (cluster.yaml) and zap all matching disks on the hosts.

Caveats/Assumptions:

Danger: This is (currently) a wildly destructive script.

  1. Requires named hosts with specific config
  2. Assumes devicePathFilter
  3. Assumes devicePathFilter regex treats /dev/disks/by-path as a base
@mheler
mheler / promote.sh
Created November 20, 2020 22:55 — forked from mislav/promote.sh
Publish a git branch and open a tmux split that reports the outcome of CI
#!/bin/bash
# Pushes the current branch to origin and opens a tiny tmux split to track
# the CI status. Upon completion, speaks the status aloud using `say`.
set -e
if [ "$1" != "--wait" ]; then
git push -u origin HEAD
tmux split-window -dv -l 2 "'$0' --wait"
else
ref="$(git rev-parse -q HEAD)"
@mheler
mheler / async_pending_stats.py
Created March 5, 2019 01:19 — forked from clayg/.gitignore
Troll the disks for async_pendings and gather some stats
#!/usr/bin/env python
import sys
import os
import errno
from argparse import ArgumentParser
from collections import defaultdict
import pickle
import logging
import thread
import threading