Hadoop on Mountain Lion

Environment

  • Mac OSX 10.8.3
  • Homebrew
  • Java 6
  • Hadoop 1.1.2

Setting up SSH for public key login

generate public key in order to login to localhost without password.

#ssh-keygen

#cd ~/.ssh
#cat "id_rsa.pub" >> authorized_keys2

#ssh localhost

Setting up Hadoop configuration

all conf files are located in /usr/local/Cellar/hadoop/1.1.2/libexec/conf.
core-site.xml

<configuration>
  <property>
    <name>fs.default.name</name>
    <value>hdfs://localhost:9000</value>
  </property>
</configuration>

hdfs-site.xml

<configuration>
  <property>
    <name>dfs.name.dir</name>
    <value>/Users/${user.name}/hdfs</value>
  </property>
  <property>
    <name>dfs.replication</name>
    <value>1</value>
  </property>
</configuration>

mapred-site.xml

<configuration>
  <property>
    <name>mapred.job.tracker</name>
    <value>localhost:9001</value>
  </property>
  <property>
    <name>mapred.tasktracker.map.tasks.maximum</name>
    <value>4</value>
  </property>
</configuration>

hadoop-env.sh

export JAVA_HOME="$(/usr/libexec/java_home -v 1.6)"
export HADOOP_OPTS="-Djava.security.krb5.realm=OX.AC.UK -Djava.security.krb5.kdc=kdc0.ox.ac.uk:kdc1.ox.ac.uk"

You can download Apple Java 6 here.

Initialization

hadoop namenode -format

RUN

start-all.sh

Test

Calculation of Pi

hadoop jar /usr/local/Cellar/hadoop/1.1.2/libexec/hadoop-examples-1.1.2.jar pi 4 400000

ref
http://lizan.asia/blog/2012/11/13/mountain-lion-setup-hadoop/
http://borrelli.org/2012/05/02/hadoop-osx-sshkey_setup/

MAMPでのmysql操作の仕方

move directry
cd /Applications/MAMP/Library/bin

Access to mysql
./mysql -u root -p


However, it is an inefficient way to type "cd path". Path should be written in zshrc.
zshrc

export PATH=$PATH:/Applications/MAMP/Library/bin


ref
http://blog.mayy.me/mysql/mamp-terminal.html
http://bl6.jp/web/db/terminal-mamp-mysql-connection/

Wordpressでステップメールを機能を実現する Autoresponder エラーfix

Autoresponder 4.04

http://wordpress.org/extend/plugins/wp-responder-email-autoresponder-and-newsletter-plugin/

このプラグインを導入するとワードプレスにステップメール機能が追加されます。
のはずでしたが、
プラグインを有効にした途端、wordpressが落ちます。

PHP Fatal error: Class 'ARGWA_Widget' not found in /var/httpdStore/wordpress/wp-includes/widgets.php on line 324

これは、プラグインのバグで、
ar_gwa.phpの2065行目

    setTimeout("jQuery('#argwa-plugin-alert').fadeIn('slow');clearTimeout();",1000);
  });
  </script>
  <?  ここ
 }
}
class ARGWA_Widget extends WP_Widget {

public function __construct() {
		parent::__construct(
	 		'WidgetARGWA', // Base ID
			'ARGWA Autoresponder', // Name
			array( 'description' => __( 'A Widget for ARGWA Subscription Form', 'argwa' ), ) // Args
		);
	}

<?のあとにphpをつけて<?phpにしましょう。

Install Kyototycoon on Debian wheezy

Kyoto Tycoon is a remote client for Kyoto Cabinet and support Leveldb, memcached protcol. Kyoto Cabinet/Tycoon are like memcached but provide permanent data. Now days enterprise use Kyoto products because they enable permanent store and are pluggable to memcached. All you have to do to change Kyoto Tycoon from memcached is to change port number.

I installed Kyoto Cabinet and Tycoon on Debian wheezy.
Kyoto Cabinet 1.2.76
Kyoto Tycoon 0.9.56

wget http://fallabs.com/kyotocabinet/pkg/kyotocabinet-1.2.76.tar.gz
tar zxvf kyotocabinet-1.2.76.tar.gz
cd kyotocabinet-1.2.76
./configure
make
make check
make install

wget http://fallabs.com/kyototycoon/pkg/kyototycoon-0.9.56.tar.gz
tar zxvf kyototycoon-0.9.56.tar.gz
cd kyototycoon-0.9.56
./configure
make

Error was occuerred.

Error
ktdbext.h:274:29: error: ‘getpid’ was not declared in this scope

According to this site https://aur.archlinux.org/packages/kyototycoon/
getpid() is mentioned in unistd.h

vi ktdbext.h
#include <unistd.h>

make
make check
make install

And another error was happend.

ktserver: error while loading shared libraries: libkyototycoon.so.2: cannot open shared object file: No such file or directory


ldd /usr/local/bin/ktserver
        linux-gate.so.1 =>  (0xb7837000)
        libkyototycoon.so.2 => not found
        libkyotocabinet.so.9 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7739000)
        libm.so.6 => /lib/libm.so.6 (0xb7712000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb76f4000)
        libc.so.6 => /lib/libc.so.6 (0xb75af000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7596000)
        /lib/ld-linux.so.2 (0xb7838000)


vim /etc/ld.so.conf.d/kyoto.conf
I added below path.
/usr/local/lib 


ldconfig


https://aur.archlinux.org/packages/kyototycoon/

http://d.hatena.ne.jp/ishibashits/20110430/1304143562