O'Reilly logo

CoreOS Essentials by Rimantas Mocevicius

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Watching changes in etcd

This time, let's watch the key changes in etcd. Watching key changes is useful when we have, for example, one fleet unit with nginx writing its port to etcd, and another reverse proxy application watching for changes and updating its configuration:

  1. We need to create a directory in etcd first:
    $ etcdctlmkdir /foo-data
    
  2. Next, we watch for changes in this directory:
    $ etcdctl watch /foo-data--recursive
    
  3. Now open another CoreOS shell in a new terminal window:
    $ cdcoreos-vagrant
    $ vagrantssh
    
  4. We add a new key to the /foo-data directory:
    $ etcdctl set /foo-data/Book is_cool
    
  5. In the first terminal, we should see a notification saying that the key was changed:
    is_cool
    

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required