• etcd


    etcd 0.5.0-alpha.4版本中

    先用普通方式启用一边。
    /bin/etcd -initial-advertise-peer-urls http://your_ip:7001 -advertise-client-urls http://your_ip:4001 -listen-peer-urls http://0.0.0.0:7001 -listen-client-urls http://0.0.0.0:4001 &

    #!/bin/bash  
      
    if [ -z $1 ]; then  
            echo "Usage: c run <image name>:<version>"  
            echo "       c stop <container name>"  
            exit 1  
    fi  
      
    if [ -z $ETCD_HOST ]; then  
      ETCD_HOST="10.250.0.186:4001"  
    fi  
      
    if [ -z $ETCD_PREFIX ]; then  
      ETCD_PREFIX="app/servers"  
    fi  
      
    if [ -z $CPORT ]; then  
      CPORT="8069"  
    fi  
      
    if [ -z $FORREST_IP ]; then  
      FORREST_IP=`ifconfig eth0| grep "inet addr" | head -1 | cut -d : -f2 | awk '{print $1}'`  
    fi  
      
    function launch_container {  
            echo "Launching $1 on $FORREST_IP ..."  
      
            CONTAINER_ID=`docker run -d -p :8069 $1`  
            PORT=`docker inspect $CONTAINER_ID|grep ""Ports"" -A 50|grep ""$CPORT/tcp"" -A 3| grep HostPort|cut -d '"' -f4|head -1`  
            NAME=`docker inspect $CONTAINER_ID | grep Name | cut -d '"' -f4 | sed "s////g"|sed -n 2p`  
      
            echo "Announcing to $ETCD_HOST..."  
            curl -XPUT "http://$ETCD_HOST/v2/keys/$ETCD_PREFIX/$NAME" -d value="$FORREST_IP:$PORT"  
      
            echo "$1 running on Port $PORT with name $NAME"  
    }  
      
    function stop_container {  
            echo "Stopping $1..."  
            CONTAINER_ID=`docker ps -a| grep $1 | awk '{print $1}'`  
            echo "Found container $CONTAINER_ID"  
            docker stop $CONTAINER_ID  
      echo http://$ETCD_HOST/v2/keys/$ETCD_PREFIX/$1  
            curl -XDELETE http://$ETCD_HOST/v2/keys/$ETCD_PREFIX/$1 &> /dev/null  
            echo "Stopped."  
    }  
      
      
    if [ $1 = "run" ]; then  
      launch_container $2  
    else  
      stop_container $2  
    fi  
  • 相关阅读:
    C,LINUX,数据结构部分
    LINUX应用开发工程师职位(含答案)
    INT32 System_UserKeyFilter(NVTEVT evt, UINT32 paramNum, UINT32 *paramArray)
    屏幕调试
    1.ARM嵌入式体系结构与接口技术(Cortex-A8版)
    NT9666X调试log
    DemoKit编译过程错误
    selenium 代理设置
    pandas 轮询dataframe
    Spring 定时任务
  • 原文地址:https://www.cnblogs.com/zxpgo/p/4138361.html
Copyright © 2020-2023  润新知