Skip to content

Instantly share code, notes, and snippets.

package main
import (
"context"
"log/slog"
"os"
"sync"
"github.com/shirou/gopsutil/v4/cpu"
"github.com/shirou/gopsutil/v4/disk"
package main
import (
"reflect"
"testing"
"unicode"
)
// FieldsN splits the string s around each instance of one or more consecutive
// white space haracters, as defined by unicode.IsSpace, returning a slice of
package main
import (
"flag"
"fmt"
"log"
"math"
"time"
"github.com/shirou/gopsutil/cpu"
package main
import (
"context"
"flag"
"fmt"
"log"
"math"
"time"
package main
import (
"flag"
"fmt"
"log"
"math"
"time"
"github.com/shirou/gopsutil/cpu"
@PierreF
PierreF / README
Created January 14, 2020 15:31
Ambassador TCPMapping max_connection 1024
Related to https://github.com/datawire/ambassador/issues/2193
Run with:
minikube start
kubectl apply -f https://www.getambassador.io/early-access/yaml/aes-crds.yaml && \
kubectl wait --for condition=established --timeout=90s crd -lproduct=aes && \
kubectl apply -f https://www.getambassador.io/early-access/yaml/aes.yaml && \
kubectl -n ambassador wait --for condition=available --timeout=90s deploy -lproduct=aes
Action:
* 14:43:55: kubectl delete stolon-keeper-0 (master)
* 14:43:57: psql started
* 14:45:04: psql terminated
IPs:
* stolon-keeper-1: 172.17.0.13
* stolon-keeper-0: (172.17.0.10 - assuming based on proxy log)
## This is 6 seconds before the "close connection" log
pierref@xps-pierref:~/go/src/github.com/sorintlab/stolon/examples/kubernetes/statefulset$ date;kubectl exec -ti stolon-proxy-xs30c -- netstat -tanp;kubectl exec -ti psql-client -- netstat -tanp
mardi 10 octobre 2017, 16:35:54 (UTC+0200)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 172.17.0.13:53182 10.0.0.27:2379 ESTABLISHED -
tcp 0 1 172.17.0.13:36698 172.17.0.11:5432 SYN_SENT -
tcp 0 0 172.17.0.13:36530 172.17.0.11:5432 TIME_WAIT -
tcp 0 0 172.17.0.13:36604 172.17.0.11:5432 TIME_WAIT -
tcp 0 0 172.17.0.13:36634 172.17.0.11:5432 TIME_WAIT -
minikube start
# Start etcd cluster using etcd-operator
git clone https://github.com/coreos/etcd-operator && cd etcd-operator
kubectl create -f example/deployment.yaml
# wait for etcd-operator to start
kubectl create -f example/example-etcd-cluster.yaml
git clone https://github.com/sorintlab/stolon
cd stolon/examples/kubernetes/statefulset/
--- proxy
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 1 172.17.0.12:50778 172.17.0.10:5432 SYN_SENT -
[...]
tcp6 8 0 172.17.0.12:5432 172.17.0.13:35626 ESTABLISHED -
--- client
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name