Skip to content

Instantly share code, notes, and snippets.

@jolestar
jolestar / etcd_cluster.sh
Last active January 4, 2024 06:48
Run etcd cluster by docker with custom network
docker network create etcd --subnet 172.19.0.0/16
docker run -d --name etcd0 --network etcd --ip 172.19.1.10 quay.io/coreos/etcd etcd \
-name etcd0 \
-advertise-client-urls http://172.19.1.10:2379,http://172.19.1.10:4001 \
-listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 \
-initial-advertise-peer-urls http://172.19.1.10:2380 \
-listen-peer-urls http://0.0.0.0:2380 \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster etcd0=http://172.19.1.10:2380,etcd1=http://172.19.1.11:2380,etcd2=http://172.19.1.12:2380 \
@jolestar
jolestar / ipsec-shadowsocks.sh
Last active November 14, 2021 06:53
Run ipsec vpn and shadowsocks by docker, for ubuntu 16
PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine
service docker start
@jolestar
jolestar / es-recovery.sh
Created March 22, 2017 12:25
elasticsearch recovery speed up
curl -s -XGET 'localhost:9200/_cat/recovery?v'
curl -XPUT localhost:9200/_cluster/settings -d '{
"persistent" : {
"cluster.routing.allocation.node_concurrent_recoveries" : "10",
"indices.recovery.max_bytes_per_sec": "250mb",
"indices.recovery.concurrent_streams": 10
}
}'
curl -s -XGET 'localhost:9200/_cat/recovery?v'
@jolestar
jolestar / genpasswd.sh
Created July 26, 2017 08:52
genpasswd a bash function generate random password, default 16 character.
#!/usr/bin/env bash
genpasswd() {
local l=$1;
[ "$l" == "" ] && l=16;
LC_ALL=C tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs ;
}
{"sig":"eb97ff7190923be0c8834956f32dbbc0c575a7778bbfb75d8a669348f505e6f9a5253da05a002da8b8130cb1e442834c4cf36fbab3d0fae0c77a0b6ae9913e691","msghash":"205ed49e8d46abb03d3ce83d5812490cb733108799da11ea3a07e5e6659cdbab"}