Linux cluster deployment
7 clusters (three)
The first step: In three instances of a virtual machine host virtual machine (Explanation: Clone three virtual machines)
to change the mac address of the new system: The second step
to change this file: vim /etc/udev/rules.d/70- persistent-net.rules
third step: change the card information
to change the file:
Three machines turn off the firewall
View the status of the firewall service iptables status
start the Firewall service service iptables start
to restart the firewall service service iptables restart
to stop the firewall service iptables stop service
completely turn off the firewall chkconfig iptables off
Three machine off selinux
Change the file: vim / etc / selinux / config
Three machines change the hostname
Change the three machines of this file: vim / etc / sysconfig / network
first:
second stage:
Third stage:
Note: restart to take effect
Configure the mapping between host names and IP
更改此文件:vi /etc/hosts
添加如下内容
192.168.100.131(第一台机器IP) node01 (第一台机器名称)
192.168.100.132 第二台机器IP) node02(第二台机器名称)
192.168.100.133 第三台机器IP) node03(第三台机器名称)
scp 远程文件拷贝
scp是 remote file copy program 的缩写, scp是远程文件拷贝命令。
语法格式
文件传输:
格式一:scp /export/aaa/[email protected]:/export
格式二:
scp /export/aaa/02.txt root@hadoop02:/export
格式三:
scp /export/aaa/02.txt hadoop02:/export
文件夹传输:
#拷贝目录 scp -r local_folder remote_username@remote_ip:remote_folder
配置多节点无密码登录(ssh远程登录)
第一步:先给三台机器生成密匙
三台机器都操作:ssh-keygen + 三个回车
会再root用户的家生成:三个文件
authorized_keys :表示哪些节点可以使用相应的密钥免密登录到本机(实际上是公钥的集合)
id_rsa : 当前节点的私钥
id_rsa.pub : 当前节点的公钥
第二步:免密登录,让谁可以访问
免密登录node01 ssh-copy-id node01(机器名称) (需要输入node01的密码)
免密登录node02 ssh-copy-id node02(机器名称) (需要输入node02的密码)
免密登录node03 ssh-copy-id node03(机器名称) (需要输入node03的密码)
定时任务:a
命令:crontb -e/编辑 -l 查看 -r 删除定时任务
* 一小时内的第一分钟(0-59)
* 一天内的第一个小时(0-23)
* 一个月内的第几天(1-31)
* 一年内第几个月(1-12)
* 星期几(0-7)
跟局域网某台机器同步时间
先确定时间同步服务器: node01 (node02 node03 都去node01同步时间)
服务器设置
1、确保时间服务器的ntpd服务是开启的
2、修改第一个配置文件
vi /etc/ntp.conf
添加如下内容
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 # localclock
fudge 127.127.1.0 stratum 10
注释掉如下内容
#server0.centos.pool.ntp.org
#server1.centos.pool.ntp.org
#server2.centos.pool.ntp.org
#server3.centos.pool.ntp.org
3, modify second profile
vi /etc/sysconfig/ntpd
Add the following
SYNC_HWLOCK=yes
4, restart the ntpd
service ntpd restart
5, the node performs synchronization on node02 node03
ntpdate node01