ETCD-Linux环境单机安装简易教程

单机安装

  1. 官网:https://github.com/etcd-io/etcd/tags
  2. 选择最新版进去,点进去 找到linux版本下载

github
linux版本下载

  1. 解压并查看是否安装成功

    tar -zxvf /data/etcd/etcd-3.5.15.tar.gz -C /data/etcd/etcd-v3.5.15
    #查看安装是否成功的相关命令
    /data/etcd/etcd-v3.5.15/etcd --version
    /data/etcd/etcd-v3.5.15/etcdctl version
    /data/etcd/etcd-v3.5.15/etcdutl version
    
  2. 添加环境变量

    vim /etc/profile
    ------------------------------------
    export ETCD_HOME=/data/etcd/etcd-v3.5.15
    export PATH=.:$ETCD_HOME:$PATH
    ————————————————----------------
    source /etc/profile
    
  3. 后台启动etcd

    1. chmod 777 /data/etcd/etcd-v3.5.15/etcd
      /data/etcd/etcd-v3.5.15/etcd &
      
    2. 测试etcd写入

      etcdctl --endpoints=localhost:2379 put foo bar
      etcdctl --endpoints=localhost:2379 get foo
      

      在这里插入图片描述
      在这里插入图片描述

  4. 或者直接使用github提供的命令 – Linux # 能访问外网

    1. # 创建安装脚本 vim etcd 写入如下内容
      ETCD_VER=v3.5.15
      
      # choose either URL
      GOOGLE_URL=https://storage.googleapis.com/etcd
      GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
      DOWNLOAD_URL=${GOOGLE_URL}
      
      rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
      rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
      
      curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
      tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
      rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
      
      /tmp/etcd-download-test/etcd --version
      /tmp/etcd-download-test/etcdctl version
      /tmp/etcd-download-test/etcdutl version
      
    2. 启动本地etcd

      # start a local etcd server
      /tmp/etcd-download-test/etcd
      
      # write,read to etcd
      /tmp/etcd-download-test/etcdctl --endpoints=localhost:2379 put foo bar
      /tmp/etcd-download-test/etcdctl --endpoints=localhost:2379 get foo
      
  5. 查看启动状态 :etcdctl member list

  6. 卸载只需要删除对应文件和目录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值