This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set nodes = ['%s:%s' % (r['Address'], r['ServicePort']) for r in consul.catalog.service('memcached')] %} | |
[main_cluster] | |
servers = {{ ','.join(nodes) }} | |
[dev_cluster] | |
servers = {{ ','.join(nodes) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rabbitpy | |
import uuid | |
import time | |
COUNT = 100000 | |
with rabbitpy.Connection('amqp://localhost:5672/%2f') as conn: | |
with conn.channel() as channel: | |
exchange = rabbitpy.DirectExchange(channel, 'benchmark') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rabbitpy | |
import time | |
COUNT = 100000 | |
start_time = time.time() | |
for iteration in range(0, COUNT): | |
rabbitpy.publish(exchange='benchmark', | |
routing_key='example', | |
body={'foo': 'bar'}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module("resty.consul", package.seeall) | |
_VERSION = '0.1.0' | |
function service_nodes(service) | |
local http = require "resty.http" | |
local json = require "cjson" | |
local hc = http:new() | |
local upstream = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant VM 1: (server) | |
public IP: 192.168.50.101 | |
Container: | |
Consul: 172.17.0.2 | |
Vagrant VM 2: (agent only) | |
public IP: 192.168.35.8 | |
When joining VM 1's server: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
coreos: | |
etcd: | |
discovery: https://discovery.etcd.io/7dc0971c7e6a060a3755d99bb8e10dd1 | |
addr: $public_ipv4:4001 | |
peer-addr: $public_ipv4:7001 | |
units: | |
- name: etcd.service | |
command: start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
while True: | |
with open('/proc/net/netstat') as netstat: | |
labels = netstat.readline() | |
values = netstat.readline() | |
l = labels.split(' ') | |
v = values.split(' ') | |
x = dict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/command/agent/dns.go b/command/agent/dns.go | |
index b832437..2fe0e5c 100644 | |
--- a/command/agent/dns.go | |
+++ b/command/agent/dns.go | |
@@ -266,17 +266,20 @@ PARSE: | |
goto INVALID | |
} | |
+ // Extract the protocol | |
+ protocol := labels[n-2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gmr-aw-mbp[~/Source/go/src/github.com/hashicorp/consul]: dig @localhost -p 8600 -t SRV appdb.service.consul | |
; <<>> DiG 9.8.3-P1 <<>> @localhost -p 8600 -t SRV appdb.service.consul | |
; (3 servers found) | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40341 | |
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 | |
;; WARNING: recursion requested but not available |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/command/agent/dns.go b/command/agent/dns.go | |
index b832437..cda6237 100644 | |
--- a/command/agent/dns.go | |
+++ b/command/agent/dns.go | |
@@ -262,21 +262,34 @@ PARSE: | |
} | |
switch labels[n-1] { | |
case "service": | |
- if n == 1 { | |
+ switch n { |