Skip to content

Commit cf3c636

Browse files
committed
add run pi test
1 parent adf24d4 commit cf3c636

File tree

10 files changed

+67
-67
lines changed

10 files changed

+67
-67
lines changed

ROADMAP.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
road-map
22
================
3+
0)singel node, localhost
4+
35
1)simple version, pure java http server, socket based REST service,ditributed to certain number of selected node
4-
2)front end evolution + distributed to every node
5-
3)backend -> scala+spray
6+
7+
2) real web server
8+
9+
3)front end evolution + distributed to every node
10+
11+
4)backend -> scala+spray
612

hadoop-installtion/script/bin/start-hadoop.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

hadoop-installtion/script/bin/stop-hadoop.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.
File renamed without changes.
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
#!/bin/sh
2-
#$1 :HADOOP_HOST=localhost
3-
#$2 :HADOOP_VERSION=2.3.0-cdh5.0.0
4-
#$3 :HADOOP_URL=http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.3.0-cdh5.0.0.tar.gz
5-
#$4 :HADOOP_HOME=~/hadoop-installation
2+
HADOOP_HOST=localhost
3+
HADOOP_VERSION=2.3.0-cdh5.0.0
4+
HADOOP_URL=http://archive.cloudera.com/cdh5/cdh/5/hadoop-2.3.0-cdh5.0.0.tar.gz
5+
HADOOP_HOME=~/hadoop-install
6+
HADOOP_CONF_TEMPLATE_DIR=../
67

7-
if [ "$3" != "" ]
8+
9+
HADOOP_DIR=$HADOOP_HOME/hadoop-$HADOOP_VERSION
10+
11+
if [ "$1" != "" ]
12+
then
13+
HADOOP_DIR="$1"
14+
fi
15+
echo "HADOOP_DIR=$HADOOP_DIR"
16+
17+
if [ ! -d $HADOOP_HOME/hadoop-$HADOOP_VERSION ]
818
then
9-
./bin/install-hadoop.sh
19+
./install-hadoop.sh $HADOOP_HOST $HADOOP_VERSION $HADOOP_URL $HADOOP_HOME $HADOOP_CONF_TEMPLATE_DIR
1020
fi
1121

12-
./bin/start-hadoop.sh ~/hadoop-install/hadoop-2.3.0-cdh5 true
22+
23+
$HADOOP_DIR/sbin/start-dfs.sh
24+
$HADOOP_DIR/sbin/start-yarn.sh
25+
open http://$HADOOP_HOST:8088
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
#!/bin/sh
2-
./bin/stop-hadoop.sh ~/hadoop-install/hadoop-2.3.0-cdh5 true
2+
HADOOP_VERSION=2.3.0-cdh5.0.0
3+
HADOOP_HOME=~/hadoop-install
4+
5+
6+
HADOOP_DIR=$HADOOP_HOME/hadoop-$HADOOP_VERSION
7+
8+
if [ "$1" != "" ]
9+
then
10+
HADOOP_DIR="$1"
11+
fi
12+
echo "HADOOP_DIR=$HADOOP_DIR"
13+
14+
15+
$HADOOP_DIR/sbin/stop-dfs.sh
16+
$HADOOP_DIR/sbin/stop-yarn.sh
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export HADOOP_VERSION=2.3.0-cdh5.0.0
2+
export HADOOP_HOME=~/hadoop-install/hadoop-${HADOOP_VERSION}
3+
$HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar pi 4 10

src/main/java/com/codeboy/simpleyarnapp/ApplicationMaster.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
xmlhttp = new XMLHttpRequest();
1212
}
1313
function executeCommand() {
14-
var url = "$distributed-shell-url" + empno.value;
14+
var url = "$distributed-shell-url?cmd=" + shell_command.value;
1515
xmlhttp.open('GET',url,true);
1616
xmlhttp.send(null);
1717
xmlhttp.onreadystatechange = function() {
@@ -20,7 +20,7 @@
2020
if (xmlhttp.readyState == 4) {
2121
if ( xmlhttp.status == 200) {
2222
var result = eval( "(" + xmlhttp.responseText + ")");
23-
23+
document.getElementById("shell_result").value=result;
2424
}
2525
}
2626
else

src/main/java/com/codeboy/simpleyarnapp/ApplicationMaster.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ public static void main(String[] args) throws Exception {
124124
}
125125
}
126126

127+
/***
128+
* Light weight web server
129+
* 1) sever the app master tracking url
130+
* 2) server cmd execution REST API
131+
* @author zhaoyong
132+
*
133+
*/
134+
127135
class AMHandler implements HttpHandler {
128136
//http://www.srikanthtechnologies.com/blog/java/rest_service_client.aspx
129137
private List<DistributedNode> nodes;
@@ -132,8 +140,15 @@ public AMHandler(List<DistributedNode> nodes) {
132140
this.nodes = nodes;
133141
}
134142

143+
135144
@Override
136145
public void handle(HttpExchange t) throws IOException {
146+
/** if is the trackurl
147+
or the cmd rest call
148+
149+
1 read html template
150+
2 replace url with app url
151+
*/
137152
String response = "This is the distributed shell";
138153
t.sendResponseHeaders(200, response.length());
139154
OutputStream os = t.getResponseBody();

src/main/java/com/codeboy/simpleyarnapp/DistributedNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@
33
public class DistributedNode {
44
String host;
55
String port;
6-
String ShellServicePath;
6+
String shellServiceURLPath;
7+
8+
String userName;
9+
710
}

0 commit comments

Comments
 (0)