搭建Spark集群系列之2------搭建环境

1 配置集群我们还要将服务器防火墙关闭,在CentOS中6.5和7版本的命令行是不一样的,由于使用的是CentOS7.6,网上搜了一下命令先将防火墙关闭.

CentOS 7.0默认使用的是firewall作为防火墙。


firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

[root@localhost ~]#firewall-cmd --state

not running

 检查防火墙的状态:

从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig。

[root@localhost ~]#systemctl list-unit-files|grep firewalld.service            --防火墙处于关闭状态

firewalld.service                          disabled

   关闭防火墙:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

[root@localhost ~]#systemctl stop firewalld.service

[root@localhost ~]#systemctl disable firewalld.service
启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

查看已启动的服务列表:systemctl list-unit-files|grep enabled

------------------------------------------------------------------------------------------------------------------------------------------

以上是分割线,网上找到了系统的CentOS搭建指南,但是版本是OS6,OS7和6还是有一定区别的, 决定按照6的路子搭建环境,但指令什么的有所修改..OS6指南如下https://blog.csdn.net/weixin_41366941/article/details/80614945

一 、修改集群名字 和6有所不同

指令如下

#查看当前主机名称
hostname
#修改主机名称
hostnamectl set-hostname ***
#重启
reboot

三、配置SSH

3.3节 生成私钥和公钥:在三个节点中使用如下命令生成私钥和公钥 代码勘误

并且需要注意,链接SSH的时候 有个yes or no 记得不要按回车 输入yes验证

#  ssh-keygen -t rsa #执行该命令后,遇到提示信息,一直按Enter键就可以

四 安装jdk勘误

source /etc/profile

 

五 安装Hadoop勘误

修改hadoop路径下的/etc/hadoop下的core-site.xml、hdfs-site.xml、mapreduce-site.xml、yarn-site.xml、slaves五个文件     

 这里需要注意 使用mv更改了hadoop-2.X.X 为 hadoop后 需要cd 进入 hadoop文件夹下的 etc更改文件

修改mapreduce-site.xml 

这里需要注意 多打了一个字符 mapred-site.xml ,并且只有mapred-site.xml.templete,需要复制然后更改文件名完成操作.

修改slaves文件

把LocalHost去了改为这个

Master
slave1
slave2

HDFS 初始化 勘误 # hdfs dfs namenode -format #这里错了 首次启动需要格式化主节点上的名称节点

需要进入 cd opt/app/hadoop/bin文件夹下执行HDFS初始化命令 ,执行初始化的的时候,可能会显示JAVA-Home报错

解决方法如下https://blog.csdn.net/dianzishijian/article/details/52094569

#首先
 ./hadoop  namenode  -format


start-dfs.sh
start-yarn.sh
'''
或者是进入到hserver1这台机器的/opt/hadoop/hadoop-2.8.0/sbin目录,也就是执行命令:

cd    /opt/hadoop/hadoop-2.8.0/sbin

  执行初始化脚本,也就是执行命令:

 ./start-all.sh

'''

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值