商城网站——集群服务搭建
一:基础环境配置(镜像用的是CentOS-7-x86_64-DVD-1511.iso)
1】配置网卡和主机名(虚拟机安装的时候使用的是:basic network services)
[root@mall ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16777728
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=c0f1a360-5aa7-48d8-8940-c5da25bec069
DEVICE=eno16777728
ONBOOT=yes
IPADDR=192.168.33.106
NETMASK=255.255.255.0
GATEWAY=192.168.33.2
DNS1=8.8.8.8
[root@mall ~]# hostname mall
[root@mall ~]# bash
[root@mall ~]# vim /etc/hostname 进入配置文件,修改原来的主机名,保存退出,重启即可生效。
2】永久关闭防火墙和selinux
[root@mall ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@mall ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@mall ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2023-01-15 20:19:01 CST; 14min ago
Main PID: 920 (firewalld)
CGroup: /system.slice/firewalld.service
└─920 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jan 15 20:19:00 mall systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 15 20:19:01 mall systemd[1]: Started firewalld - dynamic firewall daemon.
3】本地yum源配置和gpmall-repo挂载:
(1)上传gpmall-repo的服务软件包,我这里用的是windTerm连接的虚拟机。
(可能是由于centos7的虚拟机在安装时设置了基础服务配置,导致了安装java服务出现了冲突问题)
所以我们配置完镜像挂载后,先安装完Java的服务后再配置gpmall-repo的挂载。
进行yum源配置:
[root@mall ~]# cd /opt/
[root@mall opt]# mkdir centos
[root@mall opt]# cd /etc/yum.repos.d/
[root@mall yum.repos.d]# mkdir bak
[root@mall yum.repos.d]# mv CentOS-* bak/
[root@mall yum.repos.d]# vim local.repo
[root@mall yum.repos.d]# cat local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0