Building etcd

aborkar-ibm edited this page Nov 15, 2018 · 31 revisions

Building etcd

Below versions of etcd are available in respective distributions at the time of creation of these build instructions:

  • Ubuntu 16.04 has 2.2.5
  • Ubuntu 18.04 has 3.2.17
  • RHEL (7.3, 7.4, 7.5) have 3.2.15

The instructions provided below specify the steps to build etcd version 3.3.8 on Linux on IBM Z for following distributions:

  • RHEL (7.3, 7.4, 7.5)
  • SLES (12 SP3, 15)
  • Ubuntu (16.04, 18.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.

  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writeable directory anywhere you'd like to place it.

  1. Build using script

    If you want to build etcd using manual steps, go to STEP 2.

    Use the following commands to build etcd using the build script. Please make sure you have wget installed.

    wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/etcd/build_etcd.sh
    
    # Build etcd
    bash build_etcd.sh   [Provide -t option for executing build with tests]
    
    

    If the build completes successfully, go to STEP 8. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.

  2. Install the build dependencies

    • RHEL (7.3, 7.4, 7.5)
    sudo yum install curl git wget tar gcc which golang
    • SLES (12 SP3 , 15)
    sudo zypper install curl git wget tar gcc which
    
    • Ubuntu (16.04, 18.04)
    sudo apt-get update
    sudo apt-get install git curl wget tar gcc golang-1.9
    export PATH=/usr/lib/go-1.9/bin:$PATH
  3. Install GO 1.9+ locally and Set Environment Variables (For SLES)

    cd /<source_root>/
    wget https://storage.googleapis.com/golang/go1.9.2.linux-s390x.tar.gz
    chmod ugo+r go1.9.2.linux-s390x.tar.gz
    sudo tar -C /usr/local -xzf go1.9.2.linux-s390x.tar.gz
    export PATH=$PATH:/usr/local/go/bin
    sudo ln /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc
    

    Note: Make sure to set GOROOT environment variable to point to GO Installation directory.

  4. Get etcd source code from github

    cd /<source_root>/
    mkdir -p /<source_root>/src/github.com/coreos
    cd /<source_root>/src/github.com/coreos
    git clone git://github.com/coreos/etcd
    cd etcd
    git checkout v3.3.8
  5. Set GOPATH and ETCD_DATA_DIR

    export GOPATH=/<source_root>/
    mkdir -p /<source_root>/etcd_temp
    export ETCD_DATA_DIR=/<source_root>/etcd_temp
  6. Build etcd

    cd /<source_root>/src/github.com/coreos/etcd
    ./build
    sudo cp $GOPATH/src/github.com/coreos/etcd/bin/etcd /usr/bin/
  7. Execute test suite

     cd /<source_root>/src/github.com/coreos/etcd
     ./test
  8. Test etcd service

    etcd &

    Note: In case of error etcdmain: etcd on unsupported platform without ETCD_UNSUPPORTED_ARCH=s390x set", set following environment variable and rerun the command:

    export ETCD_UNSUPPORTED_ARCH=s390x

    This will bring up etcd listening on port 2379 for client communication and on port 2380 for server-to-server communication.

    Next, let's set a single key, and then retrieve it:

    curl -L http://127.0.0.1:2379/v2/keys/mykey -XPUT -d value="this is awesome"
    curl -L http://127.0.0.1:2379/v2/keys/mykey

    You have successfully started etcd and written a key to the store.

References:

https://coreos.com/etcd/

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.