標籤: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高可用叢集