2011年1月30日日曜日

Eclipse Install 日本語化

CentOS5.5でEclipseをインストールした。当初yumでいれようとしたがEclipse3.2だったのでソースから入れることに変更

1. 最新版をダウンロード
http://www.eclipse.org/downloads/ より Eclipse Classic 3.6.1,をダウンロード

2. 展開
# tar -xvzf eclipse-SDK-3.6.1-linux-gtk-x86_64.tar.gz

3. 日本語化パッケージのダウンロード
http://mergedoc.sourceforge.jp から最新版をダウンロード

最新版をクリックし、一番上のリビジョンのダウンロードをクリック


ダウンロードしたファイル(pleiades.zip)を展開
# unzip pleiades.zip

展開するとfeaturesとpluginsの2つのフォルダが作成されます。これを先ほどいれたEclipseのfeaturesとpluginsに上書きします。

今回の環境は
/root/eclipse/features
/root/eclipse/plugins
に対して
/root/features
/root/plugins
を上書きします。

# cp -rf /root/features /root/eclipse/features
# cp -rf /root/plugins /root/eclipse/plugins

※cp -rf とやっても上書き確認を聞かれます。
# which cp
alias cp='cp -i'
/bin/cp

aliasでiオプションがデフォルトになっていました。
# unalias cp または
#/bin/cp -rf src/* dest/
で確認がなくなります

eclipse.iniに下記を追加
-javaagent:plugins/jp.sourceforge.mergedoc.pleiades/pleiades.jar

起動して日本語化されているかチェックします。
起動ファイルはeclipseフォルダの中のeclipseを実行します。

2011年1月29日土曜日

Hadoopの設定:疑似分散モード(1台)

CentOS5.4にHadoopをインストールします。

1. JDKをインストールします。

# chmod +x jdk-6u23-linux-x64-rpm.bin
# sh jdk-6u23-linux-x64-rpm.bin

パスも自動的に設定されているようです。


2. Cloudera社リポジトリの追加

# cd /etc/yum.repos.d
# wget http://archive.cloudera.com/redhat/cdh/cloudera-cdh3.repo



3. hadoopインストール

# yum -y install hadoop-0.20



4. サービス起動

# service hadoop-0.20-namenode start
# service hadoop-0.20-jobtracker start
# service hadoop-0.20-datanode start
# service hadoop-0.20-tasktracker start

Hadoopは「JobTracker」「TaskTracker」「NameNode」「DataNode」という4つのサーバから構成されます。 JobTrackerとTaskTrackerはMapReduce処理、NameNodeとDataNodeは分散ファイルシステム機能を担当しています。また、Hadoopを動かすクラスタでは1台が「masterノード」、その他のノードが「slaveノード」となります。 masterノードではJobTrackerとNameNode、slaveノードではTaskTrackerとDataNodeが起動されます
参考:http://codezine.jp/article/detail/2699

5. 設定ファイルをインストール

# yum -y install hadoop-0.20-conf-pseudo


6. サンプルを見てみる

# hadoop-0.20 jar /usr/lib/hadoop-0.20/hadoop-*-examples.jar
とするとサンプル一覧が表示される

aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files.
aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files.
dbcount: An example job that count the pageview counts from a database.
grep: A map/reduce program that counts the matches of a regex in the input.
join: A job that effects a join over sorted, equally partitioned datasets
multifilewc: A job that counts words from several files.
pentomino: A map/reduce tile laying program to find solutions to pentomino problems.
pi: A map/reduce program that estimates Pi using monte-carlo method.
randomtextwriter: A map/reduce program that writes 10GB of random textual data per node.
randomwriter: A map/reduce program that writes 10GB of random data per node.
secondarysort: An example defining a secondary sort to the reduce.
sleep: A job that sleeps at each map and reduce task.
sort: A map/reduce program that sorts the data written by the random writer.
sudoku: A sudoku solver.
teragen: Generate data for the terasort
terasort: Run the terasort
teravalidate: Checking results of terasort
wordcount: A map/reduce program that counts the words in the input files.

実行方法
# hadoop-0.20 jar /usr/lib/hadoop-0.20/hadoop-*-examples.jar サンプル名 引数1 引数2 ・・・


5.1 pi (円周率計算)をしてみる
# hadoop-0.20 jar /usr/lib/hadoop-0.20/hadoop-*-examples.jar pi 4(Number of Maps) 2000(Samples per Map)

Number of Maps = 4
Samples per Map = 2000



5.2 wordcountを実行する

5.2-1 処理対象を配置する先となる input サブディレクトリーをファイルシステムに作成

# hadoop-0.20 fs -mkdir input

5.2-2 input サブディレクトリーに処理対象を配置

# hadoop-0.20 fs -put /root/test.txt input
ここでは /root/test.txt をinputに移します。test.txtには英文を適当にいれておきます。

