Skip to content

Instantly share code, notes, and snippets.

View ogibayashi's full-sized avatar

Hironori Ogibayashi ogibayashi

View GitHub Profile
##
## Hadoopのジョブ実行時間を可視化する
##
## 入力ファイルは、以下のように<attempt ID>,<start>,<end>のフォーマットである必要がある
##
## attempt_201405161748_0029_m_000074_0,1400232465,1400232468
## attempt_201405161748_0029_m_000072_0,1400232468,1400232474
## attempt_201405161748_0029_m_000047_0,1400232468,1400232477
## attempt_201405161748_0029_m_000048_0,1400232468,1400232482
## attempt_201405161748_0029_m_000061_0,1400232468,1400232483
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
## Hadoopのジョブ実行ログをパースし、task attemptごとに<attempt ID>,<start>,<end>の
## 形で出力する.
## Usage
## parse_joblog.rb history/done/....
task_attempts = { }
#!/usr/bin/env ruby
require 'rubygems'
require 'parallel'
require 'socket'
require 'optparse'
opts = {}
ARGV.options {|opt|
opt.on('-h Host', 'host to connect'){|v| opts[:host] = v }

この本について

OpenShiftの管理者ではなく、Webアプリケーション開発者向けの本. OpenShift Onlineを使って、どのようにWebアプリケーションを動かすことができるか、ということが書いてある

1. Introduction

  • OpenShiftとは?
    • RedHatが提供するPaaS
  • 3つのバージョンがある
    • OpenShift Origin : オープンソースであり、最新版. 自分の環境に入れて使うことができる. OnlineやEnterpriseのUpstreamとなる.
    • OpenShift Online : RedHatが提供するクラウドサービス版. AWS上で動いており、アカウントを作ればOpenShiftの環境を使うことができる. 本書はこれを対象に書かれている.
@ogibayashi
ogibayashi / iterator_patch
Created November 6, 2014 01:18
LevelDBテストのためのスクリプト
--- iterator.rb.bak 2014-10-15 11:09:30.378246696 +0900
+++ iterator.rb 2014-10-15 11:48:56.200251049 +0900
@@ -29,6 +29,7 @@
def each(&block)
return self unless block_given?
if current = self.next
+ break if range? && current[0] >= @_range[1]
block[*current]
end while valid?
@_range = nil
@ogibayashi
ogibayashi / bench_memo.md
Last active August 29, 2015 14:10
Fluentd benchmark memo

Fluentdベンチマークのメモ

単一プロセスのin_tail

以下のように、ファイルを読み込みflowcountだけ取ってnullに捨てる

<source>
 type tail
 path /tmp/dummy_log.log

HDP2.2を手元のVMで試しにセットアップしてみたが、色々ハマった部分があったのでメモ

環境

CentOS6.3のVMを7つ用意して、以下のようにHA含めて構成することにした.

  • master1: NameNode(active), ZKFC, JournalNode, Zookeeper
  • master2: NameNode(standby), ZKFC, JournalNode, ResourceManager(standby), Zookeeper
  • master3: JournalNode, ResourceManager(active), Zookeeper, HiveServer2, MySQL
  • slaves(3ノード): DataNode, NodeManager
@ogibayashi
ogibayashi / file0.txt
Created July 31, 2015 01:23
Norikra上でマスタデータ等とJOINするのに使えるnorikra-udf-lookupを作った ref: http://qiita.com/ogibayashi/items/67b37904cae3b47cf407
gem 'norikra-udf-lookup'
@ogibayashi
ogibayashi / fluentd_pidstat.rb
Created August 3, 2015 05:57
サーバ上で稼働している各fluentdプロセスのCPU使用率をfluentdに投げるスクリプト
#!/usr/bin/env ruby
# Send process cpu usage for each fluentd process to fluentd.
# Each fluentd must be exected with -c (config) option
# This script might be executed periodically by cron.
require 'set'
require 'optparse'
require 'fluent-logger'
@ogibayashi
ogibayashi / DistinctCountTest.scala
Created March 24, 2016 09:28
Distinct count test code for Apache Flink
import java.sql.Timestamp
import java.util.concurrent.TimeUnit
import org.apache.flink.streaming.api.functions.source.FileMonitoringFunction
import org.apache.flink.streaming.api.functions.source.FileMonitoringFunction.{ WatchType}
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time
import org.apache.flink.streaming.api.windowing.triggers.ContinuousProcessingTimeTrigger
object DistinctCountTest {