标签:
准备: 三台虚拟机
配置主节点:
1. 查看当前使用网卡
[root@localhost ~]# dmesg | grep -i eth Bluetooth: BNEP (Ethernet Emulation) ver 1.3 eth0: no IPv6 routers presentdmesg是显示开机启动信息, grep -i是忽略大小写查找
2. 查看当前ip、网关
[root@localhost ~]# 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:
[root@localhost ~]# 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修改主机名:
[root@localhost ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=master [root@localhost ~]# hostname master [root@localhost ~]# hostname master
修改hosts文件:
[root@localhost ~]# 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关闭防火墙(生产环境不能关闭, 需要添加允许列表)
[root@localhost ~]# service iptables stop iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] [root@localhost ~]# chkconfig iptables off关闭 selinux
[root@localhost ~]# vi /etc/selinux/config
将SELINUX的值对应修改为: SELINUX=disabled
将两台从属节点按照上面的配置配好, ip分别设置为192.168.182.102和192.168.182.103, 主机名分别为slave1、slave2。
标签:
原文地址:http://my.oschina.net/xiaoqqq/blog/393257