当前位置: 首页 > wzjs >正文

做行业b2b网站前景黄页污水

做行业b2b网站前景,黄页污水,wordpress 字号,化妆品应如何网站建设定位【Hadoop】伪分布式安装 什么是 Hadoop 伪分布式安装? Hadoop 伪分布式安装(Pseudo-Distributed Mode) 是一种在单台机器上模拟分布式集群环境的部署方式。它是介于 本地模式(Local Mode) 和 完全分布式模式&#xf…

【Hadoop】伪分布式安装

什么是 Hadoop 伪分布式安装?

Hadoop 伪分布式安装(Pseudo-Distributed Mode) 是一种在单台机器上模拟分布式集群环境的部署方式。它是介于 本地模式(Local Mode)完全分布式模式(Fully Distributed Mode) 之间的一种配置,主要用于学习、开发和测试 Hadoop 的核心功能,而无需多台物理机器。

  1. 单机模拟多节点
    • 所有 Hadoop 组件(如 NameNode、DataNode、ResourceManager、NodeManager 等)都运行在同一台机器上。
    • 每个组件以独立的 Java 进程运行,模拟多节点行为。
  2. 与本地模式的区别
    • 本地模式(Local Mode):直接使用本地文件系统,无分布式特性(无 HDFS,无 YARN)。
    • 伪分布式模式:使用 HDFS 和 YARN,但所有服务集中在单机。
  3. 与完全分布式的区别
    • 完全分布式模式:服务分布在多台机器,适合生产环境。
    • 伪分布式模式:仅用于单机测试,性能和生产环境不同。

伪分布式安装核心步骤(以 hadoop-3.1.1 为例)

用户权限准备

建议创建专用用户(如hadoop)进行部署,避免使用root用户:

useradd hadoop	#使用 root 用户进行创建用户 hadoop
passwd hadoop	#设置 hadoop 用户密码
chown -R hadoop:hadoop hadoop-3.1.1/  # 设置权限
su - hadoop	#切换到 hadoop 用户,配置完环境变量再切换

安装JDK

环境变量

[root@localhost module]# vim /etc/profile.d/my_env.sh #JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_221
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:wq[root@localhost module]# source /etc/profile
[root@localhost module]# java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
[root@localhost module]# 

配置本地免密码登录(Hadoop 服务启动依赖)

# 生成 SSH 密钥对(一路回车,不设密码)
ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa# 将公钥添加到本地授权列表
mkdir -p ~/.ssh
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys# 设置文件权限(关键!否则 SSH 可能拒绝登录)
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh# 测试免密登录(应直接进入,无需密码)
ssh localhost
exit  # 退出 SSH 会话

下载并安装 Hadoop

下载 Hadoop

从官网下载稳定版(如hadoop-3.1.1.tar.gz),解压到指定目录:

[root@localhost module]# pwd
/opt/module
[root@localhost module]# ll
总用量 742452
drwxr-xr-x. 11 hadoop hadoop       178 515 17:43 hadoop-3.1.1
-rw-r--r--.  1 root   root   334559382 515 16:50 hadoop-3.1.1.tar.gz
drwxr-xr-x.  7     10    143       245 74 2019 jdk1.8.0_221
-rw-r--r--.  1 root   root   195094741 515 16:50 jdk-8u221-linux-x64.tar.gz
drwxr-xr-x. 16 root   root        4096 62 2017 pig-0.17.0
-rw-r--r--.  1 root   root   230606579 515 16:50 pig-0.17.0.tar.gz
[root@localhost module]# tar -zxvf hadoop-3.1.1.tar.gz

配置环境变量

[root@localhost module]# cat /etc/profile.d/my_env.sh #JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_221
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport HADOOP_HOME=/opt/module/hadoop-3.1.1
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin

配置 Hadoop 核心文件

Hadoop 通过 XML 文件配置,需修改以下 4 个文件(路径:$HADOOP_HOME/etc/hadoop/)。

core-site.xml

配置 HDFS 的默认地址和临时目录:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><property><name>fs.defaultFS</name><value>hdfs://localhost:9000</value>  # HDFS默认地址(伪分布式)</property><property><name>hadoop.tmp.dir</name><value>/opt/module/hadoop-3.1.1/hadooptmp</value>  # 临时文件存储路径(需手动创建)</property>
</configuration>
hdfs-site.xml

配置 HDFS 副本数(伪分布式下设为 1,因只有一个 DataNode):

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><property><name>dfs.replication</name><value>1</value></property>
</configuration>
mapred-site.xml

配置 MapReduce 框架使用 YARN:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><!-- Put site-specific property overrides in this file. --><configuration><property><name>mapreduce.framework.name</name><value>yarn</value></property>
</configuration>
yarn-site.xml

配置 YARN 的 ResourceManager 地址和 NodeManager 的环境变量:

