Skip to content

Instantly share code, notes, and snippets.

Wido den Hollander wido

View GitHub Profile
View gist:9f136130352b2685c9709bc2d282fc6d
#!/bin/bash
#
# Fetch the amount of shards a Ceph RADOS Gateway bucket has
#
# Author: Wido den Hollander <wido@denhollander.io>
#
BUCKET=$1
ID=$(radosgw-admin bucket stats --bucket=${BUCKET}|jq -r '.id')
@wido
wido / IPv6.java
Created Jan 16, 2019
Check if IPv6 Address is EUI-64 in Java
View IPv6.java
import com.googlecode.ipv6.IPv6Address;
/*
Replace the IPv6 address with anything you like, Link Local or Global, based on the 'ff:fe' in the address
this code will tell you if the address is EUI-64
Author: Wido den Hollander <wido@widodh.nl>
*/
public class IPv6 {
@wido
wido / haproxy.cfg
Created Jan 14, 2019
Ceph Mgr Dash HAProxy configuration
View haproxy.cfg
global
log 127.0.0.1 local1
log 127.0.0.1 local2 notice
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
@wido
wido / radosgw-gc-bucket-indexes.sh
Created Nov 15, 2018
Ceph RADOS Gateway bucket index garbage collection
View radosgw-gc-bucket-indexes.sh
#!/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 <wido@42on.com>
#
INDEX_POOL=$1
@wido
wido / cloudstack-multicast.sh
Created Nov 14, 2018
Calculate CloudStack VXLAN VNI Multicast Group
View cloudstack-multicast.sh
#!/bin/bash
#
# Calculate the IPv4 Multicast Group that Apache CloudStack will use
# for a VNI
#
# Also see modifyvxlan.sh in CloudStack repository
#
# Author: Wido den Hollander <wido@widodh.nl>
#
@wido
wido / ceph-osd-ssd-set-backfills.sh
Created Nov 14, 2018
Ceph tell all SSD OSDs to change max backfills
View ceph-osd-ssd-set-backfills.sh
#!/bin/sh
ceph osd tree|grep osd|grep ssd|awk '{print $1}'|sort -n|xargs -I{} -n 1 ceph tell osd.{} config set osd_max_backfills 3
@wido
wido / remove-old-bucket-indexes.sh
Created Nov 13, 2018
Remove old RADOS Gateway Bucket Indexes from Ceph
View remove-old-bucket-indexes.sh
#!/bin/bash
for bucket in $(radosgw-admin bucket list | jq -r .[]); do
bucket_id=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.bucket_id)
marker=$(radosgw-admin metadata get bucket:${bucket} | jq -r .data.bucket.marker)
for instance in $(radosgw-admin metadata list bucket.instance | jq -r .[] | grep "^${bucket}:" | grep -v ${bucket_id} | grep -v ${marker}| cut -f2 -d':'); do
echo "${bucket}: ${instance}"
radosgw-admin bi purge --bucket=${bucket} --bucket-id=${instance}
radosgw-admin metadata rm bucket.instance:${bucket}:${instance}
done
@wido
wido / iptables-proxy.sh
Created Nov 6, 2018
iptables TCP and UDP proxy
View iptables-proxy.sh
#!/bin/bash
#
# Author: Wido den Hollander <wido@widodh.nl>
#
# Proxy all TCP and UDP IPv4 traffic from 192.168.100.230 to 10.0.100.50
#
# This can be used as a (temporary) proxy when you want to renumber a machine and want
# to make sure it's still available on it's old address
#
@wido
wido / ceph-build.sh
Last active Jan 22, 2019
Build Ceph DEB packages
View ceph-build.sh
#!/bin/bash
#
# Build DEB packages for Ubuntu 16.04 tested with Ceph Mimic
#
apt install -y dpkg-dev debhelper
apt install -y bc btrfs-tools cmake cpio cryptsetup cython cython3 default-jdk dh-exec dh-python dh-systemd gdisk git gperf javahelper jq junit4 libaio-dev libbabeltrace-ctf-dev libbabeltrace-dev libblkid-dev libcurl4-openssl-dev libexpat1-dev libfuse-dev libgoogle-perftools-dev libibverbs-dev libkeyutils-dev libldap2-dev libleveldb-dev liblttng-ust-dev libnss3-dev libsnappy-dev libssl-dev libtool libudev-dev libxml2-dev lsb-release parted pkg-config python python-all-dev python-coverage python-cherrypy3 python-nose python-pecan python-prettytable python-setuptools python-six python-sphinx python-werkzeug python3-all-dev python3-setuptools socat uuid-runtime valgrind python-virtualenv xfslibs-dev xfsprogs xmlstarlet yasm zlib1g-dev libcunit1-dev liblz4-dev liboath-dev python-bcrypt python-tox
cd /src/ceph
dpkg-buildpackage -j8 -us -us -b
@wido
wido / qemu-ga.json
Created Oct 15, 2018
Qemu Guest Agent SSH pubkey download
View qemu-ga.json
{ "execute": "guest-exec", "arguments": { "path": "/usr/bin/wget", "arg": ["-O", "/root/.ssh/authorized_keys", "http://zooi.widodh.nl/ssh/pubkey"]}}
You can’t perform that action at this time.