Below is an example of how to setup gnatsd cluster using Docker.
I have put 3 different configurations (one per gnatsd server) under a folder named conf as follows:
tree conf| # -*- coding: utf-8 -*- | |
| import asyncio | |
| import re | |
| import asyncio_redis | |
| import tornado.concurrent | |
| import tornado.httpclient | |
| import tornado.web | |
| import tornado.platform.asyncio |
| #cloud-config | |
| hostname: node-01 | |
| ssh_authorized_keys: | |
| - ssh-rsa <redacted> | |
| coreos: | |
| etcd2: | |
| discovery: https://discovery.etcd.io/<redacted> | |
| advertise-client-urls: http://node-01.mux.lan:2379 |
| # use with: logging.config.dictConfig(yaml.load(open('logging.yaml', 'r'))) | |
| # Formatters detailed here: http://docs.python.org/2/library/logging.html#logrecord-attributes | |
| version: 1 | |
| formatters: | |
| simple: | |
| format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' | |
| detail: | |
| format: '%(asctime)s - %(levelname)s - File: %(filename)s - %(funcName)s() - Line: %(lineno)d - %(message)s' |
| ''' | |
| This is a module that defines some helper classes and functions for | |
| expiring groups of related keys at the same time. | |
| Written July 1-2, 2013 by Josiah Carlson | |
| Released into the public domain | |
| ''' | |
| import time |
| from concurrent.futures import ThreadPoolExecutor | |
| from functools import partial, wraps | |
| import time | |
| import tornado.ioloop | |
| import tornado.web | |
| EXECUTOR = ThreadPoolExecutor(max_workers=4) |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| # Examples from http://andreypopp.com/posts/2012-10-30-callbacks-to-promises.html | |
| # using IcedCoffeeScript http://maxtaco.github.com/coffee-script/ : | |
| search = (engine, q, cb) -> | |
| $.ajax(url: engine, success: cb) | |
| await | |
| search 'google', 'js', defer(googleSearched) | |
| search 'bing', 'js', defer(bingSearched) | |
| processResults(bingSearched, googleSearched) | |
| await |