1. Big Data Cluster Environment Preparation

1. Three virtual machines turn off the firewall

Execute the following commands on three machines (executed by the root user)

service iptables stop

chkconfig iptables off

share picture

2, three machines close selinux

vim /etc/selinux/config

share picture

3. Change the host name of three machines

vim /etc/sysconfig/network

Share a picture

Share a picture

share picture

4. Three machines do the mapping between host name and IP address

vim /etc/hosts

192.168.221.100 node01.hadoop.com node01

192.168.221.110 node02.hadoop.com node02

192.168.221.120 node03.hadoop.com node03

Share pictures

5. Three machines restart

reboot -h now

6. Password-free login for three machines

The first step: three machines generate public keys and Private key

Execute the following commands on three machines to generate public and private keys

ssh-keygen -t rsa

Execute the After the command, press three enters.

share picture< /p>

Step 2: Copy the public key to the same machine

Three machines will copy the public key to the first machine

Three machines execute commands:

ssh-copy-id node01.hadoop.com

share Picture

Step 3: Copy the certification of the first machine to other machines

Copy the public key of the first machine to other machines

Point to the following command on the machine on the first day

scp /root/.ssh /authorized_keys node02.hadoop.com:/root/.ssh

scp /root/.ssh/authorized_keys node03.hadoop. com:/root/.ssh

share picture

7. Clock synchronization of three machines

The first synchronization method: clock synchronization through the network

Clock synchronization through the network connection to the external network must be guaranteed The virtual machine is connected to the Internet

ntpdate us.pool.ntp.org;

Alibaba Cloud clock synchronization server

ntpdate ntp4.aliyun.com

Timed tasks for three machines

crontab -e

* /1 * * * * /usr/sbin/ntpdate us.pool.ntp.org;

Or directly synchronize the clock with the Alibaba Cloud server

crontab -e

*/1 * * * * /usr/sbin/ntpdate ntp4.aliyun.com;

The second way of clock synchronization: synchronize through a machine

Clock synchronization is based on the time of the server 192.168.221.100

Step: Determine whether the ntpd service is installed

rpm -qa | grep ntpd

share picture

If it is not installed, you can install it online

yum- y install ntpd

Start the ntpd service

service ntpd start

Set the ntpd service to start

< p class="a">chkconfig ntpd on

Step 2: Edit /etc/ntp.conf

Edit /etc/ntp on the first machine. conf

vim /etc/ntp.conf

Add the following content to the file

restrict 192.168 .221.0 mask 255.255.255.0 nomodify notrap

Comment the four lines of content

#server 0.centos.pool.ntp.org

#server 1.centos.pool.ntp.org

#server 2.centos.pool.ntp.org

#server 3.centos.pool.ntp.org

Remove the comments for the following content. If there are no comments on these two lines, add them yourself

p>

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

Share pictures

Configure the following to ensure that the BIOS is synchronized with the system time

p>

vim /etc/sysconfig/ntpd

Add a line of content

SYNC_HWLOCK=yes

Share Picture

Step 3: Synchronize the time of the other two machines with the first machine

The other two machines synchronize their clocks with 192.168.221.100

crontab -e

*/1 * * * * /usr /sbin/ntpdate 192.168.221.100

192.168.221.100 node01.hadoop.com node01

192.168.221.110 node02.hadoop.com node02

192.168.221.120 node03.hadoop.com node03

reboot -h now

6. Password-free login for three machines

The first step: Three machines generate public and private keys

Execute the following commands on three machines to generate public and private keys

ssh-keygen -t rsa

After executing the command, press three Just take the car

share picture

< p>

*/1 * * * * /usr/sbin/ntpdate us.pool.ntp.org;

*/1 * * * * /usr/sbin/ntpdate ntp4.aliyun.com;

chkconfig ntpd on

< p>

restrict 192.168.221.0 mask 255.255.255.0 nomodify notrap

#server 0.centos.pool.ntp.org

#server 1.centos.pool.ntp.org

#ser ver 2.centos.pool.ntp.org

#server 3.centos.pool.ntp.org

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

share picture

Configure the following to ensure that the BIOS is synchronized with the system time

vim /etc/sysconfig/ntpd

Add a line of content

SYNC_HWLOCK=yes

Share a picture

Step 3: Time synchronization of the other two machines with the first machine

The other two machines are with 192.168. 221.100 for clock synchronization

crontab -e

*/1 * * * * /usr/sbin/ntpdate 192.168.221.100

*/1 * * * * /usr/sbin/ntpdate 192.168.221.100

Leave a Comment

Your email address will not be published.