时至今日,Hadoop已成为最流行的离线数据处理平台,然而它的集群配置起来并不简单。如果你学习Hadoop不久,相信下面这45个问题会对你有所帮助。
在工作生活中,有些问题非常简单,但往往搜索半天也找不到所需的答案,在Hadoop的学习与使用过程中同样如此。这里为大家分享Hadoop集群设置中经常出现的一些问题,以下为译文:
1.Hadoop集群可以运行的3个模式?
单机(本地)模式
伪分布式模式
全分布式模式
2. 单机(本地)模式中的注意点?
在单机模式(standalone)中不会存在守护进程,所有东西都运行在一个JVM上。这里同样没有DFS,使用的是本地文件系统。单机模式适用于开发过程中运行MapReduce程序,这也是最少使用的一个模式。
3. 伪分布模式中的注意点?
伪分布式(Pseudo)适用于开发和测试环境,在这个模式中,所有守护进程都在同一台机器上运行。
4. VM是否可以称为Pseudo?
不是,两个事物,同时Pseudo只针对Hadoop。
5. 全分布模式又有什么注意点?
全分布模式通常被用于生产环境,这里我们使用N台主机组成一个Hadoop集群,Hadoop守护进程运行在每台主机之上。这里会存在Namenode运行的主机,Datanode运行的主机,以及task tracker运行的主机。在分布式环境下,主节点和从节点会分开。
6. Hadoop是否遵循UNIX模式?
是的,在UNIX用例下,Hadoop还拥有“conf”目录。
7. Hadoop安装在什么目录下?
Cloudera和Apache使用相同的目录结构,Hadoop被安装在cd/usr/lib/hadoop-0.20/。
8. Namenode、Job tracker和task tracker的端口号是?
Namenode,70;Job tracker,30;Task tracker,60。
9. Hadoop的核心配置是什么?
Hadoop的核心配置通过两个xml文件来完成:1,hadoop-default.xml;2,hadoop-site.xml。这些文件都使用xml格式,因此每个xml中都有一些属性,包括名称和值,但是当下这些文件都已不复存在。
10. 那当下又该如何配置?
Hadoop现在拥有3个配置文件:1,core-site.xml;2,hdfs-site.xml;3,mapred-site.xml。这些文件都保存在conf/子目录下。
11. RAM的溢出因子是?
溢出因子(Spill factor)是临时文件中储存文件的大小,也就是Hadoop-temp目录。
12. fs.mapr.working.dir只是单一的目录?
fs.mapr.working.dir只是一个目录。
13. hdfs-site.xml的3个主要属性?
dfs.name.dir决定的是元数据存储的路径以及DFS的存储方式(磁盘或是远端)
dfs.data.dir决定的是数据存储的路径
fs.checkpoint.dir用于第二Namenode
14. 如何退出输入模式?
退出输入的方式有:1,按ESC;2,键入:q(如果你没有输入任何当下)或者键入:wq(如果你已经输入当下),并且按下Enter。
15. 当你输入hadoopfsck /造成“connection refused java exception’”时,系统究竟发生了什么?
这意味着Namenode没有运行在你的VM之上。
16. 我们使用Ubuntu及Cloudera,那么我们该去哪里下载Hadoop,或者是默认就与Ubuntu一起安装?
这个属于Hadoop的默认配置,你必须从Cloudera或者Edureka的dropbox下载,然后在你的系统上运行。当然,你也可以自己配置,但是你需要一个Linux box,Ubuntu或者是Red Hat。在Cloudera网站或者是Edureka的Dropbox中有安装步骤。
17. “jps”命令的用处?
这个命令可以检查Namenode、Datanode、Task Tracker、 Job Tracker是否正常工作。
18. 如何重启Namenode?
点击stop-all.sh,再点击start-all.sh。
键入sudo hdfs(Enter),su-hdfs (Enter),/etc/init.d/ha(Enter),及/etc/init.d/hadoop-0.20-namenode start(Enter)。
19. Fsck的全名?
全名是:File System Check。
20. 如何检查Namenode是否正常运行?
如果要检查Namenode是否正常工作,使用命令/etc/init.d/hadoop-0.20-namenode status或者就是简单的jps。
21. mapred.job.tracker命令的作用?
可以让你知道哪个节点是Job Tracker。
22. /etc /init.d命令的作用是?
/etc /init.d说明了守护进程(服务)的位置或状态,其实是LINUX特性,和Hadoop关系不大。
23. 如何在浏览器中查找Namenode?
如果你确实需要在浏览器中查找Namenode,你不再需要localhost:8021,Namenode的端口号是50070。
24. 如何从SU转到Cloudera?
从SU转到Cloudera只需要键入exit。
25. 启动和关闭命令会用到哪些文件?
Slaves及Masters。
26. Slaves由什么组成?
Slaves由主机的列表组成,每台1行,用于说明数据节点。
27. Masters由什么组成?
Masters同样是主机的列表组成,每台一行,用于说明第二Namenode服务器。
28. hadoop-env.sh是用于做什么的?
hadoop-env.sh提供了Hadoop中. JAVA_HOME的运行环境。
29. Master文件是否提供了多个入口?
是的你可以拥有多个Master文件接口。
30. hadoop-env.sh文件当下的位置?
hadoop-env.sh现在位于conf。
31. 在Hadoop_PID_DIR中,PID代表了什么?
PID代表了“Process ID”。
32. /var/hadoop/pids用于做什么?
/var/hadoop/pids用来存储PID。
33. hadoop-metrics.properties文件的作用是?
hadoop-metrics.properties被用做“Reporting”,控制Hadoop报告,初始状态是“not to report”。
34. Hadoop需求什么样的网络?
Hadoop核心使用Shell(SSH)来驱动从节点上的服务器进程,并在主节点和从节点之间使用password-less SSH连接。
35. 全分布式环境下为什么需求password-less SSH?
这主要因为集群中通信过于频繁,Job Tracker需要尽可能快的给Task Tracker发布任务。
36. 这会导致安全问题吗?
完全不用担心。Hadoop集群是完全隔离的,通常情况下无法从互联网进行操作。与众不同的配置,因此我们完全不需要在意这种级别的安全漏洞,比如说通过互联网侵入等等。Hadoop为机器之间的连接提供了一个相对安全的方式。
37. SSH工作的端口号是?
SSH工作的端口号是NO.22,当然可以通过它来配置,22是默认的端口号。
38. SSH中的注意点还包括?
SSH只是个安全的shell通信,可以把它当做NO.22上的一种协议,只需要配置一个密码就可以安全的访问。
39. 为什么SSH本地主机需要密码?
在SSH中使用密码主要是增加安全性,在某些情况下也根本不会设置密码通信。
40. 如果在SSH中添加key,是否还需要设置密码?
是的,即使在SSH中添加了key,还是需要设置密码。
41. 假如Namenode中没有数据会怎么样?
没有数据的Namenode就不能称之为Namenode,通常情况下,Namenode肯定会有数据。
42. 当Job Tracker宕掉时,Namenode会发生什么?
当Job Tracker失败时,集群仍然可以正常工作,只要Namenode没问题。
43. 是客户端还是Namenode决定输入的分片?
这并不是客户端决定的,在配置文件中以及决定分片细则。
44. 是否可以自行搭建Hadoop集群?
是的,只要对Hadoop环境足够熟悉,你完全可以这么做。
45. 是否可以在Windows上运行Hadoop?
你最好不要这么做,Red Hat Linux或者是Ubuntu才是Hadoop的最佳操作系统。在Hadoop安装中,Windows通常不会被使用,因为会出现各种各样的问题。因此,Windows绝对不是Hadoop的推荐系统。
英语原文:
Looking out for Hadoop Interview Questions that are frequently asked by employers? Here is the s list of Hadoop Interview Questions which covers setting up Hadoop Cluster…
Which are the three modes in which Hadoop can be run?
The three modes in which Hadoop can be run are:
1. standalone (local) mode
2. Pseudo-distributed mode
3. Fully distributed mode
What are the features of Stand alone (local) mode?
In stand-alone mode there are no daemons, everything runs on a single JVM. It has no DFS and utilizes the local file system. Stand-alone mode is suitable only for running MapReduce programs during development. It is one of the most least used environments.
What are the features of Pseudo mode?
Pseudo mode is used both for development and in the QA environment. In the Pseudo mode all the daemons run on the same machine.
Can we call VMs as pseudos?
No, VMs are not pseudos because VM is something different and pesudo is very specific to Hadoop.
What are the features of Fully Distributed mode?
Fully Distributed mode is used in the production environment, where we have ‘n’ number of machines forming a Hadoop cluster. Hadoop daemons run on a cluster of machines.
There is one host onto which Namenode is running and another host on which datanode is running and then there are machines on which task tracker is running. We have separate masters and separate slaves in this distribution.
Does Hadoop follows the UNIX pattern?
Yes, Hadoop closely follows the UNIX pattern. Hadoop also has the ‘conf‘ directory as in the case of UNIX.
In which directory Hadoop is installed?
Cloudera and Apache has the same directory structure. Hadoop is installed in cd/usr/lib/hadoop-0.20/.
What are the port numbers of Namenode, job tracker and task tracker?
The port number for Namenode is ’70′, for job tracker is ’30′ and for task tracker is ’60′.
What is the Hadoop-core configuration?
Hadoop core is configured by two xml files:
1. hadoop-default.xml which was renamed to 2. hadoop-site.xml.
These files are written in xml format. We have certain properties in these xml files, which consist of name and value. But these files do not exist now.
What are the Hadoop configuration files at present?
There are 3 configuration files in Hadoop:
1. core-site.xml
2. hdfs-site.xml
3. mapred-site.xml
These files are located in the conf/ subdirectory.
How to exit the Vi editor?
To exit the Vi Editor, press ESC and type :q and then press enter.
What is a spill factor with respect to the RAM?
Spill factor is the size after which your files move to the temp file. Hadoop-temp directory is used for this.
Is fs.mapr.working.dir a single directory?
Yes, fs.mapr.working.dir it is just one directory.
Which are the three main hdfs-site.xml properties?
The three main hdfs-site.xml properties are:
1. dfs.name.dir which gives you the location on which metadata will be stored and where DFS is located – on disk or onto the remote.
2. dfs.data.dir which gives you the location where the data is going to be stored.
3. fs.checkpoint.dir which is for secondary Namenode.
How to come out of the insert mode?
To come out of the insert mode, press ESC, type :q (if you have not written anything) OR type :wq (if you have written anything in the file) and then press ENTER.
What is Cloudera and why it is used?
Cloudera is the distribution of Hadoop. It is a user created on VM by default. Cloudera belongs to Apache and is used for data processing.
What happens if you get a ‘connection refused java exception’ when you type hadoopfsck /?
It could mean that the Namenode is not working on your VM.
We are using Ubuntu operating system with Cloudera, but from where we can download Hadoop or does it come by default with Ubuntu?
This is a default configuration of Hadoop that you have to download from Cloudera or from Edureka’s dropbox and the run it on your systems. You can also proceed with your own configuration but you need a Linux box, be it Ubuntu or Red hat. There are installation steps present at the Cloudera location or in Edureka’s Drop box. You can go either ways.
What does ‘jps’ command do?
This command checks whether your Namenode, datanode, task tracker, job tracker, etc are working or not.
How can I restart Namenode?
1. Click on stop-all.sh and then click on start-all.sh OR
2. Write sudo hdfs (press enter), su-hdfs (press enter), /etc/init.d/ha (press enter) and then /etc/init.d/hadoop-0.20-namenode start (press enter).
What is the full form of fsck?
Full form of fsck is File System Check.
How can we check whether Namenode is working or not?
To check whether Namenode is working or not, use the command /etc/init.d/hadoop-0.20-namenode status or as simple as jps.
What does the command mapred.job.tracker do?
The command mapred.job.tracker lists out which of your nodes is acting as a job tracker.
What does /etc /init.d do?
/etc /init.d specifies where daemons (services) are placed or to see the status of these daemons. It is very LINUX specific, and nothing to do with Hadoop.
How can we look for the Namenode in the browser?
If you have to look for Namenode in the browser, you don’t have to give localhost:8021, the port number to look for Namenode in the brower is 50070.
How to change from SU to Cloudera?
To change from SU to Cloudera just type exit.
Which files are used by the startup and shutdown commands?
Slaves and Masters are used by the startup and the shutdown commands.
What do slaves consist of?
Slaves consist of a list of hosts, one per line, that host datanode and task tracker servers.
What do masters consist of?
Masters contain a list of hosts, one per line, that are to host secondary namenode servers.
What does hadoop-env.sh do?
hadoop-env.sh provides the environment for Hadoop to run. JAVA_HOME is set over here.
Can we have multiple entries in the master files?
Yes, we can have multiple entries in the Master files.
Where is hadoop-env.sh file present?
hadoop-env.sh file is present in the conf location.
In Hadoop_PID_DIR, what does PID stands for?
PID stands for ‘Process ID’.
What does /var/hadoop/pids do?
It stores the PID.
What does hadoop-metrics.properties file do?
hadoop-metrics.properties is used for ‘Reporting‘ purposes. It controls the reporting for Hadoop. The default status is ‘not to report‘.
What are the network requirements for Hadoop?
The Hadoop core uses Shell (SSH) to launch the server processes on the slave nodes. It requires password-less SSH connection between the master and all the slaves and the secondary machines.
Why do we need a password-less SSH in Fully Distributed environment?
We need a password-less SSH in a Fully-Distributed environment because when the cluster is LIVE and running in Fully Distributed environment, the communication is too frequent. The job tracker should be able to send a task to task tracker quickly.
Does this lead to security issues?
No, not at all. Hadoop cluster is an isolated cluster. And generally it has nothing to do with an internet. It has a different kind of a configuration. We needn’t worry about that kind of a security breach, for instance, someone hacking through the internet, and so on. Hadoop has a very secured way to connect to other machines to fetch and to process data.
On which port does SSH work?
SSH works on Port No. 22, though it can be configured. 22 is the default Port number.
Can you tell us more about SSH?
SSH is nothing but a secure shell communication, it is a kind of a protocol that works on a Port No. 22, and when you do an SSH, what you really require is a password.
Why password is needed in SSH localhost?
Password is required in SSH for security and in a situation where passwordless communication is not set.
Do we need to give a password, even if the key is added in SSH?
Yes, password is still required even if the key is added in SSH.
What if a Namenode has no data?
If a Namenode has no data it is not a Namenode. Practically, Namenode will have some data.
What happens to job tracker when Namenode is down?
When Namenode is down, your cluster is OFF, this is because Namenode is the single point of failure in HDFS.
What happens to a Namenode, when job tracker is down?
When a job tracker is down, it will not be functional but Namenode will be present. So, cluster is accessible if Namenode is working, even if the job tracker is not working.
Can you give us some more details about SSH communication between Masters and the Slaves?
SSH is a password-less secure communication where data packets are sent across the slave. It has some format into which data is sent across. SSH is not only between masters and slaves but also between two hosts.
What is formatting of the DFS?
Just like we do for Windows, DFS is formatted for proper structuring. It is not usually done as it formats the Namenode too.
Does the HDFS client decide the input split or Namenode?
No, the Client does not decide. It is already specified in one of the configurations through which input split is already configured.
In Cloudera there is already a cluster, but if I want to form a cluster on Ubuntu can we do it?
Yes, you can go ahead with this! There are installation steps for creating a new cluster. You can uninstall your present cluster and install the new cluster.
Can we create a Hadoop cluster from scratch?
Yes we can do that also once we are familiar with the Hadoop environment.
Can we use Windows for Hadoop?
Actually, Red Hat Linux or Ubuntu are the best Operating Systems for Hadoop. Windows is not used frequently for installing Hadoop as there are many support problems attached with Windows. Thus, Windows is not a preferred environment for Hadoop.
via:csdn
转至:36大数据