Here is how to get a file using s3cmd: First configure the account:
s3cmd --configureThen, you can use s3cmd to access your buckets. eg: downloading a folder from s3:
s3cmd get --recursive s3://bucket_name/object_name to_local_file
s3cmd --configureThen, you can use s3cmd to access your buckets. eg: downloading a folder from s3:
s3cmd get --recursive s3://bucket_name/object_name to_local_file
show databases; use db_name; show tables; describle table_name;These will get you enogh info to run your real SQL command..
alias la='ls -la' alias gopen='gnome-open' alias gterminal='gnome-terminal' alias ls='ls --color' PS1="\`if [ \$? = 0 ]; then echo \e[33\;40m\\\^\\\_\\\^\e[0m; else echo \e[36\;40m\\\-\e[0m\\\_\e[36\;40m\\\-\e[0m; fi\` \w> "NOTE: Make sure alias comes after PS1. PS1 is for cutom prompt.
public class GenericReplace {
public static final String IS_KEY_FIRST = "IsKeyFirstInMapFile";
public static class GenerateLinks extends Mapper {
public void map(Text key, Text value, Context context) {
if (context.getConfiguration().getInt(IS_KEY_FIRST, 1)) {
//do this ..
}
else{
//do that ..
}
}
}
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
GenericReplace.graphPath = args[0];
GenericReplace.outputPath = args[1];
conf.setBoolean(IS_KEY_FIRST , Boolean.getBoolean(args[3]));
Job job = Job.getInstance(new Cluster(conf), conf);
...
}
}
FSDataOutputStream dos = fs.create(new Path("/user/tmp"), true);
dos.writeInt(counter);
dos.close();//Writer
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fs.create(new Path("/user/tmp"), true)));
bw.write(counter.toString());
bw.close();
//Reader
DataInputStream d = new DataInputStream(fs.open(new Path(inFile)));
BufferedReader reader = new BufferedReader(new InputStreamReader(d));
while ((line = reader.readLine()) != null){
...
}
reader.close();
//writer
SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, new Path(pathForCounters, context.getTaskAttemptID().toString()), Text.class, Text.class);
writer.append(new Text(firtUrl.toString()+"__"+ context.getTaskAttemptID().getTaskID().toString()), new Text(counter+""));
writer.close();
//reader
SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(makeUUrlFileOffsetsPathName(FileInputFormat.getInputPaths(context)[0].toString())), conf);
while (reader.next(key, val)){
offsets.put(key.toString(), Integer.parseInt(val.toString()));
}