# hadoop-0.20 fs -ls input (ファイルがあるか確認します)
Found 1 items
-rw-r--r-- 1 root supergroup 73 2011-01-30 03:59 /user/root/input/test.txt

5.2-3 実行
# hadoop-0.20 jar /usr/lib/hadoop-0.20/hadoop-*-examples.jar wordcount input output
(この時点ではoutputはありません。自動生成されます)




5.2-4 結果確認
# hadoop-0.20 fs -ls output (ファイルが作成されたか確認)


# hadoop-0.20 fs -cat output/part-r-00000 (結果確認)


# hadoop-0.20 fs -get output/part-r-00000 /root/output.txt (HDFS からの出力の抽出)

6. ブラウザ(Web UI)で確認

6.1 HDFSの確認
http://localhost:50070/

先ほど使ったファイルが見られます。

6.2 MapReduceの確認
http://localhost:50030/


参考
http://saburi380.blogspot.com/2009/11/301hadoopcentos-cloudera.html
http://oss.infoscience.co.jp/hadoop/common/docs/current/quickstart.html#Purpose
http://www.ibm.com/developerworks/jp/linux/library/l-hadoop-1/index.html?ca=drs-
http://www.ibm.com/developerworks/jp/linux/library/l-hadoop-2/

2011年1月25日火曜日

ZABBIXインストール

ZABBIXのインストール
ZABBIXのyumリポジトリを登録します。

Red Hat Enterprise Linux 5 / CentOS 5
# rpm -ivh http://www.zabbix.jp/binaries/relatedpkgs/rhel5/i386/zabbix-jp-release-5-3.noarch.rpm

ZABBIX1.6のインストール
# yum install zabbix zabbix-agent zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql

MySQLデータベースサーバの設定
vi /etc/my.cnf
[mysqld]
・・・デフォルトの設定は残す・・・

default-character-set=utf8
skip-character-set-client-handshake

# mysqldセクションに含まれるよう、mysqld_safeよりも上に設定を書くこと
[mysqld_safe]
・・・デフォルトの設定は残す・・・

MySQLデータベースサーバの起動
# service mysqld start

データベース「zabbix」
# mysqladmin create zabbix --default-character-set=utf8

データベースにZABBIX接続ユーザ「zabbix」を作成
# mysql -uroot
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> flush privileges;
mysql> quit

ZABBIXの初期データベースのインポート
mysql -u root -p zabbix < /usr/share/doc/zabbix-server-1.6.9/schema/mysql.sql
mysql -u root -p zabbix < /usr/share/doc/zabbix-server-1.6.9/data/data.sql
mysql -u root -p zabbix < /usr/share/doc/zabbix-server-1.6.9/data/images_mysql.sql

Webインターフェースの設定
Apache Webサーバの起動
# service httpd start

インストーラを起動するためにWebインターフェースの設定ファイルを削除します
# rm /etc/zabbix/zabbix.conf.php

ブラウザでZABBIXサーバにアクセス
http://zabbix-server-address/zabbix

ブラウザ上でインストールを進めます。
PHPとMySQLの設定確認を行います。MySQLはパスワードの設定が必須
ZABBIXサーバの確認用ポートを設定する
最後にログイン画面が表示されたら終了
初期ログインID:admin
パスワード:zabbix

ZABBIXサーバの設定

vi /etc/zabbix/zabbix_server.conf
# Database host name
# Default is localhost

#DBHost=localhost

# Database name
# SQLite3 note: path to database file must be provided. DBUser and DBPassword are ignored.
DBName=zabbix

# Database user

DBUser=zabbix <- データベースユーザ名を設定

# Database password
# Comment this line if no password used

DBPassword=zabbix <- コメントアウトを外してデータベースパスワードを設定

# Connect to MySQL using Unix socket?

DBSocket=/var/lib/mysql/mysql.sock <- コメントアウトを外す

ZABBIXサーバの起動

# service zabbix-server start

ZABBIXエージェントの設定



vi /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1 <- ZABBIXサーバのIPアドレスを設定

# Server port for sending active checks

#ServerPort=10051

# Unique hostname. Required for active checks.

Hostname=ZABBIX Server <- Webインターフェースのホスト設定で登録するホスト名と同じ値を設定

# Listen port. Default is 10050

#ListenPort=10050

# IP address to bind agent
# If missing, bind to all available IPs

ListenIP=127.0.0.1 <- ListenするIPインターフェースを設定

ZABBIXエージェントの起動

# service zabbix-agent start

2011年1月3日月曜日

Android携帯 HTC x06でのシリアルキーの確認

Android携帯HTC X06にPCからプログラムをアップロードをするのにドライバが必要でした。

ドライバ(ソフトウェアパック)のダウンロードは下記より
http://www.htc.com/jp/SupportDownload.aspx?p_id=315&cat=3&dl_id=1023

シリアルキーの入力が必要なので
設定→この携帯電話について→電話ID→デバイスのシリアル番号 で確認