一 生产环境集群模式部署,需要多台主机,主机之间通过密钥相互访问.
1 配置如图
节点名字 | 节点IP | 系统版本 | ||
master11 | 192.168.50.11 | centos 8.5 | ||
slave12 | 192.168.50.12 | centos 8.5 | ||
slave13 | 192.168.50.13 | centos 8.5 |
2 安装服务器
#先安装一台master11,具体可以参考
VMware Workstation 虚拟机安装
#安装jdk
tar zxvf jdk-8u191-linux-x64.tar.gz
mv jdk1.8.0_191/ /usr/local/jdkvim /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH
source /etc/profile
#查看版本
[root@localhost soft]# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
#关闭master11
3克隆虚拟机
#通过master11,克隆出slave12,slave13
#同样方式克隆slave13
#修改IP地址
启动slave2
vim /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.50.12
PREFIX=24
GATEWAY=192.168.50.1
DNS1=192.168.50.1
IPV6_PRIVACY=no
#重新启动
reboot
启动slave3
vim /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens160
DEVICE=ens160
ONBOOT=yes
IPADDR=192.168.50.13
PREFIX=24
GATEWAY=192.168.50.1
DNS1=192.168.50.1
IPV6_PRIVACY=no
#重新启动
reboot
4 配置服务器名称和hosts
#master11
hostnamectl set-hostname master11
vim /etc/hosts
192.168.50.11 master11
192.168.50.12 slave12
192.168.50.13 slave13
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#slave12
hostnamectl set-hostname slave12
vim /etc/hosts
192.168.50.11 master11
192.168.50.12 slave12
192.168.50.13 slave13
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
#slave13
hostnamectl set-hostname slave13
vim /etc/hosts
192.168.50.11 master11
192.168.50.12 slave12
192.168.50.13 slave13
#关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
5配置ssh免密码登录
#master11
#直接回车确认
ssh-keygen -t rsa
#拷贝密钥
ssh-copy-id master11
ssh-copy-id slave12
ssh-copy-id slave13
# 测试一下
基础运行环境已完成,下一篇 ,正式部署