| 1 | |
| 2 | hadoop 0.21.1 |
| 3 | chukwa 0.4 |
| 4 | ub1 是 jobtracker / namenode |
| 5 | ub2 chukwa server / mysql server |
| 6 | |
| 7 | > The Chukwa hadoop cluster (CC) |
| 8 | > The monitored source nodes (SN) |
| 9 | > The monitored source nodes set up as a hadoop cluster (SN-C) |
| 10 | |
| 11 | 保險起見,cc sn 都建立資料夾 |
| 12 | /chukwa/ |
| 13 | /tmp/chukwa |
| 14 | |
| 15 | sudo apt-get install sysstat |
| 16 | |
| 17 | = cc 要設定的 conf/ = |
| 18 | |
| 19 | == alert == |
| 20 | waue@nchc.org.tw |
| 21 | |
| 22 | == chukwa-collector-conf.xml == |
| 23 | |
| 24 | <property> |
| 25 | <name>writer.hdfs.filesystem</name> |
| 26 | <value>hdfs://ub2:9000/</value> |
| 27 | <description>HDFS to dump to</description> |
| 28 | </property> |
| 29 | <property> |
| 30 | <name>chukwaCollector.outputDir</name> |
| 31 | <value>/chukwa/logs/</value> |
| 32 | <description>Chukwa data sink directory</description> |
| 33 | </property> |
| 34 | <property> |
| 35 | <name>chukwaCollector.http.port</name> |
| 36 | <value>8080</value> |
| 37 | <description>The HTTP port number the collector will listen on</description> |
| 38 | </property> |
| 39 | |
| 40 | == jdbc.conf == |
| 41 | jdbc.conf.template 改成 jdbc.conf |
| 42 | demo=jdbc:mysql://ub2:3306/test?user=root |
| 43 | |
| 44 | == nagios.properties == |
| 45 | log4j.appender.NAGIOS.Host=ub2 |
| 46 | |
| 47 | == 預設值即可不用改 == |
| 48 | aggregator.sql |
| 49 | chukwa-demux-conf.xml |
| 50 | chukwa-log4j.properties |
| 51 | commons-logging.properties |
| 52 | database_create_tables.sql |
| 53 | log4j.properties mdl.xml |
| 54 | |
| 55 | |
| 56 | = cc, sn 都要設定的 conf = |
| 57 | |
| 58 | == chukwa-env.sh == |
| 59 | export JAVA_HOME=/usr/lib/jvm/java-6-sun |
| 60 | export HADOOP_HOME="/opt/hadoop" |
| 61 | export HADOOP_CONF_DIR="/opt/hadoop/conf" |
| 62 | |
| 63 | = sn 要設定的 conf = |
| 64 | |
| 65 | == agents == |
| 66 | agents.template ==> agents |
| 67 | |
| 68 | ub1 |
| 69 | ub2 |
| 70 | |
| 71 | == chukwa-agent-conf.xml == |
| 72 | chukwa-agent-conf.xml.template ==> chukwa-agent-conf.xml |
| 73 | |
| 74 | <property> |
| 75 | <name>chukwaAgent.tags</name> |
| 76 | <value>cluster="wauegroup"</value> |
| 77 | <description>The cluster's name for this agent</description> |
| 78 | </property> |
| 79 | |
| 80 | <property> |
| 81 | <name>chukwaAgent.hostname</name> |
| 82 | <value>localhost</value> |
| 83 | <description>The hostname of the agent on this node. Usually localhost, this is used by the chukwa instrumentation agent-control interface library</description> |
| 84 | </property> |
| 85 | |
| 86 | == collectors == |
| 87 | localhost |
| 88 | |
| 89 | == initial_adaptors == |
| 90 | cp initial_adaptors.template initial_adaptors |
| 91 | |
| 92 | |
| 93 | |
| 94 | = cc = |
| 95 | 安裝 mysql , php , phpmyadmin, apache2 |
| 96 | |
| 97 | 開 database : test |
| 98 | 匯入: conf/database_create_tables.sql |
| 99 | |
| 100 | |
| 101 | |
| 102 | == log4j.properties == |
| 103 | |
| 104 | $ vim hadoop/conf/log4j.properties |
| 105 | |
| 106 | log4j.appender.DRFA=org.apache.log4j.net.SocketAppender |
| 107 | log4j.appender.DRFA.RemoteHost=ub2 |
| 108 | log4j.appender.DRFA.Port=9096 |
| 109 | log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout |
| 110 | log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | $ cd /opt/hadoop |
| 116 | $ cp /opt/chukwa/conf/hadoop-metrics.properties.template conf/ |
| 117 | $ cp conf/hadoop-metrics.properties conf/hadoop-metrics |
| 118 | $ cp /opt/chukwa/chukwa-hadoop-0.4.0-client.jar ./ |
| 119 | $ cp /opt/chukwa/chukwa-hadoop-0.4.0-client.jar ./lib/ |
| 120 | |
| 121 | |
| 122 | |
| 123 | Configuring and starting the Collector |
| 124 | |
| 125 | 1. Copy conf/chukwa-collector-conf.xml.template to conf/chukwa-collector-conf.xml |
| 126 | 2. Edit conf/chukwa-collector-conf.xml and comment out the default properties for chukwaCollector.writerClass, and chukwaCollector.pipeline. Uncomment block for HBaseWriter parameters, and save. |
| 127 | 3. If you're running HBase in distributed mode, copy your hbase-site.xml file to the collectors conf/ directory. At a minimum, this file must contain a setting for hbase.zookeeper.quorum. |
| 128 | 4. Copy conf/chukwa-env.sh-template to conf/chukwa-env.sh. |
| 129 | 5. Edit chukwa-env.sh. You almost certainly need to set JAVA_HOME, HADOOP_HOME, HADOOP_CONF_DIR, HBASE_HOME, and HBASE_CONF_DIR at least. |
| 130 | 6. |
| 131 | |
| 132 | In the chukwa root directory, say bash bin/chukwa collector |
| 133 | |
| 134 | Configuring and starting the local agent |
| 135 | |
| 136 | 1. |
| 137 | |
| 138 | Copy conf/chukwa-agent-conf.xml.template to conf/chukwa-agent-conf.xml |
| 139 | 2. |
| 140 | |
| 141 | Copy conf/collectors.template to conf/collectors |
| 142 | 3. |
| 143 | |
| 144 | In the chukwa root directory, say bash bin/chukwa agent |
| 145 | |
| 146 | Starting Adaptors |
| 147 | |
| 148 | The local agent speaks a simple text-based protocol, by default over port 9093. Suppose you want Chukwa to monitor system metrics, hadoop metrics, and hadoop logs on the localhost: |
| 149 | |
| 150 | 1. Telnet to localhost 9093 |
| 151 | 2. |
| 152 | |
| 153 | Type [without quotation marks] "add org.apache.hadoop.chukwa.datacollection.adaptor.sigar.SystemMetrics SystemMetrics 60 0" |
| 154 | 3. |
| 155 | |
| 156 | Type [without quotation marks] "add SocketAdaptor HadoopMetrics 9095 0" |
| 157 | 4. |
| 158 | |
| 159 | Type [without quotation marks] "add SocketAdaptor Hadoop 9096 0" |
| 160 | 5. Type "list" -- you should see the adaptor you just started, listed as running. |
| 161 | 6. Type "close" to break the connection. |
| 162 | 7. |
| 163 | |
| 164 | If you don't have telnet, you can get the same effect using the netcat (nc) command line tool. |
| 165 | |
| 166 | Set Up Cluster Aggregation Script |
| 167 | |
| 168 | For data analytics with pig, there are some additional environment setup. Pig does not use the same environment variable name as Hadoop, therefore make sure the following environment are setup correctly: |
| 169 | |
| 170 | 1. export PIG_CLASSPATH=$HADOOP_CONF_DIR:$HBASE_CONF_DIR |
| 171 | 2. Setup a cron job for "pig -Dpig.additional.jars=${HBASE_HOME}/hbase-0.20.6.jar:${PIG_PATH}/pig.jar ${CHUKWA_HOME}/script/pig/ClusterSummary.pig" to run periodically |
| 172 | |
| 173 | Set Up HICC |
| 174 | |
| 175 | The Hadoop Infrastructure Care Center (HICC) is the Chukwa web user interface. To set up HICC, do the following: |
| 176 | |
| 177 | 1. bin/chukwa hicc |
| 178 | |
| 179 | Data visualization |
| 180 | |
| 181 | 1. |
| 182 | |
| 183 | Point web browser to http://localhost:4080/hicc/jsp/graph_explorer.jsp |
| 184 | 2. The default user name and password is "demo" without quotes. |
| 185 | 3. System Metrics collected by Chukwa collector will be browsable through graph_explorer.jsp file. |