Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sebastian Webber sebastianwebber

🏠
Working from home
View GitHub Profile
View pg_cleanup_oldmorethan_30days.sh
#!/bin/bash
ARCHIVEDIR='/var/lib/pgsql/wal_archive'
LAST_BACKUP=$(ls -lto ${ARCHIVEDIR})
FILE_LIST=$(pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}")
## TEST FIRST
pg_archivecleanup -n "${ARCHIVEDIR}" "${LAST_BACKUP}" | find -type f -mmin +30 | xargs ls -lh
@sebastianwebber
sebastianwebber / readme.md
Created Jun 26, 2020
How to install buildah on ubuntu 20.04
View readme.md

install-buildah-ubuntu-20.04.md

. /etc/os-release
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/xUbuntu_${VERSION_ID}/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-get update -qq
sudo apt-get -qq -y install buildah
``
@sebastianwebber
sebastianwebber / pgsql-ssl.md
Last active Nov 19, 2020
Habilitar SSL no PostgreSQL
View pgsql-ssl.md

Habilitar SSL no PostgreSQL

Execute os procedimentos abaixo para habilitar SSL no seu servidor PostgreSQL.

  1. Crie um diretório para armazenar as configurações (opcional)
mkdir certificados
cd certificados
@sebastianwebber
sebastianwebber / README.md
Last active Nov 6, 2020
Compilation of the Uber Facts on PostgreSQL to MySQL Migration
View README.md

Uber facts

Original posts/information

Migrating Uber from MySQL to PostgreSQL

Key points

  • ~50GB MySQL Application
  • Main motivation: PostGis
  • Migration made with a custom tool(xml2pgcopy) and mysqldump on 45min
@sebastianwebber
sebastianwebber / create-ec2-instance-playbook.yml
Last active Oct 30, 2020
Create a EC2 instance with ansible-playbook
View create-ec2-instance-playbook.yml
---
- hosts: localhost
connection: local
vars:
gather_facts: False
vars:
keypair: "my-keypair-name"
instance_type: m4.large
security_group:
- "vpc-group-1"
@sebastianwebber
sebastianwebber / show-locks.sql
Last active Oct 6, 2020
Show locked tables in postgreSQL
View show-locks.sql
-- tested in PostgreSQL 8.4.4
DROP VIEW IF EXISTS vw_all_table_locks CASCADE;
CREATE VIEW vw_all_table_locks AS
SELECT
pg_namespace.nspname as schemaname,
pg_class.relname as tablename,
pg_locks.mode as lock_type,
age(now(),pg_stat_activity.query_start) AS time_running
FROM pg_class
JOIN pg_locks on pg_locks.relation = pg_class.oid
@sebastianwebber
sebastianwebber / benchmarks.sh
Last active Aug 14, 2020
Run benchmarks on postgres with pgbench
View benchmarks.sh
#!/bin/bash -ex
export PGBIN=/usr/pgsql-9.3/bin
export PGUSER=postgres
export PGDATABASE=bench
export DATADIR=/dados/pgbench
export CLUSTER_LOG=/tmp/benchmark.log
export TOTAL_CPUS=$(grep 'cpu cores' /proc/cpuinfo | uniq | awk '{print $NF}')
@sebastianwebber
sebastianwebber / README.md
Last active Jul 1, 2020
9.3.5 build on centos 7
View README.md

9.3 build on centos 7

Dependencies

yum install -y wget systemtap-sdt-devel gcc make bison flex perl-devel perl-ExtUtils-Embed readline-devel zlib-devel python-devel openssl-devel pam-devel libxml2-devel libxslt-devel openldap-devel tcl-devel

compiling

@sebastianwebber
sebastianwebber / docker-compose.yml
Last active Jun 13, 2020
basic docker-compose for grafana and prometheus
View docker-compose.yml
version: '3.1'
volumes:
prometheus_data: {}
grafana_data: {}
services:
prometheus:
image: prom/prometheus
volumes:
View keybase.md

Keybase proof

I hereby claim:

  • I am sebastianwebber on github.
  • I am sebawebber (https://keybase.io/sebawebber) on keybase.
  • I have a public key ASAVnC1vicYp9QJrHT8KelRyeM740ej76ZUqnzdOXWYJmgo

To claim this, I am signing this object: