Hadoop自学笔记(五)配置分布式Hadoop环境
上一课讲了如何在一台机器上建立Hadoop环境,我们只配置了一个NHName Node, 这个Name Node里面包含了我们所有Hadoop的东西,包括Name Node, Secondary Name Node, Job Tracker, Task Tracker,这一课讲解如何把上述配置放到不同机器上,从而构建一个分布式的
上一课讲了如何在一台机器上建立Hadoop环境,我们只配置了一个NHName Node, 这个Name Node里面包含了我们所有Hadoop的东西,包括Name Node, Secondary Name Node, Job Tracker, Task Tracker,这一课讲解如何把上述配置放到不同机器上,从而构建一个分布式的hadoop配置。
1. hadoop分布式安装概览
a) 2-10个nodes:Name Node, Job Tracker, Secondary Name Node都可以放在一台机器上,所有的Data Node和Task Tracker放在其他机器上
b) 10-40个nodes: 可以把Secondary Name Node分开来
c) 100+ nodes: 所有的Node和Trackers都分开放,并且添加rack awareness支持,同时需要各类优化设置。
本课的流程:
配置好ssh到所有的机器上,使其可以免输入密码连接(如同上一课所述)
配置好masters和slaves
配置好所有的*-site文件
学习使用命令来启动,控制和关闭Hadoop(常用脚本说明如下图)。

2. 配置Hadoop到2-10个节点上
这个图很帅,我们在HN Client机器上来控制所有的Hadoop机器,每个机器给一个窗口(下图已经通过ssh链接到每台机器了,链接方式见上一课)。
第一步:取消所有机器上面的ssh密码访问
ssh-copy-id -i $HOME/.ssh/id-rsa.pub nuggetuser@HNData1
把这个文件拷贝到所有的HNData和Secondary Name Node上面。这样就可以无密码登陆了。

第二步:配置Master和Slaves
所有的配置文件都在/usr/local/hadoop/conf文件夹下面
配置好masters来指向Secondary Name Node, 然后配置slaves文件指向所有的HNData Node
Master文件默认的是localhost
用任何编辑器打开masters文件,删除localhost, 输入HN2ndName (就是你Secondary Name Node 的名称)
同样,编辑slaves文件,把所有的HNData Node名称输入

第三步:配置所有的Data Node,让它们指向Name Node,所有的Task Tracker指向Job Tracker
通过core-site.xml配置前者,通过mapred-site.xml配置后者
在HNData Node配置core-site.xml如下(因为我们是直接把上次的机器配置拷贝进来的,所以可以发现这个文件已经配置过了,如下:)

配置mapred-site.xml如下:

上面的配置应该已经是这样了,不过最好还是检查好每一个Data Node中的配置是不是这样
第四步:重新格式化Name Node
hadoop namenode -format
第五步:配置完成了,可以试着看看能否启动
start-dfs.sh 这个命令启动所有的Name Nodes和Data Nodes,可以使用jps命令来查看是否成功启动了。

start-mapred.sh 这个命令启动所有的Job Trackers和Task Trackers, 同样使用jps来检测是否启动了,如果没有成功,可以去看看logs文件
3. 启动和关闭Hadoop各部分的命令
如果要删除一个node,可以建立一个excludes文件,在里面输入你不想要的node名称,比如HNData3.
然后配置HN Name Node中core-site.xml如下(在最后添加一个property)

同样可以建立一个includes文件来指定包含哪些节点
配置完成后,启用配置:
hadoop dfsadmin -refreshNodes
我们可以在hnname:50070上面看到被排除的Node

运行rebalancer命令
start-balancer.sh
关闭Job Tracker, Task Tracker:
stop-mapred.sh
关闭Name Node, Data Nodes:
stop-dfs.sh

如果要同时启动HNName Node, Data Node, Job Tracker, Task Tracker,则直接输入:
start-all.sh

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.
