This week, I wrote and read the source code and design pattern of the thread pool, but I think I still have a few middlewares to learn, so I plan to build this Linux service environment first. Later, we will build clusters and big data using this environment.
Install Linux first
My machine is windows, so I need a Vm Ware, please refer to the installation tutorial: https://zhuanlan.zhihu.com/p/272541376 . This tutorial is very detailed. Next we need an image of the operating system, search for Centos in the search engine
Just go in and choose the first one.
Then click Next, go to the time zone and select Shanghai. To set the username, we enter bigdata01.
Lay out the network
- Enter the command hostname in the terminal to view the host name
- set hostname: hostnamectl set-hostname bigdata01
The gateway is uniformly set to 192.168.2.1, and the cluster is built later, and the assigned IP is
- 192.168.2.128 bigdata01
- 192.168.2.129 bigdata02
- 192.168.2.130 bigdata03
- Enter halt in the terminal to shut down
Then enter the Linux terminal, let's configure the network.
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33
将BOOTPROTO改为static
ONBOOT由no改为yes
新加配置
IPADDR=192.168.2.128
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114.114
DNS2=8.8.8.8
vi /etc/hosts 改下主机名 追加配置 192.168.2.128 bigdata01
service NetworkManager stop
/etc/init.d/network restart
chkconfig NetworkManager off
vi /etc/resolv.conf 追加 nameserver=192.168.2.1
systemctl restart network
然后ping www.baidu.com 这台虚拟机就能连互联网了
然后就可以通过XShell 连接虚拟机了
Install the necessary software on the server
# 时间同步
yum -y install npt ntpdate
ntpdate cn.pool.ntp.org
hwclock --systoch
yum install lrzsz
wget https://repo.huaweicloud.com/java/jdk/8u151-b12/jdk-8u151-linux-x64.rpm
rpm -ivh jdk-8u151-linux-x64.rpm
# 配置环境变量
vi /etc/profile
# 追加下面这样
export JAVA_HOME=/usr/java/jdk1.8.0_151
export CLASSPATH=$JAVA_HOMT\lib:$CLASSPATH
export PATH=$JAVA_HOME\bin:$PATH
source /etc/profile
What about the good group? It's too troublesome to have to do this once for each one, isn't it? VM Ware has a copy function, we can copy it. Shut down before copying.
Then select the file storage location. The cloned one also needs to change the network configuration, hostname, and domain name mapping. The command is as follows:
# 设置hostname:
hostnamectl set-hostname bigdata01
cd /etc/sysconfig/network-scripts/
vi ifcfg-ens33
将BOOTPROTO改为static
ONBOOT由no改为yes
新加配置
IPADDR=192.168.2.128
GATEWAY=192.168.2.1
BROADCAST=192.168.2.255
DNS1=114.114.114.114
DNS2=8.8.8.8
vi /etc/hosts 改下主机名 追加配置 192.168.2.128 bigdata01 192.168.2.129 bigdata02
# 记得bigdata01的主机也加下映射
service NetworkManager stop
/etc/init.d/network restart
chkconfig NetworkManager off
vi /etc/resolv.conf 追加 nameserver=192.168.2.1
systemctl restart network
然后这台虚拟机就能连互联网了
然后就可以通过XShell 连接虚拟机了
At this point, our cluster is basically set up.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。