建立簡單WEB高可用叢集

來源:互聯網
上載者:User

標籤:gen   同步   eth   disabled   htm   高可用叢集   node   時間   style   

 環境介紹

node1:192.168.168.201

node2:192.168.168.202

1.配置主機名稱

[[email protected] ~]# vim /etc/sysconfig/network           #編輯節點1主機名稱設定檔#編輯HOSTNAME=node1.linuxpanda.com[[email protected] ~]# hostname node1.linuxpanda.com        #主機名稱立即生效[[email protected] ~]# vim /etc/sysconfig/network          #編輯節點2主機名稱設定檔#編輯HOSTNAME=node2.linuxpanda.com[[email protected] ~]# hostname node2.linuxpanda.com       #主機名稱立即生效

2.主機互信

具體可以參見我的上一篇部落格:http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_023_sshgenkey.html

[[email protected] ~]# ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa         #產生rsa[[email protected] ~]# ssh-copy-id -i  ~/.ssh/id_rsa.pub [email protected]192.168.168.202  #複製公開金鑰[[email protected] ~]# ssh-keygen -t rsa -P ‘‘ -f ~/.ssh/id_rsa         #產生rsa[[email protected] ~]# ssh-copy-id -i  ~/.ssh/id_rsa.pub [email protected]192.168.168.201  #複製公開金鑰
[[email protected] ~]# ssh 192.168.168.202 ‘ip addr show dev eth0 ‘ #測試node1 ssh node2
[[email protected] ~]# ssh 192.168.168.201 ‘ip addr show dev eth0 ‘ #測試node2 ssh node1
 

3.host檔案配置

host設定檔配置主要用於名稱解析, 我們不建議使用dns解析,否則dns無法解析就會導致叢集服務的崩潰。

[[email protected] ~]# vim /etc/hosts#添加如下2行192.168.168.201 node1.linuxpanda.com node1192.168.168.202 node2.linuxpanda.com node2
[[email protected] ~]# scp /etc/hosts [email protected]:/etc/hosts #host檔案複製一份到node2中去
[[email protected] ~]# ping node2 -c 1 #node1 ping node2
[[email protected] ~]# ping node1 -c 1 #node2 ping node1

 4.防火牆和selinux設定

[[email protected] ~]# service iptables stop                     #關閉node防火牆iptables: Flushing firewall rules:                         [  OK  ]iptables: Setting chains to policy ACCEPT: filter          [  OK  ]iptables: Unloading modules:                               [  OK  ][[email protected] ~]# ssh node2 ‘service iptables stop‘         #關閉node2防火牆iptables: Flushing firewall rules: [  OK  ]iptables: Setting chains to policy ACCEPT: filter [  OK  ]iptables: Unloading modules: [  OK  ]
[[email protected] ~]# sed -i ‘/SELINUX/s/enforcing/disabled/‘ /etc/selinux/config  #修改node1selinux設定[[email protected] ~]# setenforce 0                                                 #立馬生效[[email protected] ~]# ssh node2 "sed -i ‘/SELINUX/s/enforcing/disabled/‘           #修改node1selinux設定[[email protected] ~]# ssh node2 " setenforce 0‘                                    #立馬生效

5.時間同步

具體參見我的另一篇部落格:http://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_linux_022_ntp.html

6.

 

建立簡單WEB高可用叢集

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.