Skip to content

Instantly share code, notes, and snippets.

View elprup's full-sized avatar

elprup elprup

View GitHub Profile
@elprup
elprup / scribeconfig.cfg
Created March 11, 2013 07:24
scribe product config sample (master slave mode)
# master config
port=1456
max_msg_per_second=2000000
max_queue_size=10000000
check_interval=3
<store>
category=heartbeat
type=file
file_path=/mnt/heartbeat
@elprup
elprup / manage.py
Last active December 15, 2015 00:49
simpler interface for boto iam
import boto.iam
import time
import urllib2
import logging
# connetc to iam
# default boto config file location: /etc/boto.cfg
conn = boto.connect_iam()
#setup logging
@elprup
elprup / install_r_lucid.sh
Created March 26, 2013 01:37
install R in ubuntu 10.04
sudo apt-get install gfortran g++ libreadline6-dev libxt-dev
make
sudo make install
@elprup
elprup / scribe_precise_install.sh
Last active December 17, 2015 16:59
install facebook/scribe in ubuntu precise 12.04 script
#!/bin/bash
wget --no-check-certificate https://ftp-master.debian.org/keys/archive-key-6.0.asc && apt-key add archive-key-6.0.asc
sudo gpg --keyserver hkp://pgp.mit.edu --recv-keys 16126D3A3E5C1192
sudo gpg --export --armor 16126D3A3E5C1192 | sudo apt-key add -
sudo apt-get install libboost-all-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config g++ libssl-dev git-core make
wget http://archive.apache.org/dist/thrift/0.9.0/thrift-0.9.0.tar.gz
@elprup
elprup / emr_tools.py
Created June 25, 2013 02:55
emr ini config and run tools
'''
EMR tools
Easy emr python console
author: yaowei
create: 2013-06-24
'''
import copy
import os.path
import boto.emr
@elprup
elprup / data_science.md
Last active December 19, 2015 05:59
collect some urls for data science.
#!/usr/bin/python
import subprocess as spb
import os.path
import sys
msgfmt_path = '/tmp/msgfmt.py'
def run(cmd):
print 'func[cmd]:' + cmd
sock = spb.Popen(cmd, shell=True, stdout=spb.PIPE)
#!/usr/bin/env python
'''
Scribe checker with heartbeat
desc: check scribe alive status, alert if fail
'''
import os
import sys
import time
@elprup
elprup / goauth2_tornado.py
Created June 12, 2014 09:30
google oauth with tornado
class BaseHandler(tornado.web.RequestHandler):
def get_current_user(self):
user_json = self.get_secure_cookie("authdemo_user")
if not user_json: return None
return tornado.escape.json_decode(user_json)
class GoogleOAuth2LoginHandler(tornado.web.RequestHandler,
tornado.auth.GoogleOAuth2Mixin):
@tornado.gen.coroutine
def get(self):
@elprup
elprup / migrate_from_facebook_scribe_to_apache_flume_part_1.md
Last active August 19, 2019 07:23
Migrate from Facebook scribe to Apache Flume

Migrate from Facebook scribe to Apache Flume (Part I)

Reason

We use scribe as our logging server for a long time. At first, everything works fine. Easy to config, easy to manage. As data grows everyday, single scribe server can’t handle that. We have to migrate some category to second log server and attach a big disk. As data is keep growing, we want a big data storage for that instead of local disk. So we decide to use Scribe with HDFS plugin. It is as tough as we first compile scribe from source. Finally we complied the scribed with hdfs support. But after a short period usage, we find a bug that haven’t solved by facebook. (the project is deprecated several years ago). The bug cause scribe can’t write to hdfs if it accidently killed by SIG 9. So we start to test flume and find out ways to migrate.

Configure Flume

Flume is easy to deploy because it is written in Java. Install java and download jar package, we’ve done all the jobs