Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Last active August 29, 2015 14:27
Show Gist options
  • Save AllenFang/446be8aa28b3aba8ad26 to your computer and use it in GitHub Desktop.
Save AllenFang/446be8aa28b3aba8ad26 to your computer and use it in GitHub Desktop.
operation.txt
i => edit
<vim 操作指令>
esc => exit edit
:q => quit vim
:q! => quit vim & not overwrite
:wq => write & quit vim
-------------------------------------------------
<Terminal 操作指令>
ll => list file and directory
ll | head -n 10
pwd => show current path
ctrl+shift+c => copy current text (terminal mode)
mv => move file
cd => change path
gunzip *.gz => unzip .gz file (current path)
rm -f [1-9]*
-------------------------------------------------
<hadoop 操作指令>
hdfs.put => from local src to hadoop dest
hdfs.mv => from hadoop src to hadoop dest
hdfs.get => from hadoop src to local dest
-------------------------------------------------
[cloudera@quickstart => user name@host name
-------------------------------------------------
--步驟--
開terminal
cd /home/cloudera/Desktop/gsod_2015
gunzip *.gz
<Eclipse裡,ExtractTest.java 檔案更改部分>
File f = new File("/home/cloudera/Desktop/gsod_2015");
BufferedWriter bw = new BufferedWriter(new FileWriter("/home/cloudera/Desktop/gsod_2015/gsod_2015_combine.txt", true));
<RStudio裡,輸入下列指令>
Sys.setenv(HADOOP_CMD="/usr/lib/hadoop/bin/hadoop")
library(rhdfs)
hdfs.init()
hdfs.mkdir("/sam_put")
hdfs.put(src = "/home/cloudera/Desktop/gsod_2015/gsod_2015_combine.txt",dest = "/sam_put")
<Eclipse裡,TransformTest.java 檔案更改部分>
BufferedReader br = new BufferedReader(new FileReader("/home/cloudera/Desktop/gsod_2015/gsod_2015_combine.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("/home/cloudera/Desktop/gsod_2015/gsod_2015_struct.txt", true));
<HareDB>
cd ~
cd Desktop/Hadoop_R/
bash startup.sh
<Bulkload部分>
選local,輸入/home/cloudera/Desktop/gsod_2015/gsod_2015_struct.txt
建table,ColumnFamily輸入cf
name1 -> 勾選isKey
name2 -> TEMP
name3 -> TEMP_C
name4 -> DEWP
name5 -> DEWP_C
Setting畫面,選HBase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment