(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| db.currentOp().inprog.forEach( | |
| function(op) { | |
| if(op.secs_running > 5) printjson(op); | |
| } | |
| ) |
First, you have to enable profiling
> db.setProfilingLevel(1)
Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it's full, old queries go out, so don't be surprised that it's a moving target...
| #!/usr/bin/env python | |
| import argparse | |
| import json | |
| import os | |
| import urllib2 | |
| def get_envs(app_name): | |
| resp = request("/apps/{}/env".format(app_name)) |
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |
| #!/usr/bin/env python | |
| import pymongo, redis, os | |
| REDIS_HOST = os.getenv('REDIS_HOST', 'localhost') | |
| REDIS_PORT = os.getenv('REDIS_PORT', 6379) | |
| MONGO_HOST = os.getenv('MONGODB_HOST', 'localhost') | |
| MONGO_PORT = os.getenv('MONGODB_PORT', 27017) | |
| mongo = pymongo.MongoClient(MONGO_HOST, MONGO_PORT) |
| import redis, os | |
| HOST = os.getenv("HOST", "localhost") | |
| PORT = os.getenv("PORT", 6379) | |
| r = redis.StrictRedis(host=HOST, port=PORT) | |
| cnames_app = r.get("cname*") | |
| for cname_app in cnames_app: | |
| cname = r.get(cname_app) |
| #!/bin/bash | |
| PREFIX=registry.cloud.tsuru.io/tsuru/ | |
| read command | |
| for image in "$@" | |
| do | |
| echo "Generating $image... " | |
| full_image=${PREFIX}${image} | |
| id=`docker -H 127.0.0.1:4243 run -d $full_image $command` |
The Simple Ambassador Container (let's just call it the ambassador) is a reusable container which can be added to your stack to represent a remote service. Using an ambassador your application can discover remote services using docker's standard links features.
Example usage:
REDIS_REMOTE_IP=1.2.3.4