配置环境
准备: 三台虚拟机
配置主节点:
1. 查看当前使用网卡
[[email protected] ~]# dmesg | grep -i eth Bluetooth: BNEP (Ethernet Emulation) ver 1.3 eth0: no IPv6 routers present
dmesg是显示开机启动信息, grep -i是忽略大小写查找
2. 查看当前ip、网关
[[email protected] ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:E0:C3:61 inet addr:192.168.182.138 Bcast:192.168.182.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fee0:c361/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:24092 errors:0 dropped:0 overruns:0 frame:0 TX packets:12373 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:35176927 (33.5 MiB) TX bytes:672502 (656.7 KiB) Interrupt:19 Base address:0x2024 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
配置静态IP:
[[email protected] ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" #BOOTPROTO="dhcp" BOOTPROTO="static" HWADDR="00:0C:29:E0:C3:61" #IPV6INIT="yes" IPV6INIT="no" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="7039ffae-3334-4445-b571-a805eecd4a77" IPADDR=192.168.182.101 NETMASK=255.255.255.0 GATEWAY=192.168.182.255
修改主机名:
[[email protected] ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=master [[email protected] ~]# hostname master [[email protected] ~]# hostname master
修改hosts文件:
[[email protected] ~]# vi /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.182.101 master
关闭防火墙(生产环境不能关闭, 需要添加允许列表)
[[email protected] ~]# service iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] [[email protected] ~]# chkconfig iptables off
关闭
selinux
[[email protected] ~]# vi /etc/selinux/config
将SELINUX的值对应修改为: SELINUX=disabled
将两台从属节点按照上面的配置配好, ip分别设置为192.168.182.102和192.168.182.103, 主机名分别为slave1、slave2。
时间: 2024-10-07 05:51:39