利用云服务器搭建hadoop集群
测试连接
有一台腾讯云的服务器,最近有买了两台百度云的,打算搭建一个集群,从零开始记录一下.
测试连接:
百度云之间互ping在1ms左右,可惜太穷了买不起,只能把一台成都的和两台保定的串起来,凑合着用吧.
一. Linux配置
- 关闭防火墙和selinux
#关闭防火墙 service iptables stop chkconfig iptables off #关闭selinux vim /etc/selinux/config #设置为disabled SELINUX=disabled
#查看防火墙状态
service iptables status
#关闭防火墙
service iptables stop
#查看防火墙开机启动状态 chkconfig iptables --list
#关闭防火墙开机启动
chkconfig iptables off
- 百度云分配的名字太麻烦了,为方便操作修改主机名,但是遇到了一些问题,详细请点击 Linux修改hostname的几种方式:
2.域名映射并测试#百度云 修改后,重启(reboot -h)永久生效 vi /etc/sysconfig/network #第2台 将hostname改为node01 HOSTNAME=node01 #第2台 将hostname改为node01 HOSTNAME=node03 #腾讯云 可能我装的不是原版的,出来的居然是这个鬼东西 # Created by cloud-init on instance boot automatically, do not edit. #在下面添加一行 NETWORKING=yes HOSTNAME=node02 然后使用: vi /etc/hostname node02 #reboot -h 重启后生效了
/etc/hosts 文件用于在通过主机名进行访问时做 ip 地址解析之用。
所以,你想访问一个什么样的主机名,就需要把这个主机名和它对应的 ip 地址. 配置在/etc/hosts 文件中.
重启服务器#三台服务器进行域名映射操作 vim /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 #172.16.0.4 instance-mv524v7d instance-mv524v7d.novalocal #添加以下配置,前面为你服务器的ip 192.168.221.100 node01 192.168.221.110 node02 192.168.221.120 node03 # 测试腾讯云与百度云 互ping: root@node02 etc# ping node01 PING node01 (106.13.你的ip.你的ip) 56(84) bytes of data. 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=1 ttl=48 time=60.1 ms 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=2 ttl=48 time=59.6 ms 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=3 ttl=48 time=59.7 ms [root@node01 ~]# ping node02 PING node02 (132.232.你的ip.你的ip) 56(84) bytes of data. 64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=1 ttl=49 time=60.1 ms 64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=2 ttl=49 time=59.6 ms 64 bytes from node02 (132.232.你的ip.你的ip): icmp_seq=3 ttl=49 time=59.6 ms [root@node03 ~]# ping node01 PING node01 (106.13.你的ip.你的ip) 56(84) bytes of data. 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=1 ttl=59 time=1.29 ms 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=2 ttl=59 time=0.526 ms 64 bytes from node01 (106.13.你的ip.你的ip): icmp_seq=3 ttl=59 time=0.570 ms
二. 3台服务器免密码登录
1. 三台机器生成公钥与私钥:
[root@node03 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): #回车
Enter passphrase (empty for no passphrase): #回车
Enter same passphrase again: #回车
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
35:8f:46:e1:19:d1:91:20:44:01:cb:6c:58:bd:4f:85 root@node03
The key's randomart image is:
+--[ RSA 2048]----+
| o==.==.o |
| = ..oE++ |
| . = .*. |
| . .o.+ |
| Soo . |
| .. |
| |
| |
| |
+-----------------+
2. 拷贝公钥到同一台机器
[root@node03 ~]# ssh-copy-id node01
The authenticity of host 'node01 (106.13.55.197)' can't be established.
RSA key fingerprint is 7c:70:21:11:f4:64:f4:2a:db:db:f9:42:65:63:9b:c6.
Are you sure you want to continue connecting (yes/no)? yes #输入yes
Warning: Permanently added 'node01,106.13.55.197' (RSA) to the list of known hosts.
root@node01's password: #输入第一台服务器的密码
Now try logging into the machine, with "ssh 'node01'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
3. 复制第一台机器的认证到其他机器
#根据提示,输入yes,和服务器的登陆密码
scp /root/.ssh/authorized_keys node02:/root/.ssh/
scp /root/.ssh/authorized_keys node03:/root/.ssh/
4. 通过网络时钟同步;
#设置定时任务
[root@node01 ~]# crontab -e
#添加阿里云时钟同步定时任务
*/1 * * * * /usr/sbin/ntpdate ntp4.aliyun.com;
三.基础环境安装
这里安装cdh5.14.0版本
1. 安装jdk
#查看自带的openjdk
[root@node01 ~]# rpm -qa | grep java
#如果有就卸载
[root@node01 ~]# rpm -e jdk的名称
#创建两个约定俗称的文件夹,来进行我们的软件包的存放和软件的安装
所有软件的安装路径
/usr/local
所有软件压缩包的存放路径
mkdir -p /usr/local/software
#上传jdk到software目录,并解压
root@node02 ~# tar -zxvf jdk-8u181-linux-x64.tar.gz -C /usr/local/java
#配置java环境变量,在文档末尾追加
vim /etc/profile
#配置java环境变量
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export PATH=:$JAVA_HOME/bin:$PATH
#编译
source /etc/profile
#测试
[root@node01 software]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
表示安装成功
2. 安装zookeeper
55
- 项目
- 项目
- 项目
- 项目
12312
一个简单的表格是这么创建的:
项目 | Value |
---|---|
电脑 | $1600 |
手机 | $12 |
导管 | $1 |
312
SmartyPants将ASCII标点字符转换为“智能”印刷标点HTML实体。例如:
TYPE | ASCII | HTML |
---|---|---|
Single backticks | 'Isn't this fun?' | ‘Isn’t this fun?’ |
Quotes | "Isn't this fun?" | “Isn’t this fun?” |
Dashes | -- is en-dash, --- is em-dash | – is en-dash, — is em-dash |
132
-
Markdown
- Text-to- HTML conversion tool Authors
- John
- Luke
312
一个具有注脚的文本。1
312
Markdown将文本转换为 HTML。
123
您可以使用渲染LaTeX数学表达式 KaTeX:
Gamma公式展示 Γ ( n ) = ( n − 1 ) ! ∀ n ∈ N \Gamma(n) = (n-1)!\quad\forall n\in\mathbb N Γ(n)=(n−1)!∀n∈N 是通过欧拉积分
Γ ( z ) = ∫ 0 ∞ t z − 1 e − t d t   . \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. Γ(z)=∫0∞tz−1e−tdt.
你可以找到更多关于的信息 LaTeX 数学表达式[here][1].
312
- 关于 甘特图 语法,参考 [这儿][2],
3123
可以使用UML图表进行渲染。 Mermaid. 例如下面产生的一个序列图::
这将产生一个流程图。:
- 关于 Mermaid 语法,参考 [这儿][3],
312312
我们依旧会支持flowchart的流程图:
321入
312321
如果你想尝试使用此编辑器, 你可以在此篇文章任意编辑。当你完成了一篇文章的写作, 在上方工具栏找到 文章导出 ,生成一个.md文件或者.html文件进行本地保存。
1231
如果你想加载一篇你写过的.md文件或者.html文件,在上方工具栏可以选择导入功能进行对应扩展名的文件导入,
继续你的创作。
注脚的解释 ↩︎