Skip to content

Instantly share code, notes, and snippets.

View pranavcode's full-sized avatar

Pranav Kulkarni pranavcode

View GitHub Profile
@pranavcode
pranavcode / mongo-start.sh
Created March 30, 2019 17:38
Velotio - HashiCorp Consul Part 2 - Start MongoDB In Replication Mode
mongod --bind_ip_all --port 27017 --dbpath /data/db --replSet "consuldemo"
@pranavcode
pranavcode / replSetConfig.js
Created March 30, 2019 15:24
Velotio - HashiCorp Consul Part 2 - MongoDB Replica Set Configuration
var config = {
_id: "consuldemo",
version: 1,
members: [{
_id: 0,
host: "mongo_1:27017",
}, {
_id: 1,
host: "mongo_2:27017",
}, {
@pranavcode
pranavcode / mongod.conf
Created March 30, 2019 15:03
Velotio - HashiCorp Consul Part 2 - MongoDB Replication Configuration
replication:
replSetName: "consuldemo"
@pranavcode
pranavcode / consul-log-output
Created March 10, 2019 08:34
Velotio - HashiCorp Consul Part 1 - Consul SIGHUP Log
...
2019/03/04 01:10:46 [INFO] agent: Caught signal: hangup
2019/03/04 01:10:46 [INFO] agent: Reloading configuration...
2019/03/04 01:10:46 [DEBUG] agent: removed service "web"
2019/03/04 01:10:46 [INFO] agent: Synced service "web"
2019/03/04 01:10:46 [DEBUG] agent: Node info in sync
...
@pranavcode
pranavcode / consul-reload
Last active March 10, 2019 13:44
Velotio - HashiCorp Consul Part 1 - Consul Reload
$ consul reload
@pranavcode
pranavcode / consul-process-sighup
Created March 10, 2019 08:31
Velotio - HashiCorp Consul Part 1 - Consul Process SIGHUP
$ kill -SIGHUP 21289
@pranavcode
pranavcode / consul-process-check
Last active March 10, 2019 08:28
Velotio - HashiCorp Consul Part 1 - Consul Process Check
$ ps aux | grep [c]onsul
pranav 21289 2.4 0.3 177012 54924 pts/2 Sl+ 00:55 0:22 consul agent -dev -config-dir=./consul.d
@pranavcode
pranavcode / consul-http-service-catalog-health-check-filter
Created March 10, 2019 08:26
Velotio - HashiCorp Consul Part 1 - Consul HTTP Service Catalog with Health Check Filter
$ curl http://localhost:8500/v1/catalog/service/web?passing
[
{
"ID": "810f4804-dbce-03b1-056a-a81269ca90c1",
"Node": "devcube",
"Address": "127.0.0.1",
"Datacenter": "dc1",
"TaggedAddresses": {
"lan": "127.0.0.1",
@pranavcode
pranavcode / consul-http-service-catalog
Created March 10, 2019 08:24
Velotio - HashiCorp Consul Part 1 - Consul HTTP Service Catalog
$ curl http://localhost:8500/v1/catalog/service/web
[
{
"ID": "810f4804-dbce-03b1-056a-a81269ca90c1",
"Node": "devcube",
"Address": "127.0.0.1",
"Datacenter": "dc1",
"TaggedAddresses": {
"lan": "127.0.0.1",
@pranavcode
pranavcode / consul-dns-tag-service-discovery
Created March 10, 2019 08:21
Velotio - HashiCorp Consul Part 1 - Consul DNS-based Tag Service Discovery
$ dig @127.0.0.1 -p 8600 django.web.service.consul
; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @127.0.0.1 -p 8600 django.web.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12278
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available