pkg install isc-dhcp43-client
ipv6_enable_all_interfaces="YES"
| # Mass index deletion with pattern | |
| for index in $(curl -XGET esmaster:9200/_cat/indices | grep pattern | awk '{print $3}'); do curl -XDELETE esmaster:9200/$index?master_timeout=120s; done | |
| # Mass optimize, indexes with the most deleted docs first | |
| for indice in $(CURL -XGET esmaster:9200/_cat/indices | sort -rk 7 | awk '{print $3}'); do curl -XPOST http://esmaster:9200/${indice}/_optimize?max_num_segments=1; done | |
| # Restart half a cluster using rack awareness | |
| curl -XPUT 'host:9200/_cluster/settings' -d '{ "transient" : { "cluster.routing.allocation.enable": "none" }}'; for host in $(curl -XGET esmaster:9200/_cat/nodeattrs?attr | grep rack_id | awk '{print $2}'); do ssh $host service elasticsearch restart; done; sleep60; curl -XPUT 'host:9200/_cluster/settings' -d '{ "transient" : { "cluster.routing.allocation.enable": "all }}' | |
| # normal | |
| curl -XPUT 'http://esmaster01.:9200/_cluster/settings' -d '{ | |
| "transient" : { | |
| "cluster.routing.allocation.cluster_concurrent_rebalance": 50, | |
| "indices.recovery.concurrent_streams": 50, | |
| "cluster.routing.allocation.node_initial_primaries_recoveries": 50, | |
| "cluster.routing.allocation.node_concurrent_recoveries": 50, | |
| "indices.recovery.max_bytes_per_sec": "2048mb", | |
| "cluster.routing.allocation.disk.threshold_enabled" : true, | |
| "cluster.routing.allocation.disk.watermark.low" : "70%", |
| while true; do curl -XGET 'cluster:9200/_cat/thread_pool?v&h=host,search.queue,search.active,search.rejected,search.completed' | sort -unk 2,3 ; sleep 5 ; done |
| # Before running that script, use Twitter backup CSV file to pick up the tweets | |
| # you want to delete. Save, then run: | |
| # cat tweets.csv | cut -f 2 -d '"' | grep '^[0-9]*$' | sed '/^$/d' > delete.csv | |
| # gem install twitter (in case you miss the gem already) | |
| require 'twitter' | |
| client = Twitter::REST::Client.new do |config| | |
| config.consumer_key = '' | |
| config.consumer_secret = '' |
| # in /usr/local/bin/git-cleanup-merged | |
| #!/bin/sh | |
| #!/usr/bin/env bash | |
| current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') | |
| if [ "$current_branch" != "master" ] && [ "$current_branch" != "main" ]; then | |
| echo "WARNING: You are on branch $current_branch, NOT master or main." | |
| fi |
| #!/bin/bash | |
| SWAP_SIZE=4g | |
| TEMP_ROOT_PASSWORD="53nD0tt3rP1c5" | |
| # Partition table | |
| mfiutil delete mfid0 | |
| for drive in $(mfiutil show drives | grep -v SSD | awk '{print $1}'); do | |
| mfiutil create jbod $drive |
| if [ -f "${LOCK_FILE}" ]; then | |
| log_error "A backup is already running with pid $(cat ${LOCK_FILE})" | |
| echo $$ > "${LOCK_FILE}" | |
| if [ $? -gt 0 ]; then | |
| log_error "Error: could not create lock file, exiting" | |
| fi | |
| fi | |
| # do all the logic here |
| curl -XPUT 'http://cluster:9200/_cluster/settings?master_timeout=12000s' -d '{ | |
| "persistent" : { | |
| "cluster.routing.allocation.disk.threshold_enabled" : true, | |
| "cluster.routing.allocation.disk.watermark.low" : "78%", | |
| "cluster.routing.allocation.disk.watermark.high" : "79%" | |
| } | |
| }' |
I hereby claim:
To claim this, I am signing this object: