etcd 2.0 cluster with proxy on Windows Server 2012

I got interested in etcd while working on CoreOS for a work project. I’m no fan of Linux, but I like what etcd offers and how simple it is to setup and manage. Thankfully, the etcd team produces a Windows build with every release. I created a Chocolatey package and got it published, then used it to setup the cluster. The service is hosted by nssm, which also has a Chocolatey package and the extremely helpful nssm edit tool for making changes to the service config. Etcd has great documentation here.

Etcd is installed by running:

choco install -y etcd --params="<service parameters>"

Where service parameters is:

etcd --name "%COMPUTERNAME%" ^
--initial-advertise-peer-urls "http://%COMPUTERNAME%:2380" ^
--listen-peer-urls "http://%COMPUTERNAME%:2380" ^
--listen-client-urls "http://%COMPUTERNAME%:2379,http://127.0.0.1:2379" ^
--advertise-client-urls "http://%COMPUTERNAME%:2379" ^
--discovery "https://discovery.etcd.io/<your_token_here>" ^
--debug

Or you can install it in proxy mode by running:

choco install -y etcd --params="--proxy on --listen-client-urls http://127.0.0.1:2379 --discovery https://discovery.etcd.io/<your_token_here>"

Proxy mode is especially useful because it lets applications running on a machine be ignorant of the etcd cluster. Applications connect to localhost on a known port, and etcd in proxy mode manages finding and using the cluster. Even if the cluster is running on CoreOS, running etcd in proxy mode on Windows is a good way to help Windows apps leverage etcd.

Watch a demo of the whole thing here:

Advertisements

About robertlabrie
DevOps Engineer at The Network Inc in metro Atlanta. Too many interests to list here, check out my posts, or look me up on LinkedIn

4 Responses to etcd 2.0 cluster with proxy on Windows Server 2012

  1. GPinheiro says:

    Hello robert.

    I too am interested in using etcd as a service directory for a couple of nodejs Servers im currently implementing. But I have a problem, I start etcd with the default configurations and when try to setup anything with the etcdctl client it responds with error #0: client: endpoint http://localhost:2379 exceeded header timeout. I even disabled firewall but no dice.

    I would appreciate your help as nobody seems to be using this on a Windows machine. I’ve tested on a friend’s Mac and it works as expected.

    • robertlabrie says:

      Hi,

      That should work. Can you confirm the service is running? Also, run nssm edit etcd in the console on it’s own and enable logging to a text file. That log might reveal whats going on. Either the service isn’t running, or if it’s in proxy mode, maybe it can’t talk to the actual cluster.

      • GPinheiro says:

        Hey, thanks for such a quick response.

        Unfortunately I was unable to install ETCD via your chocolatey package as it, for some reason, detects my OS as a 32bit system (not true).

        Nevertheless it seems to be something wrong with the etcdctl client. Performing HTTP requests works just fine as well as setting/retrieving keys from NodeJs applications using npm module ‘node-etcd’.

        Appreciate your work and good luck

        Best wishes,
        Gil Pinheiro.

  2. robertlabrie says:

    The etcdctl client depends on some environment variables to find etcd, are you running nodejs on Windows or some other machine?

    For the OS Bitness detection, I’m using a .Net class for it. Strange that it’s bothering you. Can you send me a message from the chocolatey package page, include the results of running this from powershell: [Environment]::Is64BitOperatingSystem
    and this from cmd: systeminfo

    You can redact whatever you like, mostly I want to see “System Type”

    Thanks again

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: