github.com/lfch/etcd-io/tests/v3@v3.0.0-20221004140520-eac99acd3e9d/manual/docker-dns/certs-san-dns/run.sh (about)

     1  #!/bin/sh
     2  rm -rf /tmp/m1.data /tmp/m2.data /tmp/m3.data
     3  
     4  /etc/init.d/bind9 start
     5  
     6  # get rid of hosts so go lookup won't resolve 127.0.0.1 to localhost
     7  cat /dev/null >/etc/hosts
     8  echo "127.0.0.1 m1.etcd.local" >> /etc/hosts
     9  echo "127.0.0.1 m2.etcd.local" >> /etc/hosts
    10  echo "127.0.0.1 m3.etcd.local" >> /etc/hosts
    11  
    12  goreman -f /certs-san-dns/Procfile start &
    13  # TODO: remove random sleeps
    14  sleep 7s
    15  
    16  ETCDCTL_API=3 ./etcdctl \
    17   --cacert=/certs-san-dns/ca.crt \
    18   --cert=/certs-san-dns/server-1.crt \
    19   --key=/certs-san-dns/server-1.key.insecure \
    20   --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
    21   endpoint health --cluster
    22  
    23  printf "\nPut abc \n"
    24  ETCDCTL_API=3 ./etcdctl \
    25   --cacert=/certs-san-dns/ca.crt \
    26   --cert=/certs-san-dns/server-2.crt \
    27   --key=/certs-san-dns/server-2.key.insecure \
    28   --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
    29   put abc def
    30  
    31  printf "\nGet abc \n"
    32  ETCDCTL_API=3 ./etcdctl \
    33   --cacert=/certs-san-dns/ca.crt \
    34   --cert=/certs-san-dns/server-3.crt \
    35   --key=/certs-san-dns/server-3.key.insecure \
    36   --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
    37   get abc
    38  
    39  printf "\nKill etcd server 1...\n"
    40  kill $(lsof -t -i:2379)
    41  sleep 7s
    42  
    43  printf "\nGet abc after killing server 1\n"
    44  ETCDCTL_API=3 ./etcdctl \
    45   --cacert=/certs-san-dns/ca.crt \
    46   --cert=/certs-san-dns/server-2.crt \
    47   --key=/certs-san-dns/server-2.key.insecure \
    48   --endpoints=https://m1.etcd.local:2379,https://m2.etcd.local:22379,https://m3.etcd.local:32379 \
    49   get abc
    50  printf "\n\nDone!!!\n\n"
    51