Skip to content

Instantly share code, notes, and snippets.

@stefan-cross
stefan-cross / postgres cheatsheet.md
Created September 25, 2018 11:57 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@stefan-cross
stefan-cross / k8s-java-heap-dump.txt
Last active October 13, 2021 13:32
Java Heap Dump from a K8s Pod
Heap Dump from a K8s Pod
on pod:
jmap -dump:format=b,file=dump.hprof 1
from your machine:
kubectl exec -n application <pod-name> -- cat /dump.hprof > local_dump.hprof
@stefan-cross
stefan-cross / gist:a09ce2ce645d4dfae0b83d35d72bcd9c
Last active November 9, 2021 17:36
Kubectl House Keeping
Remove Nodes in NotReady State
kubectl delete node $(kubectl get nodes | grep NotReady | awk '{print $1;}')
# kubectl cordon <node-name>
# kubectl drain <node-name> --force --ignore-daemonsets --delete-emptydir-data
# kubectl delete node <node-name>