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
50_000.downto(0) { |i| Resque::Failure.requeue(i); Resque::Failure.remove(i) } |
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
Resque.working.each {|w| puts w, w.processing } |
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
if os.getuid() != 0: | |
print _("You need to be root to run this application") | |
sys.exit(1) | |
# nice & ionce | |
os.nice(19) | |
subprocess.call(["ionice","-c3", "-p",str(os.getpid())]) | |
# run the main code | |
main(options) |
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
#!/usr/bin/python | |
import crypt | |
import random | |
import string | |
def getsalt(mysalt = "", chars = string.letters + string.digits): | |
# generate a random 16-character 'salt' |
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
require 'timeout' | |
# The resolvable mixin defines behavior for evaluating and returning fact | |
# resolutions. | |
# | |
# Classes including this mixin should implement at #name method describing | |
# the value being resolved and a #resolve_value that actually executes the code | |
# to resolve the value. | |
module Facter::Core::Resolvable |
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
So, I did a quick test with pgbouncer running on the local host and talking to a remote postgresql backend. I had the script open a connection, run a quick almost instantaneous query (SELECT now() ), collect the results and close the connection. It looped over this 50,000 times. | |
Connecting to the bouncer over local unix socket, it took 31s to perform all the queries. | |
Connecting to the bouncer over localhost, it took 45s to perform all the queries. | |
Connecting to the bouncer running on the remote server, it took 1m6s | |
Without using pgbouncer, it took 3m34s |
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
#!/usr/bin/ruby | |
# Queries a PostgreSQL database and publishes statistics to Ganglia using gmetric. | |
# | |
# == Install Dependencies == | |
# | |
# sudo apt-get install ruby ganglia-monitor build-essential | |
# | |
# == Usage == | |
# | |
# postgres_gmetric.rb <databasename> |
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
SELECT 'SET ADD TABLE (SET id = 1, origin = 1, FULL QUALIFIED NAME = ''' || nspname || '.' || relname || ''', comment=''' || nspname || '.' || relname || ' TABLE'');' FROM pg_class JOIN pg_namespace ON relnamespace = pg_namespace.oid WHERE relkind = 'r' AND relhaspkey AND nspname NOT IN ('information_schema', 'pg_catalog') ORDER BY pg_total_relation_size(pg_class.oid) DESC; | |
SELECT 'SET ADD SEQUENCE (SET id = 1, origin = 1, FULL QUALIFIED NAME = ''' || n.nspname || '.' || c.relname || ''', comment=''' || n.nspname || '.' || c.relname || ' SEQUENCE'');' FROM pg_class c, pg_namespace n WHERE c.relnamespace = n.OID AND c.relkind = 'S'; |
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
# Watchdog | |
#------------------------------------------------------------------------------ | |
use_watchdog = on | |
delegate_IP = '10.10.10.100' | |
wd_hostname = '10.10.10.21' | |
wd_port = 9000 | |
ifconfig_path = '/usr/bin' | |
arping_path = '/usr/bin' | |
if_up_cmd = 'sudo ip addr add $_IP_$ dev eth0' | |
if_down_cmd = 'sudo ip addr del $_IP_$ dev eth0' |
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
rsync -e "ssh -c arcfour postgres@192.168.6.10" -rLKpts --delete-excluded --inplace --exclude='/pg_xlog/*' --exclude='/pg_log/*' --exclude=/recovery.conf --exclude=/postmaster.pid :/mnt/pgdata/9.2/main/ /tmp/main/ |