知识点
相关文章
更多最近更新
更多使用Cygwin从Windows上传日志到HDFS
2019-03-28 14:09|来源: 网络
windows操作系统:windows server2003
对cygwin不熟,所幸我只是需要进行很简单的应用,在同事的帮助下完成了这个工作。这里大致说一下,给大家提供一个思路。
1、安装JDK,并配置环境变量。要注意安装路径不要空格,不要安装到类似于program files这种目录,否则cygwin会出问题。
2、部署Hadoop。直接拉一个liux上部署的hadoop,并部署到本地。我把它放到了D盘的根目录下。
3、安装cygwin。主要是几个组件,不必细说。我把它安装到了D盘的根目录下。
4、创建windows用户cloud。这里创建的用户,必须与linux里运行hadoop的用户相同,否则在上传文件时会提示没有权限。
5、创建一个供cloud用户调用的bat文件,写入:
D:\cygwin\bin\bash --login -i D:/hadoop-0.20.2-CDH3B4/bin/hadoop -ls /
上述脚本的目的是为了测试使用windows脚本通过cygwin调用hadoop命令是否成功。注意斜杠的不同: 前半部分是windows下的斜杠,后半部分是linux下的斜杠!
以cloud用户的身份运行这个脚本后,cygwin会其安装目录下的home文件下创建一个cloud的用户目录!
6、上述测试通过以后,则在cygwin中的cloud用户目录中创建一个sh文件,比如名为upload.sh的文件,写入:
#!/bin/bash D:/ hadoop-0.20.2-CDH3B4/bin/hadoop fs -put $DIR/$FILES $HDFS
然后,重新编辑刚才的bat文件,把后面的命令更改为sh脚本名称:
D:\cygwin\bin\bash --login -i /home/cloud/upload.sh
7、其它的部分的修改,主要是
hadoop配置文件,一般要把其中的
JAVA环境变量注释掉,或者某些部分的斜杠要改成
windows的习惯,
或者要修改windows的hosts表。
相关问答
更多-
在windows平台 类UNIX模拟环境 除了cygwin 还有其他的么[2022-12-14]
Windows 10自带的Linux子系统,WSL -
关于hadoop 本地文件向HDFS上传的问题[2023-02-08]
如何上传的?api么?你写两个不同的文件试试 先确定问题在哪,如果有错误日志贴出来 -
我想通了,要安装Cygwin作为服务我需要运行“ssh-host-config”插入所有需要的定义,这将安装它作为一个名为“CYGWIN sshd”的服务。 I figured it out, To install Cygwin as a service I needed to run "ssh-host-config" insert all the needed definitions and this will install it as a service called "CYGWIN sshd".
-
也许如果你刷新输出 import sys V = range(100000) for x in V: print x sys.stdout.flush() Perhaps if you flush the output import sys V = range(100000) for x in V: print x sys.stdout.flush()
-
答案在日志中。 这里会有一个特定的异常,很可能是一个文件访问问题,要求你chmod 755 -R某个目录及其内容。 The answer is in the logs. There will be a specific exception detailed there, most likely a file access problem requiring you to chmod 755 -R some directory and its contents.
-
我在这里找到了答案 因为我正在使用YARN框架,所以我在log4.properties文件中为mapred.audit.logger添加了以下行 log4j.logger.org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger=${mapred.audit.logger} I found an answer here As i am using YARN framework, i just added the below line in lo ...
-
使用date +%T是不可能的,因为命令结果将包含:字符如11:12:45 ,并且在HDFS中无法创建具有:字符的文件名。 请参阅Hadoop-3275 。 在脚本中尝试此命令, hdfs dfs -put /home/myname/folder1/* /user/myname/example_1_`date +%H%M%S`.txt 这将创建类似/user/myname/example_1_111245.txt文件名。 Using date +%T is not possible as the comm ...
-
您可以将AWS CLI与Eucalyptus一起使用,例如用于EC2: aws --endpoint-url http://myeuca:8773/services/Eucalyptus ec2 describe-instances 该示例假定您已配置凭据 。 You can use the AWS CLI with Eucalyptus, e.g. for EC2: aws --endpoint-url http://myeuca:8773/services/Eucalyptus ec2 describ ...
-
喜欢这个: eh@winxpsp3 ~ $ echo `cmd /c ver` Microsoft Windows XP [Version 5.1.2600] eh@winxpsp3 ~ $ Like this: eh@winxpsp3 ~ $ echo `cmd /c ver` Microsoft Windows XP [Version 5.1.2600] eh@winxpsp3 ~ $
-
尝试将网络驱动器Z:映射到// server /然后在/ cygdrive / z /中可以访问您选择的字母 Try by mapping a network drive Z: to //server/ and then the letter you choose will be accessible in /cygdrive/z/