Ops notes
2019-03-17Riak🔗
attach to running riak node
riak attach
list processes by memory usage
riak-admin top -sort msg_q
programatically build a pid
c:pid(0,227,0)
get info about a process
erlang:process_info(c:pid(0,227,0)).
Haproxy🔗
use the runtime api to get some info
/usr/bin/socat -T 15 -t 5 /run/haproxy/admin.sock - <<< "show activity"
some of the stuff:
- show errors : report last request and response errors for each proxy
- clear counters : clear max statistics counters (add 'all' for all counters)
- show info : report information about the running process
- show stat : report counters for each proxy and server
- show schema json : report schema used for stats
how to get the socket?
grep "stats socket" conf
Container stuff🔗
go into container to run gdb
nsenter -t $host_pid -m -p gdb -p $in_container_pid
bind the container fs to get symbols in thee binary container from the host machine with perf (from this)
bindfs /proc/$(docker inspect --format {{.State.Pid}} $CONTAINER_ID)/root /foo
perf record -g -a -F 100 -e cpu-clock -G docker/$(docker inspect --format {{.Id}} $CONTAINER_ID) sleep 90
Flamegraph🔗
(clone the repo and do the stuff)
JVM🔗
Adopt A JDK to get a free JDK
list jvm options (command line cli parameters)🔗
java -XX:+PrintFlagsFinal
jshell🔗
HttpURLConnection con = (HttpURLConnection) new URL("https://***").openConnection();
con.setRequestMethod("GET"); con.getResponseCode();
To test whether the JVM can deal with the pointed server.
jmx stuff🔗
for quick debugging
ex -vnE /...java11.../conf/security/java.policy <<EOF
/grant {/ a
permission java.security.AllPermission;
.
wq
EOF
# stuff that works for my start scripts
ex -vnE ...startscript... <<EOF
/Heap/ a
-Dcom.sun.management.jmxremote !
-Dcom.sun.management.jmxremote.ssl=false !
-Dcom.sun.management.jmxremote.authenticate=false !
-Dcom.sun.management.jmxremote.port=1098 !
.
%s/!/\\\\/
wq
EOF
reset
killall java
unset JAVA_TOOL_OPTIONS
jstatd -p ...whatever... &
Security🔗
- script for quick securing of servers: github repo
- non root port 80 binding: link
TLS🔗
Networking🔗
Static website🔗
Extra stuff to do because moving stands... (2019/06/04):
- Click on bucket
- Click on permission
- Click on "Block public access"
- Untick "Block all public access"
- Set "Block public access to buckets and objects granted through new access control lists (ACLs)" as "OFF"
- Set "Block public access to buckets and objects granted through any access control lists (ACLs)" as "OFF"
Try Cloudflare workers for serverless?
Netflix suddenly fucking up (loads but won't play)🔗
chrome://settings/clearBrowserData
and remove 1h or so
Gems for immutable ruby🔗
- Hamster - immutable data structures
- Ice nine - deep freeze objects
- adamantium - create immutable objects (with memoization support)
- anima - create value objects (with some_obj.with(differing params) and value equality) (depends on adamantium and "equalizer")
- values - like anima, without equality support and with no deps
Modeling server response time!🔗
- StackExchange answer
- more detailed blog!
- sum of lognormal distributions
- the lognormal central limit theorem