Hitune对hadoop性能分析
本文档前提在hadoop已成功安装,hadoop安装见http://www.cnblogs.com/hequn/articles/3438301.html
一、安装ntp
1.各个节点进行源安装,[root@Master Hadoop]#yum install ntp,我这个系统安装好后就安装好了。
2.对Master节点/etc/ntp.conf进行配置
# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict -6 ::1 # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap restrict 192.168.178.0 mask 255.255.255.0 nomodify notrap # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 210.72.145.44 server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org #broadcast 192.168.1.255 autokey # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 autokey # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 autokey # manycast client # Undisciplined Local Clock. This is a fake driver intended for backup # and when no outside source of synchronized time is available. #这个是说如果外地时间同步失败,则用本地同步,这个必须要填上,防止断网的时候影响时间同步 server 127.127.1.0 # local clock fudge 127.127.1.0 stratum 10 # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats
3.Master节点上,运行ntp, [root@Master Hadoop]#service ntpd start/stop/restart
4.Master节点上查看ntp服务器有无和上层连通[root@Master Hadoop]#ntpstat 一开始会unsynchronised,同步上可能需要花5分钟的时间,变为synchronised。
5.Slave节点上进行同步,[root@Salve1 conf]# ntpdate 192.168.178.92
6.第5步只是单次同步,如果要每分钟slave自动与master进行同步,需要修改每个slave节点上的/etc/crontab文件,在末尾加上一行:
* * * * * root ntpdate 192.168.1.5 && hwclock -w
二、在集群的每个节点上安装sysstat
下载sysstat (version 9.0.x)。
三、安装chukwa
1.下载chukwa0.4.0到Master节点上,并解压。先不要把chukwa分发到其他机子上,等配置好了再用scp命令分发到其他机子上。
安装文档(1)http://blog.csdn.net/jostey/article/details/7068322 安装步骤主要参考此文档,下面对安装步骤的细节和遇到的一些问题重点说明下。
安装如遇到“can not find hadoop-*-core.jar exists in /usr/hadoop”问题,把原先/usr/hadoop下的hadoop-core-1.1.2.jar改成hadoop-1.1.2-core.jar,并通过scp命令传给每个slave节点。
agents测试,启动agents:[hadoop@Master bin]$ /usr/chukwa-0.4.0/bin/start-all.sh此时应该会在各个节点上通过jps可以看到有一个进程叫做ChukwaAgent.也可以在win7下telnet

以下显示表示agent运行正常

启动如遇到““Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/configuration/Configuration”的异常,说明缺少了commons组件,把 HADOOP_HOME/lib下的commons-configuration-1.6.jar拷贝到$CHUKWA_HOME/lib下。
2.关闭agents。假如关闭不了ChukwaAgent进程可以修改$CHUKWA_HOME/bin/chukwa文件,找到关键字kill 然后将后面的数值改成kill -9。刚改完貌似不能起效,要把一个个agent 手动kill后,重新启动agent,再关闭就可以生效了。
3.安装mysql. 从mysql官网上下载mysql,http://dev.mysql.com/downloads/mysql/5.1.html#downloads这个网上可以下载到mysql-5.6.3-m6-linux2.6-x86_64.tar.gz
安装的时候要特别注意,确保之前通过yum或者apt-get安装的被卸载,而且删除残存的文件,如/etc/my.cnf文件和/etc/mysql目录。我这里出现“[mysql]ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) ”这个错误就是没删除/etc/my.cnf文件
4.启动hicc后,登陆要用户名和密码,都是admin admin。登陆可能遇到"Error in loading dashboard"。我按照http://chukwa.apache.org/docs/r0.4.0/admin.html#Installing+Chukwa 这里面Set Up HICC的方法,CHUKWA_HOME/opt下加了apache-tomcat,并把CHUKWA_HOME/webapps/hicc.war拷到apache-tomcat-6.0.18/webapps下。注意我这里是CHUKWA_HOME/webapps/hicc.war,不是CHUKWA_HOME/hicc.war。这样进入hicc就没有"Error in loading dashboard"错误了.
5.进入hicc后“no data avalilable”。这个错误貌似是数据没有收集成功,或者是没有成功导入。
6.出现“java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonMappingException”异常。将hadoop lib下的 =jackson-core-asl.jar 和 jackson-mapper-asl.jar拷贝到chukwa lib下
6.关闭的过程 ./stop-data-processors.sh -> ./stop-agents.sh -> stop-all.sh
7.最后,下次开启的顺序:启动hadoop -> 启动collector -> 启动agents -> start-data-processors -> 安全模式启动mysql -> dbAdmin.sh(启动进程将数据从hdfs上放到mysql中) -> 开启hicc
hicc貌似会显示不出mysql里的内容,老是no data avaliable.据说是bug...以后有时间再试试hbase的方法....
to be continued
浙公网安备 33010602011771号