Return-Path: Delivered-To: apmail-hadoop-common-user-archive@www.apache.org Received: (qmail 86964 invoked from network); 1 Mar 2011 16:40:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Mar 2011 16:40:37 -0000 Received: (qmail 90812 invoked by uid 500); 1 Mar 2011 16:40:34 -0000 Delivered-To: apmail-hadoop-common-user-archive@hadoop.apache.org Received: (qmail 90573 invoked by uid 500); 1 Mar 2011 16:40:31 -0000 Mailing-List: contact common-user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-user@hadoop.apache.org Delivered-To: mailing list common-user@hadoop.apache.org Received: (qmail 90558 invoked by uid 99); 1 Mar 2011 16:40:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2011 16:40:31 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of airbots@gmail.com designates 74.125.82.176 as permitted sender) Received: from [74.125.82.176] (HELO mail-wy0-f176.google.com) (74.125.82.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Mar 2011 16:40:22 +0000 Received: by wya21 with SMTP id 21so6191911wya.35 for ; Tue, 01 Mar 2011 08:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=22eTZMawH8ak9QIpZ60Q/vnsLcGdL2jd8v4ywJs6TGQ=; b=N4NT05MD6zDPFF7p+RH3nCgSamwov51GCZc0Ke+yKI/db9qUudY0QqoVRCYEBkaKMp hRoovAL4cs3vfHyACZBC+DCv8HXHJ1jysKRjiSocvU3RxDLUmjzJk43UyMQMpttq2XM9 DnKZhf0gUzx80wH37PLMtl1tSpDzdbZeYsQ5M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=kxFz6gMBFs+i+ynYn5CbjQ6tjv04f0dwDkKfW0aF7w4Hy06gp9Ov+a8F4zPG+6aX9s Fi9iC3M3NnlTAUAKkWLuXX5Uz5Z99zxQO6VL3FxYwSXSAuAMLOKQSKN5xmzrbwJtosDY LKvW9DICRMEztWWm0IHLCkutPQPU1N6GHPV60= MIME-Version: 1.0 Received: by 10.216.3.200 with SMTP id 50mr3737868weh.34.1298997602550; Tue, 01 Mar 2011 08:40:02 -0800 (PST) Received: by 10.216.47.132 with HTTP; Tue, 1 Mar 2011 08:40:02 -0800 (PST) Date: Tue, 1 Mar 2011 10:40:02 -0600 Message-ID: Subject: hadoop balancer From: He Chen To: common-dev@hadoop.apache.org, common-user@hadoop.apache.org Content-Type: multipart/alternative; boundary=0016e64c1a26aa0427049d6e72fa X-Virus-Checked: Checked by ClamAV on apache.org --0016e64c1a26aa0427049d6e72fa Content-Type: text/plain; charset=ISO-8859-1 Hi all I met a problem when I try to balance certain hdfs directory among the clusters. For example, I have a directory "/user/xxx/", and there 100 blocks. I want to balance them among my 5 nodes clusters. Each node has 40 blocks (2 replicas). The problem is about transfer block from one datanode to another. Actually, I followed the balancer's method. However, it always waits for the response of destination datanode and halt. I attached the code: ................................................. Socket sock = new Socket(); DataOutputStream out = null; DataInputStream in = null; try{ sock.connect(NetUtils.createSocketAddr( target.getName()), HdfsConstants.READ_TIMEOUT); sock.setKeepAlive(true); System.out.println(sock.isConnected()); out = new DataOutputStream( new BufferedOutputStream( sock.getOutputStream(), FSConstants.BUFFER_SIZE)); out.writeShort(DataTransferProtocol.DATA_TRANSFER_VERSION); out.writeByte(DataTransferProtocol.OP_REPLACE_BLOCK); out.writeLong(block2move.getBlockId()); out.writeLong(block2move.getGenerationStamp()); Text.writeString(out, source.getStorageID()); System.out.println("Ready to move"); source.write(out); System.out.println("Write to output Stream"); out.flush(); System.out.println("out has been flushed!"); in = new DataInputStream( new BufferedInputStream( sock.getInputStream(), FSConstants.BUFFER_SIZE)); It stop here and wait for response. short status = in.readShort(); System.out.println("Got the response from input stream!"+status); if (status != DataTransferProtocol.OP_STATUS_SUCCESS) { throw new IOException("block move is failed\t"+status); } } catch (IOException e) { LOG.warn("Error moving block "+block2move.getBlockId()+ " from " + source.getName() + " to " + target.getName() + " through " + source.getName() + ": "+e.toString()); } finally { IOUtils.closeStream(out); IOUtils.closeStream(in); IOUtils.closeSocket(sock); } .......................................... Any reply will be appreciated. Thank you in advance! Chen --0016e64c1a26aa0427049d6e72fa--