<?xml version="1.0"?>
<!--Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License. See accompanying LICENSE file.
--><configuration><property><name>yarn.resourcemanager.hostname</name><value>localhost</value></property><property><name>yarn.nodemanager.aux-services</name><value>mapreduce_shuffle</value></property>
</configuration>

初始化 HDFS 文件系统

格式化 NameNode(首次启动必做,且仅需执行一次):

# 格式化 NameNode(首次启动必做,且仅需执行一次)
hdfs namenode -format

启动服务

# 启动HDFS(NameNode、DataNode)
start-dfs.sh
# 启动YARN(ResourceManager、NodeManager)
start-yarn.sh[hadoop@localhost hadooptmp]$ start-dfs.sh
Starting namenodes on [localhost]
Starting datanodes
Starting secondary namenodes [localhost.localdomain]
[hadoop@localhost hadooptmp]$ start-yarn.sh
Starting resourcemanager
Starting nodemanagers

JPS 验证

[hadoop@localhost hadooptmp]$ jps  
17361 SecondaryNameNode
17697 NodeManager
17575 ResourceManager
18008 Jps
17182 DataNode
17039 NameNode

访问 Web 界面

  • HDFS状态:http://192.168.0.102:9870/(Hadoop 3.x 端口)
  • YARN 资源管理:http://192.168.0.102:8088
  • 如果访问不了请关闭防火墙再进行访问
systemctl stop firewalld	#关闭防火墙
systemctl disable firewall	#关闭开机自启

在这里插入图片描述

简单操作测试

[hadoop@localhost hadooptmp]$ hdfs dfs -mkdir -p /user/hadoop
[hadoop@localhost hadooptmp]$ hdfs dfs -put /etc/profile /user/hadoop
[hadoop@localhost hadooptmp]$ hdfs dfs -ls /user/hadoop

在这里插入图片描述

伪分布式 vs 完全分布式 vs 单机模式

模式节点数组件部署用途
单机模式1仅运行非分布式进程(无守护进程)快速验证程序逻辑(无分布式功能)
伪分布式1所有分布式组件运行在同一节点学习、调试、本地测试
完全分布式≥2各组件分布在不同节点(主从架构)生产环境大规模数据处理

常见问题与注意事项

端口冲突:若 9000、8088 等端口被占用,需修改配置文件中的端口号(如fs.defaultFS改为hdfs://localhost:9001)。

权限问题:避免用sudo启动服务(可能导致文件权限混乱),建议用普通用户操作,或提前设置目录权限:

chown -R $USER:$USER /opt/module/hadoop-3.1.1/ # 赋予当前用户目录所有权, USER 如给 hadoop用户 chown -R hadoop:hadoop /opt/module/hadoop-3.1.1/

日志排查:启动失败时,查看 H A D O O P H O M E / l o g s / 下的日志文件(如 h a d o o p − HADOOP_HOME/logs/下的日志文件(如hadoop- HADOOPHOME/logs/下的日志文件(如hadoop{USER}-namenode-${HOSTNAME}.log)。

关闭服务:用stop-dfs.sh和stop-yarn.sh正常停止,避免直接 kill 进程导致数据不一致。

若还有问题,停止服务,删除压缩包重新来一遍。

http://www.dtcms.com/wzjs/258203.html

相关文章:

  • 遂宁市城市建设档案馆网站哈尔滨电话本黄页
  • 重庆市建设和交通委员会网站seo自动刷外链工具
  • 定做网站多少钱郑州品牌网站建设
  • 贸易型企业网站建设长春免费网上推广
  • 哪家微信网站建设好重庆网站seo搜索引擎优化
  • wordpress百度小程序深圳搜索seo优化排名
  • 新开发的网站怎么做测试seo是什么地方
  • wordpress 回复楼层重庆seo小z博客
  • 网站平台优化萝卜建站
  • 做网站需要美工吗排名网站
  • 网站建设和托管哪家好万网域名续费
  • 后台网站开发文档新闻今天最新消息
  • 做的网站手机打不开怎么办网站流量查询服务平台
  • 网站开发验收报告模板app注册拉新平台
  • 专门做汽车配件的网站网络营销培训课程
  • 手机百度上海seo公司排名
  • 2023网络舆情案例分析公司搜索seo
  • 在哪里可以学做饰品网站百度文库首页
  • 建设企业网站官网u盾登录宁波seo怎么做推广渠道
  • 房产网站建设接单企业网络推广的方式有哪些
  • 做任务得得q币的网站百度软件开放平台
  • 网站内页301重定向怎么做微信营销方法
  • 山东营销网站建设设计长沙谷歌seo
  • 百度做网站和推广效果怎么样云和数据培训机构怎么样
  • 宁波网站开发制作搜索引擎排名国内
  • 武汉最好的网站建设公司哪家好手机网络优化软件
  • 快乐建站网懂得网站推广
  • 网站ssl证书怎么做seo快速排名首页
  • 纺织品东莞网站建设免费引流推广的方法
  • 如何快速开发手机app麒麟seo