我使用Cloudera CDH存储库在CentOS上构建了一个单节点Hadoop环境.当我想将本地文件复制到HDFS时,我使用了以下命令:
sudo -u hdfs hadoop fs -put /root/MyHadoop/file1.txt /
Run Code Online (Sandbox Code Playgroud)
但是,结果让我很沮丧:
put: '/root/MyHadoop/file1.txt': No such file or directory
Run Code Online (Sandbox Code Playgroud)
我确定这个文件确实存在.
请帮帮我,谢谢!
我无法在这个问题上找到准确的答案:
PUT发送的参数是在URL中传递的,还是在HTTP头中传递的?
我认为这是HTTP标头,但是当我使用PUT方法提交表单时,它会将参数附加到URL!
我一直在使用Cloudera的hadoop(0.20.2).使用此版本,如果我将文件放入文件系统,但目录结构不存在,则会自动创建父目录:
例如,如果我在hdfs和typed中没有目录:
hadoop fs -put myfile.txt /some/non/existing/path/myfile.txt
它将创建所有目录:some,non,existing和path并将文件放在那里.
现在,随着更新的hadoop(2.2.0)产品的出现,这种自动创建的目录不会发生.上面的相同命令产生:
put:`/ some/non/existing/path /':没有这样的文件或目录
我有一个解决方法,首先只做hadoop fs -mkdir,每次放置,但这不会很好.
这是可配置的吗?有什么建议?
我想要一个更新资源的链接,而不使用HTML表单.
路线:
resources :users do
resource :profile, :controller=>"profiles"
resources :friends
end
Run Code Online (Sandbox Code Playgroud)
耙路线:
user_friend GET /users/:user_id/friends/:id(.:format){:action=>"show", :controller=>"friends"}
PUT /users/:user_id/friends/:id(.:format){:action=>"update", :controller=>"friends"}
Run Code Online (Sandbox Code Playgroud)
我想通过简单的链接使用put来更新朋友,如下所示:
<%= link_to"Add as friend",user_friend_path(current_user,:method =>'put')%>
但是当Rails遇到这个链接时,他试图进入节目动作.
问题是:这样做的正确链接是什么?
我正在用PHP构建API.其中一种方法是place.new(PUT请求).它需要几个字符串字段,它还需要一个图像.但是我无法让它发挥作用.使用POST请求很简单,但我不知道如何使用PUT以及如何在服务器上获取数据.
谢谢您的帮助!
$curl = curl_init();
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($curl, CURLOPT_URL, $this->url);
curl_setopt($curl, CURLOPT_PUT, 1);
curl_setopt($curl, CURLOPT_INFILE, $image);
curl_setopt($curl, CURLOPT_INFILESIZE, filesize($image));
$this->result = curl_exec($curl);
curl_close($curl);
Run Code Online (Sandbox Code Playgroud)
if ( $im_s = file_get_contents('php://input') )
{
$image = imagecreatefromstring($im_s);
if ( $image != '' )
{
$filename = sha1($title.rand(11111, 99999)).'.jpg';
$photo_url = $temp_dir . $filename;
imagejpeg($image, $photo_url);
// upload image
...
}
}
Run Code Online (Sandbox Code Playgroud)
// Correct: /Users/john/Sites/....
// Incorrect: http://localhost/...
$image = fopen($file_on_dir_not_url, …Run Code Online (Sandbox Code Playgroud) 我的用户在iOS应用中输入一些信息字段.必须在我的服务器上验证此信息,该服务器具有RESTful API.验证后,iOS应用程序的UI会更改以指示结果.
GET,PUT或POST似乎都不合适,因为我没有获得资源,也没有创建或更新资源.
实现此验证的最佳拟合REST操作是什么?
我正在尝试向特定的URL发送PUT请求,并且到目前为止还没有成功.
如果我通过HTTP请求者GUI(例如这个)执行此操作,那么就像在以下URL上执行PUT一样简单:
http://www.mywebsite.com:port/Application?key=apikey&id=id&option=enable|disable
请注意,在上述请求中指定了端口号.通过ruby代码提交请求时,我还需要这样做.
我怎样才能在Ruby中复制这样的请求?
我需要使用ruby 创建HTTP PUT请求.
该请求具有JSON正文
我能够使用以下方法生成JSON主体:
require 'rubygems'
require 'json'
jsonbody = JSON.generate["message"=>"test","user"=>"user1"]
Run Code Online (Sandbox Code Playgroud)
我需要将此PUT请求发送到url:
require 'open-uri'
url = URI.parse('http://www.data.com?access_token=123')
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我如何在Ruby中做到这一点?
如何在jQuery中为ajax请求执行X-HTTP-Method-Override?