暗能星系

    • 登录
    • 搜索

    HDFS 安装和部署

    大数据
    1
    11
    37
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • A
      anneng 最后由 anneng 编辑

      我们系统当前已经有了anneng账号 如果是新机器 可以用下面的方法创建账号:
      创建hadoop普通账户
      sudo adduser hadoop
      su - hadoop (-表示切换到hadoop的新会话 su hadoop会使用当前用户的上下文)

      安装openssh 服务器之间配置免密登录
      sudo apt install openssh-server openssh-client -y
      ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
      cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
      chmod 0600 ~/.ssh/authorized_keys
      ssh localhost

      1 条回复 最后回复 回复 引用 0
      • A
        anneng 最后由 编辑

        此回复已被删除!
        1 条回复 最后回复 回复 引用 0
        • A
          anneng 最后由 anneng 编辑

          此回复已被删除!
          1 条回复 最后回复 回复 引用 0
          • A
            anneng 最后由 anneng 编辑

            此回复已被删除!
            1 条回复 最后回复 回复 引用 0
            • A
              anneng 最后由 编辑

              此回复已被删除!
              1 条回复 最后回复 回复 引用 0
              • A
                anneng 最后由 编辑

                HDFS读取的过程
                f51bf043-3a1a-4271-8b86-bfbd832b72b6-image.png
                A client initiates read request by calling 'open()' method of FileSystem object; it is an object of type DistributedFileSystem.
                This object connects to namenode using RPC and gets metadata information such as the locations of the blocks of the file. Please note that these addresses are of first few blocks of a file.
                In response to this metadata request, addresses of the DataNodes having a copy of that block is returned back.
                Once addresses of DataNodes are received, an object of type FSDataInputStream is returned to the client. FSDataInputStream contains DFSInputStream which takes care of interactions with DataNode and NameNode. In step 4 shown in the above diagram, a client invokes 'read()' method which causes DFSInputStream to establish a connection with the first DataNode with the first block of a file.
                Data is read in the form of streams wherein client invokes 'read()' method repeatedly. This process of read() operation continues till it reaches the end of block.
                Once the end of a block is reached, DFSInputStream closes the connection and moves on to locate the next DataNode for the next block
                Once a client has done with the reading, it calls a close() method.

                写入的过程
                e81b1e74-a55c-4b62-9bc2-e064140ce59e-image.png
                A client initiates write operation by calling 'create()' method of DistributedFileSystem object which creates a new file - Step no. 1 in the above diagram.
                DistributedFileSystem object connects to the NameNode using RPC call and initiates new file creation. However, this file creates operation does not associate any blocks with the file. It is the responsibility of NameNode to verify that the file (which is being created) does not exist already and a client has correct permissions to create a new file. If a file already exists or client does not have sufficient permission to create a new file, then IOException is thrown to the client. Otherwise, the operation succeeds and a new record for the file is created by the NameNode.
                Once a new record in NameNode is created, an object of type FSDataOutputStream is returned to the client. A client uses it to write data into the HDFS. Data write method is invoked (step 3 in the diagram).
                FSDataOutputStream contains DFSOutputStream object which looks after communication with DataNodes and NameNode. While the client continues writing data, DFSOutputStream continues creating packets with this data. These packets are enqueued into a queue which is called as DataQueue.
                There is one more component called DataStreamer which consumes this DataQueue. DataStreamer also asks NameNode for allocation of new blocks thereby picking desirable DataNodes to be used for replication.
                Now, the process of replication starts by creating a pipeline using DataNodes. In our case, we have chosen a replication level of 3 and hence there are 3 DataNodes in the pipeline.
                The DataStreamer pours packets into the first DataNode in the pipeline.
                Every DataNode in a pipeline stores packet received by it and forwards the same to the second DataNode in a pipeline.
                Another queue, 'Ack Queue' is maintained by DFSOutputStream to store packets which are waiting for acknowledgment from DataNodes.
                Once acknowledgment for a packet in the queue is received from all DataNodes in the pipeline, it is removed from the 'Ack Queue'. In the event of any DataNode failure, packets from this queue are used to reinitiate the operation.
                After a client is done with the writing data, it calls a close() method (Step 9 in the diagram) Call to close(), results into flushing remaining data packets to the pipeline followed by waiting for acknowledgment.
                Once a final acknowledgment is received, NameNode is contacted to tell it that the file write operation is complete.

                基本操作
                将本地文件保存到HDFS
                $HADOOP_HOME/bin/hdfs dfs -copyFromLocal temp.txt /
                查看系统内容
                $HADOOP_HOME/bin/hdfs dfs -ls /
                将HDFS文件保存到本地
                $HADOOP_HOME/bin/hdfs dfs -copyToLocal /temp.txt
                创建新的目录
                $HADOOP_HOME/bin/hdfs dfs -mkdir /mydirectory

                1 条回复 最后回复 回复 引用 0
                • A
                  anneng 最后由 编辑

                  执行hdfs ls报错 发现 端口9000被docker占用了 重新分配为7000端口
                  ls: DestHost:destPort master:9000 , LocalHost:localPort anneng01/103.114.101.5:0. Failed on local exception: java.io.IOException: Connection reset by peer

                  1 条回复 最后回复 回复 引用 0
                  • A
                    anneng 最后由 编辑

                    https://cordis.europa.eu/docs/projects/cnect/1/317871/080/deliverables/001-Ares20143999552D23.pdf
                    001-Ares20143999552D23.pdf

                    1 条回复 最后回复 回复 引用 0
                    • A
                      anneng 最后由 编辑

                      https://support.huaweicloud.com/intl/en-us/prtg-kunpenghpcs/kunpenggatk_02_0011.html

                      1 条回复 最后回复 回复 引用 0
                      • A
                        anneng 最后由 编辑

                        https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7571545/
                        9271cf73-f88b-408f-a4ae-dfe20eda8ab5-image.png

                        1 条回复 最后回复 回复 引用 0
                        • First post
                          Last post
                        Powered by 暗能星系